diff options
Diffstat (limited to 'src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java')
-rw-r--r-- | src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java index df33d7ba..1a86b9cd 100644 --- a/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java +++ b/src/com.gluster.storage.management.gateway/src/com/gluster/storage/management/gateway/services/VolumeService.java @@ -670,8 +670,8 @@ public class VolumeService { taskResource.getTask(clusterName, taskId).stop(); } - public void startVolume(String clusterName, GlusterServer onlineServer, Volume volume) { - glusterUtil.startVolume(volume.getName(), onlineServer.getName()); + public void startVolume(String clusterName, GlusterServer onlineServer, Volume volume, Boolean force) { + glusterUtil.startVolume(volume.getName(), onlineServer.getName(), force); // call the start_volume_cifs.py script only if the volume is cifs enabled if (volume.isCifsEnable()) { @@ -679,8 +679,8 @@ public class VolumeService { } } - public void stopVolume(String clusterName, GlusterServer onlineServer, Volume volume) { - glusterUtil.stopVolume(volume.getName(), onlineServer.getName()); + public void stopVolume(String clusterName, GlusterServer onlineServer, Volume volume, Boolean force) { + glusterUtil.stopVolume(volume.getName(), onlineServer.getName(), force); // call the stop_volume_cifs.py script only if the volume is cifs enabled if (volume.isCifsEnable()) { @@ -708,27 +708,28 @@ public class VolumeService { } } - public void performVolumeOperation(String clusterName, String volumeName, String operation) { + public void performVolumeOperation(String clusterName, String volumeName, String operation, Boolean force) { GlusterServer onlineServer = clusterService.getOnlineServer(clusterName); try { if (onlineServer == null) { throw new GlusterRuntimeException("No online servers found in cluster [" + clusterName + "]"); } - performOperation(clusterName, volumeName, operation, onlineServer); + performOperation(clusterName, volumeName, operation, onlineServer, force); } catch (Exception e) { // check if online server has gone offline. If yes, try again one more time. if (e instanceof ConnectionException || serverUtil.isServerOnline(onlineServer) == false) { // online server has gone offline! try with a different one. onlineServer = clusterService.getNewOnlineServer(clusterName); - performOperation(clusterName, volumeName, operation, onlineServer); + performOperation(clusterName, volumeName, operation, onlineServer, force); } else { throw new GlusterRuntimeException(e.getMessage()); } } } - private void performOperation(String clusterName, String volumeName, String operation, GlusterServer onlineServer) { + private void performOperation(String clusterName, String volumeName, String operation, GlusterServer onlineServer, + Boolean force) { Volume volume = null; try { volume = getVolume(clusterName, volumeName); @@ -738,9 +739,9 @@ public class VolumeService { } if (operation.equals(TASK_START)) { - startVolume(clusterName, onlineServer, volume); + startVolume(clusterName, onlineServer, volume, force); } else if (operation.equals(TASK_STOP)) { - stopVolume(clusterName, onlineServer, volume); + stopVolume(clusterName, onlineServer, volume, force); } else { throw new GlusterValidationException("Invalid operation code [" + operation + "]"); } |