Skip to content

Commit 1bc40eb

Browse files
Removed --file parameter used with --query_mdms, --query_vols, --query_guid, --rescan in drv_cfg cmd as it is not supported. --file parameter is supported with --add_mdm, --mod_mdm_ip, --remove_mdm, --set_guid, --set_mdm_password, --reset_mdm_password
1 parent 1d504ef commit 1bc40eb

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStorageAdaptorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ public void testUnprepareStorageClient_MDMNotAdded() {
180180
details.put(ScaleIOGatewayClient.STORAGE_POOL_MDMS, "1.1.1.1,2.2.2.2");
181181
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl status scini"))).thenReturn(3);
182182
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0);
183-
when(Script.runSimpleBashScript(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms --file /etc/emc/scaleio/drv_cfg.txt|grep 1.1.1.1"))).thenReturn("MDM-ID 71fd458f0775010f SDC ID 4421a91a00000000 INSTALLATION ID 204930df2cbcaf8e IPs [0]-3.3.3.3 [1]-4.4.4.4");
183+
when(Script.runSimpleBashScript(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms|grep 1.1.1.1"))).thenReturn("MDM-ID 71fd458f0775010f SDC ID 4421a91a00000000 INSTALLATION ID 204930df2cbcaf8e IPs [0]-3.3.3.3 [1]-4.4.4.4");
184184

185185
Pair<Boolean, String> result = scaleIOStorageAdaptor.unprepareStorageClient(poolUuid, details);
186186

@@ -196,9 +196,9 @@ public void testUnprepareStorageClient_RemoveMDMFailed() {
196196
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl is-enabled scini"))).thenReturn(0);
197197
when(Script.executeCommand(Mockito.eq("sed -i '/1.1.1.1\\,/d' /etc/emc/scaleio/drv_cfg.txt"))).thenReturn(new Pair<>(null, null));
198198
when(Script.runSimpleBashScriptForExitValue(Mockito.eq("systemctl restart scini"))).thenReturn(0);
199-
when(Script.runSimpleBashScript(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms --file /etc/emc/scaleio/drv_cfg.txt|grep 1.1.1.1"))).thenReturn("MDM-ID 71fd458f0775010f SDC ID 4421a91a00000000 INSTALLATION ID 204930df2cbcaf8e IPs [0]-1.1.1.1 [1]-2.2.2.2");
199+
when(Script.runSimpleBashScript(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms|grep 1.1.1.1"))).thenReturn("MDM-ID 71fd458f0775010f SDC ID 4421a91a00000000 INSTALLATION ID 204930df2cbcaf8e IPs [0]-1.1.1.1 [1]-2.2.2.2");
200200
when(Script.executeCommand(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg"))).thenReturn(new Pair<>(null, null));
201-
when(Script.executeCommand(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_vols --file /etc/emc/scaleio/drv_cfg.txt"))).thenReturn(new Pair<>("", null));
201+
when(Script.executeCommand(Mockito.eq("/opt/emc/scaleio/sdc/bin/drv_cfg --query_vols"))).thenReturn(new Pair<>("", null));
202202

203203

204204
Pair<Boolean, String> result = scaleIOStorageAdaptor.unprepareStorageClient(poolUuid, details);

plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/storage/ScaleIOStoragePoolTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void testSdcIdAttribute() {
9696

9797
try (MockedStatic<Script> ignored = Mockito.mockStatic(Script.class)) {
9898
when(Script.runSimpleBashScript(
99-
"/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms --file /etc/emc/scaleio/drv_cfg.txt|grep 218ce1797566a00f|awk '{print $5}'")).thenReturn(
99+
"/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms|grep 218ce1797566a00f|awk '{print $5}'")).thenReturn(
100100
sdcId);
101101

102102
ScaleIOStoragePool pool1 = new ScaleIOStoragePool(uuid, "192.168.1.19", 443, "a519be2f00000000", type,
@@ -117,9 +117,9 @@ public void testSdcGuidAttribute() {
117117

118118
try (MockedStatic<Script> ignored = Mockito.mockStatic(Script.class)) {
119119
when(Script.runSimpleBashScript(
120-
"/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms --file /etc/emc/scaleio/drv_cfg.txt|grep 218ce1797566a00f|awk '{print $5}'")).thenReturn(
120+
"/opt/emc/scaleio/sdc/bin/drv_cfg --query_mdms|grep 218ce1797566a00f|awk '{print $5}'")).thenReturn(
121121
null);
122-
when(Script.runSimpleBashScript("/opt/emc/scaleio/sdc/bin/drv_cfg --query_guid --file /etc/emc/scaleio/drv_cfg.txt")).thenReturn(sdcGuid);
122+
when(Script.runSimpleBashScript("/opt/emc/scaleio/sdc/bin/drv_cfg --query_guid")).thenReturn(sdcGuid);
123123

124124
ScaleIOStoragePool pool1 = new ScaleIOStoragePool(uuid, "192.168.1.19", 443, "a519be2f00000000", type,
125125
details, adapter);

plugins/storage/volume/scaleio/src/main/java/org/apache/cloudstack/storage/datastore/util/ScaleIOUtil.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class ScaleIOUtil {
109109
private static final String REMOVE_MDMS_CMD = "drv_cfg " + REMOVE_MDM_PARAMETER;
110110

111111
/**
112-
* Command to get back "Usage" response. As of ow it is just drv_cfg without parameters.
112+
* Command to get back "Usage" response. As of now it is just drv_cfg without parameters.
113113
*/
114114
private static final String USAGE_CMD = "drv_cfg";
115115

@@ -260,7 +260,7 @@ public static Collection<String> getMdmsFromConfig() {
260260
* Returns Volume Ids from {@link ScaleIOUtil#DRV_CFG_FILE}.
261261
*/
262262
public static Collection<String> getVolumeIds() {
263-
String command = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_VOLUMES_CMD + " --file " + DRV_CFG_FILE;
263+
String command = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_VOLUMES_CMD;
264264
Pair<String, String> result = Script.executeCommand(command);
265265
String stdOut = result.first();
266266

@@ -279,7 +279,7 @@ public static Collection<String> getVolumeIds() {
279279
* Returns MDM entries from CLI using {@code --query_mdms}.
280280
*/
281281
public static Collection<String> getMdmsFromCli() {
282-
String command = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD + " --file " + DRV_CFG_FILE;
282+
String command = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD;
283283
Pair<String, String> result = Script.executeCommand(command);
284284
String stdOut = result.first();
285285

@@ -317,7 +317,7 @@ public static boolean isRemoveMdmCliSupported() {
317317
String stdOut = result.second();
318318

319319
/*
320-
* Check whether stderr or stdout contains mdm removal parameter.
320+
* Check whether stderr or stdout contains mdm removal "--remove_mdm" parameter.
321321
*
322322
* Current version returns "Usage" in stderr, check stdout as well in case this will be changed in the future,
323323
* as returned "Usage" is not an error.
@@ -330,7 +330,7 @@ public static boolean isRemoveMdmCliSupported() {
330330
*/
331331
public static boolean isMdmPresent(String mdmAddress) {
332332
//query_mdms outputs "MDM-ID <System/MDM-Id> SDC ID <SDC-Id> INSTALLATION ID <Installation-Id> IPs [0]-x.x.x.x [1]-x.x.x.x" for a MDM with ID: <MDM-Id>
333-
String queryMdmsCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD + " --file " + DRV_CFG_FILE;
333+
String queryMdmsCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD;
334334
queryMdmsCmd += "|grep " + mdmAddress;
335335
String result = Script.runSimpleBashScript(queryMdmsCmd);
336336

@@ -354,7 +354,7 @@ public static String getSdcHomePath() {
354354

355355
public static void rescanForNewVolumes() {
356356
// Detecting new volumes
357-
String rescanCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.RESCAN_CMD + " --file " + DRV_CFG_FILE;
357+
String rescanCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.RESCAN_CMD;
358358

359359
String result = Script.runSimpleBashScript(rescanCmd);
360360
if (result == null) {
@@ -364,7 +364,7 @@ public static void rescanForNewVolumes() {
364364

365365
public static String getSystemIdForVolume(String volumeId) {
366366
//query_vols outputs "VOL-ID <VolumeID> MDM-ID <SystemID>" for a volume with ID: <VolumeID>
367-
String queryDiskCmd = SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_VOLUMES_CMD + " --file " + DRV_CFG_FILE;
367+
String queryDiskCmd = SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_VOLUMES_CMD;
368368
queryDiskCmd += "|grep " + volumeId + "|awk '{print $4}'";
369369

370370
String result = Script.runSimpleBashScript(queryDiskCmd);
@@ -382,7 +382,7 @@ public static String getSystemIdForVolume(String volumeId) {
382382
}
383383

384384
public static String getSdcGuid() {
385-
String queryGuidCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_GUID_CMD + " --file " + DRV_CFG_FILE;
385+
String queryGuidCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_GUID_CMD;
386386
String result = Script.runSimpleBashScript(queryGuidCmd);
387387
if (result == null) {
388388
LOGGER.warn("Failed to get SDC guid");
@@ -404,7 +404,7 @@ public static String getSdcGuid() {
404404

405405
public static String getSdcId(String mdmId) {
406406
//query_mdms outputs "MDM-ID <System/MDM-Id> SDC ID <SDC-Id> INSTALLATION ID <Installation-Id> IPs [0]-x.x.x.x [1]-x.x.x.x" for a MDM with ID: <MDM-Id>
407-
String queryMdmsCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD + " --file " + DRV_CFG_FILE;
407+
String queryMdmsCmd = ScaleIOUtil.SDC_HOME_PATH + "/bin/" + ScaleIOUtil.QUERY_MDMS_CMD;
408408
queryMdmsCmd += "|grep " + mdmId + "|awk '{print $5}'";
409409
String result = Script.runSimpleBashScript(queryMdmsCmd);
410410
if (result == null) {

0 commit comments

Comments
 (0)