mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix for PowerFlex MDM configuration on host while preparing the SDC connection (#11458)
This commit is contained in:
parent
f671461d4c
commit
5a90da3276
@ -653,10 +653,24 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor {
|
|||||||
if (!ScaleIOUtil.startSDCService()) {
|
if (!ScaleIOUtil.startSDCService()) {
|
||||||
return new Ternary<>(false, null, "Couldn't start SDC service on host");
|
return new Ternary<>(false, null, "Couldn't start SDC service on host");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MapUtils.isNotEmpty(details) && details.containsKey(ScaleIOGatewayClient.STORAGE_POOL_MDMS)) {
|
||||||
|
// Assuming SDC service is started, add mdms
|
||||||
|
String mdms = details.get(ScaleIOGatewayClient.STORAGE_POOL_MDMS);
|
||||||
|
String[] mdmAddresses = mdms.split(",");
|
||||||
|
if (mdmAddresses.length > 0) {
|
||||||
|
if (ScaleIOUtil.isMdmPresent(mdmAddresses[0])) {
|
||||||
|
return new Ternary<>(true, getSDCDetails(details), "MDM added, no need to prepare the SDC client");
|
||||||
|
}
|
||||||
|
|
||||||
|
ScaleIOUtil.addMdms(mdmAddresses);
|
||||||
|
if (!ScaleIOUtil.isMdmPresent(mdmAddresses[0])) {
|
||||||
|
return new Ternary<>(false, null, "Failed to add MDMs");
|
||||||
} else {
|
} else {
|
||||||
logger.debug("SDC service is active on host, re-starting it");
|
logger.debug(String.format("MDMs %s added to storage pool %s", mdms, uuid));
|
||||||
if (!ScaleIOUtil.restartSDCService()) {
|
applyMdmsChangeWaitTime(details);
|
||||||
return new Ternary<>(false, null, "Couldn't restart SDC service on host");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,13 +798,13 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor {
|
|||||||
if (sdcId != null) {
|
if (sdcId != null) {
|
||||||
sdcDetails.put(ScaleIOGatewayClient.SDC_ID, sdcId);
|
sdcDetails.put(ScaleIOGatewayClient.SDC_ID, sdcId);
|
||||||
return sdcDetails;
|
return sdcDetails;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
String sdcGuId = ScaleIOUtil.getSdcGuid();
|
String sdcGuId = ScaleIOUtil.getSdcGuid();
|
||||||
if (sdcGuId != null) {
|
if (sdcGuId != null) {
|
||||||
sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId);
|
sdcDetails.put(ScaleIOGatewayClient.SDC_GUID, sdcGuId);
|
||||||
return sdcDetails;
|
return sdcDetails;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(timeBetweenTries);
|
Thread.sleep(timeBetweenTries);
|
||||||
|
|||||||
@ -92,34 +92,6 @@ public class ScaleIOStorageAdaptorTest {
|
|||||||
Assert.assertEquals("SDC service not enabled on host", result.third());
|
Assert.assertEquals("SDC service not enabled on host", result.third());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPrepareStorageClient_SDCServiceNotRestarted() {
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-active scini"))).thenReturn(0);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl restart scini"))).thenReturn(1);
|
|
||||||
|
|
||||||
Ternary<Boolean, Map<String, String>, String> result = scaleIOStorageAdaptor.prepareStorageClient(poolUuid, new HashMap<>());
|
|
||||||
|
|
||||||
Assert.assertFalse(result.first());
|
|
||||||
Assert.assertNull(result.second());
|
|
||||||
Assert.assertEquals("Couldn't restart SDC service on host", result.third());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testPrepareStorageClient_SDCServiceRestarted() {
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-active scini"))).thenReturn(0);
|
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl restart scini"))).thenReturn(0);
|
|
||||||
|
|
||||||
Ternary<Boolean, Map<String, String>, String> result = scaleIOStorageAdaptor.prepareStorageClient(poolUuid, new HashMap<>());
|
|
||||||
|
|
||||||
Assert.assertFalse(result.first());
|
|
||||||
Assert.assertNull(result.second());
|
|
||||||
Assert.assertEquals("Couldn't get the SDC details on the host", result.third());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPrepareStorageClient_SDCServiceNotStarted() {
|
public void testPrepareStorageClient_SDCServiceNotStarted() {
|
||||||
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3);
|
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user