Skip to content

Commit 5aaf33f

Browse files
Added agent property 'powerflex.sdc.service.wait' for the time (in secs) to wait after SDC service start/restart/stop
1 parent 6273234 commit 5aaf33f

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ public static class Property <T>{
823823
private T defaultValue;
824824
private Class<T> typeClass;
825825

826-
Property(String name, T value) {
826+
public Property(String name, T value) {
827827
init(name, value);
828828
}
829829

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.cloudstack.storage.datastore.util;
1919

20+
import com.cloud.agent.properties.AgentProperties;
21+
import com.cloud.agent.properties.AgentPropertiesFileHandler;
2022
import org.apache.logging.log4j.Logger;
2123
import org.apache.logging.log4j.LogManager;
2224

@@ -60,6 +62,14 @@ public class ScaleIOUtil {
6062
private static final String SDC_SERVICE_ENABLE_CMD = "systemctl enable scini";
6163

6264
public static final String CONNECTED_SDC_COUNT_STAT = "ConnectedSDCCount";
65+
66+
/**
67+
* Time (in seconds) to wait after SDC service 'scini' start/restart/stop.<br>
68+
* Data type: Integer.<br>
69+
* Default value: <code>3</code>
70+
*/
71+
public static final AgentProperties.Property<Integer> SDC_SERVICE_ACTION_WAIT = new AgentProperties.Property<>("powerflex.sdc.service.wait", 3);
72+
6373
/**
6474
* Cmd for querying volumes in SDC
6575
* Sample output for cmd: drv_cfg --query_vols:
@@ -219,7 +229,7 @@ public static boolean startSDCService() {
219229
if (exitValue != 0) {
220230
return false;
221231
}
222-
waitForSecs(3);
232+
waitForSdcServiceActionToComplete();
223233
return true;
224234
}
225235

@@ -228,7 +238,7 @@ public static boolean stopSDCService() {
228238
if (exitValue != 0) {
229239
return false;
230240
}
231-
waitForSecs(1);
241+
waitForSdcServiceActionToComplete();
232242
return true;
233243
}
234244

@@ -237,16 +247,19 @@ public static boolean restartSDCService() {
237247
if (exitValue != 0) {
238248
return false;
239249
}
240-
waitForSecs(3);
250+
waitForSdcServiceActionToComplete();
241251
return true;
242252
}
243253

244-
private static void waitForSecs(long waitTimeInSecs) {
254+
private static void waitForSdcServiceActionToComplete() {
255+
// Wait for the SDC service to settle after start/restart/stop and reaches a stable state
256+
int waitTimeInSecs = AgentPropertiesFileHandler.getPropertyValue(SDC_SERVICE_ACTION_WAIT);
245257
if (waitTimeInSecs < 0) {
246-
waitTimeInSecs = 1;
258+
waitTimeInSecs = SDC_SERVICE_ACTION_WAIT.getDefaultValue();
247259
}
248260
try {
249-
Thread.sleep(waitTimeInSecs * 1000);
261+
LOGGER.debug(String.format("Waiting for %d secs after SDC service action, to reach a stable state", waitTimeInSecs));
262+
Thread.sleep(waitTimeInSecs * 1000L);
250263
} catch (InterruptedException ignore) {
251264
}
252265
}

0 commit comments

Comments
 (0)