Skip to content

Commit 715af6c

Browse files
sureshanapartidhslove
authored andcommitted
Fix for PowerFlex MDM configuration on host while preparing the SDC connection (apache#11458)
1 parent 3a2bd26 commit 715af6c

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptor.java

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -653,10 +653,24 @@ public Ternary<Boolean, Map<String, String>, String> prepareStorageClient(String
653653
if (!ScaleIOUtil.startSDCService()) {
654654
return new Ternary<>(false, null, "Couldn't start SDC service on host");
655655
}
656-
} else {
657-
logger.debug("SDC service is active on host, re-starting it");
658-
if (!ScaleIOUtil.restartSDCService()) {
659-
return new Ternary<>(false, null, "Couldn't restart SDC service on host");
656+
}
657+
658+
if (MapUtils.isNotEmpty(details) && details.containsKey(ScaleIOGatewayClient.STORAGE_POOL_MDMS)) {
659+
// Assuming SDC service is started, add mdms
660+
String mdms = details.get(ScaleIOGatewayClient.STORAGE_POOL_MDMS);
661+
String[] mdmAddresses = mdms.split(",");
662+
if (mdmAddresses.length > 0) {
663+
if (ScaleIOUtil.isMdmPresent(mdmAddresses[0])) {
664+
return new Ternary<>(true, getSDCDetails(details), "MDM added, no need to prepare the SDC client");
665+
}
666+
667+
ScaleIOUtil.addMdms(mdmAddresses);
668+
if (!ScaleIOUtil.isMdmPresent(mdmAddresses[0])) {
669+
return new Ternary<>(false, null, "Failed to add MDMs");
670+
} else {
671+
logger.debug(String.format("MDMs %s added to storage pool %s", mdms, uuid));
672+
applyMdmsChangeWaitTime(details);
673+
}
660674
}
661675
}
662676

@@ -784,12 +798,12 @@ private Map<String, String> getSDCDetails(Map<String, String> details) {
784798
if (sdcId != null) {
785799
sdcDetails.put(ScaleIOGatewayClient.SDC_ID, sdcId);
786800
return sdcDetails;
787-
} else {
788-
String sdcGuId = ScaleIOUtil.getSdcGuid();
789-
if (sdcGuId != null) {
790-
sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId);
791-
return sdcDetails;
792-
}
801+
}
802+
803+
String sdcGuId = ScaleIOUtil.getSdcGuid();
804+
if (sdcGuId != null) {
805+
sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId);
806+
return sdcDetails;
793807
}
794808

795809
try {

0 commit comments

Comments
 (0)