32
32
#include "stcbase.h"
33
33
#include "utils.h"
34
34
#include "recovery.h"
35
+ #include "modreg.h"
35
36
36
37
#include "zis/message.h"
37
38
#include "zis/parm.h"
@@ -82,6 +83,9 @@ See details in the ZSS Cross Memory Server installation guide
82
83
#define ZIS_PARM_DEV_MODE_LPA CMS_PROD_ID".DEV_MODE.LPA"
83
84
#define ZIS_PARM_DEV_MODE_ON "YES"
84
85
86
+ #define ZIS_PARM_MODREG CMS_PROD_ID".MODULE_REGISTRY"
87
+ #define ZIS_PARM_MODREG_OFF "NO"
88
+
85
89
#define ZIS_PARMLIB_PARM_SERVER_NAME CMS_PROD_ID".NAME"
86
90
87
91
#define ZIS_DYN_LINKAGE_PLUGIN_MOD_SUFFIX "ISDL"
@@ -676,18 +680,49 @@ static int relocatePluginToLPAIfNeeded(ZISContext *context,
676
680
/* Check if LPA, and load if needed */
677
681
if (lpaNeeded ) {
678
682
683
+ const char * status = "n/a" ;
684
+
679
685
if (!lpaPresent ) {
680
686
681
687
EightCharString ddname = {"STEPLIB " };
682
- int lpaRSN = 0 ;
683
- int lpaRC = lpaAdd (& anchor -> moduleInfo , & ddname , & moduleName , & lpaRSN );
684
- if (lpaRC != 0 ) {
685
- zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_SEVERE , ZIS_LOG_LPA_FAILURE_MSG ,
686
- "ADD" , anchor -> moduleInfo .inputInfo .name , lpaRC , lpaRSN );
687
- return RC_ZIS_ERROR ;
688
+
689
+ if (zisIsModregOn (context ) && !zisIsLPADevModeOn (context )) {
690
+ uint64_t modregRSN ;
691
+ int modregRC = modregRegister (ddname , moduleName , & anchor -> moduleInfo ,
692
+ & modregRSN );
693
+ if (modregRC == RC_MODREG_OK ) {
694
+ status = "new instance added to registry" ;
695
+ lpaPresent = true;
696
+ } else if (modregRC == RC_MODREG_ALREADY_REGISTERED ) {
697
+ status = "existing instance reused from registry" ;
698
+ lpaPresent = true;
699
+ } else if (modregRC == RC_MODREG_MARK_MISSING ) {
700
+ zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_INFO ,
701
+ ZIS_LOG_MODREG_NO_MARK_MSG , moduleName .text );
702
+ } else {
703
+ zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_SEVERE ,
704
+ ZIS_LOG_MODREG_FAILURE_MSG , moduleName .text ,
705
+ modregRC , modregRSN );
706
+ return RC_ZIS_ERROR ;
707
+ }
708
+ }
709
+
710
+ if (!lpaPresent ) {
711
+ int lpaRSN = 0 ;
712
+ int lpaRC = lpaAdd (& anchor -> moduleInfo , & ddname , & moduleName , & lpaRSN );
713
+ if (lpaRC == 0 ) {
714
+ status = "own instance loaded to LPA" ;
715
+ } else {
716
+ zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_SEVERE ,
717
+ ZIS_LOG_LPA_FAILURE_MSG ,
718
+ "ADD" , moduleName .text , lpaRC , lpaRSN );
719
+ return RC_ZIS_ERROR ;
720
+ }
688
721
}
689
722
690
723
anchor -> flags |= ZIS_PLUGIN_ANCHOR_FLAG_LPA ;
724
+ } else {
725
+ status = "previously added/loaded instance reused" ;
691
726
}
692
727
693
728
/* Invoke EP to get relocated services */
@@ -699,6 +734,16 @@ static int relocatePluginToLPAIfNeeded(ZISContext *context,
699
734
700
735
* pluginAddr = getPluginDescriptor ();
701
736
737
+ zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_INFO ,
738
+ ZIS_LOG_MODULE_STATUS_MSG " (%p)" , moduleName .text , status ,
739
+ lpaInfo -> outputInfo .stuff .successInfo .loadPointAddr );
740
+
741
+ } else {
742
+
743
+ zowelog (NULL , LOG_COMP_ID_CMS , ZOWE_LOG_INFO ,
744
+ ZIS_LOG_MODULE_STATUS_MSG , moduleName .text ,
745
+ "private storage instance used" );
746
+
702
747
}
703
748
704
749
return RC_ZIS_OK ;
@@ -1443,7 +1488,7 @@ static int loadConfig(ZISContext *context,
1443
1488
1444
1489
static int getCMSConfigFlags (const ZISParmSet * zisParms ) {
1445
1490
1446
- int flags = CMS_SERVER_FLAG_NONE ;
1491
+ int flags = CMS_SERVER_FLAG_USE_MODREG ;
1447
1492
1448
1493
const char * coldStartValue = zisGetParmValue (zisParms , ZIS_PARM_COLD_START );
1449
1494
if (coldStartValue && strlen (coldStartValue ) == 0 ) {
@@ -1475,6 +1520,11 @@ static int getCMSConfigFlags(const ZISParmSet *zisParms) {
1475
1520
flags |= CMS_SERVER_FLAG_RESET_LOOKUP ;
1476
1521
}
1477
1522
1523
+ const char * modregMode = zisGetParmValue (zisParms , ZIS_PARM_MODREG );
1524
+ if (modregMode && !strcmp (modregMode , ZIS_PARM_MODREG_OFF )) {
1525
+ flags &= ~CMS_SERVER_FLAG_USE_MODREG ;
1526
+ }
1527
+
1478
1528
return flags ;
1479
1529
}
1480
1530
0 commit comments