summaryrefslogtreecommitdiffstats
path: root/src/com.gluster.storage.management.console/src
diff options
context:
space:
mode:
authorDhandapani <dhandapani@gluster.com>2011-10-19 14:36:43 +0530
committerDhandapani <dhandapani@gluster.com>2011-10-19 14:38:29 +0530
commit23256a8c5d9bdabb43960770a08015f177c5b012 (patch)
treeaf62bd8a550c24e74046f63d7da104c6c1b7459f /src/com.gluster.storage.management.console/src
parentbf85b1ed176ea3f1c44689888d5df62fd1a84051 (diff)
Force start volume option implemented to start offline brick
Diffstat (limited to 'src/com.gluster.storage.management.console/src')
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java2
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java69
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/RemoveBrickAction.java4
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java2
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java2
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java4
6 files changed, 76 insertions, 7 deletions
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java
index 3de3f945..f5f7d209 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java
@@ -87,7 +87,7 @@ public class DeleteVolumeAction extends AbstractMonitoredActionDelegate {
try {
monitor.setTaskName("Deleting volume [" + volume.getName() + "]");
if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // stop if online volume
- vc.stopVolume(volume.getName());
+ vc.stopVolume(volume.getName(), false);
}
vc.deleteVolume(volume.getName(), confirmDeleteDir);
modelManager.deleteVolume(volume);
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java
new file mode 100644
index 00000000..f6f0e44b
--- /dev/null
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java
@@ -0,0 +1,69 @@
+package com.gluster.storage.management.console.actions;
+
+import java.util.Set;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+
+import com.gluster.storage.management.client.VolumesClient;
+import com.gluster.storage.management.console.utils.GUIHelper;
+import com.gluster.storage.management.console.views.VolumeBricksView;
+import com.gluster.storage.management.core.model.Brick;
+import com.gluster.storage.management.core.model.Brick.BRICK_STATUS;
+import com.gluster.storage.management.core.model.Volume;
+
+public class ForceStartVolumeAction extends AbstractActionDelegate {
+
+ private Volume volume;
+ private GUIHelper guiHelper = GUIHelper.getInstance();
+ private Set<Brick> bricks;
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ protected void performAction(IAction action) {
+ // volume brick service will be started, do you want to continue?
+ final String actionDesc = action.getDescription();
+ boolean confirmed = showConfirmDialog(actionDesc,
+ "Volume brick service will be started, do you want to continue?");
+ if (!confirmed) {
+ return;
+ }
+ try {
+ new VolumesClient().startVolume(volume.getName(), true);
+ showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] forcefully started successfully!");
+ } catch (Exception e) {
+ showErrorDialog(actionDesc,
+ "Failed to forcefully start volume [" + volume.getName() + "]! Error: [" + e.getMessage() + "]");
+ }
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ super.selectionChanged(action, selection);
+
+ volume = guiHelper.getSelectedEntity(window, Volume.class);
+ if (volume != null) {
+ // a volume is selected on navigation tree. Let's check if the currently open view is volume bricks view
+ IWorkbenchPart view = guiHelper.getActiveView();
+ if (view instanceof VolumeBricksView) {
+ // volume bricks view is open. check if any offline brick is selected
+ bricks = GUIHelper.getInstance().getSelectedEntities(getWindow(), Brick.class);
+ for (Brick brick : bricks) {
+ if (brick.getStatus() == BRICK_STATUS.OFFLINE) {
+ action.setEnabled(true);
+ } else {
+ // if any one of the selected brick is online, the disable the button
+ action.setEnabled(false);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/RemoveBrickAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/RemoveBrickAction.java
index 4b747294..105ab0da 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/RemoveBrickAction.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/RemoveBrickAction.java
@@ -71,10 +71,10 @@ public class RemoveBrickAction extends AbstractActionDelegate {
action.setEnabled(false);
volume = guiHelper.getSelectedEntity(window, Volume.class);
if (volume != null) {
- // a volume is selected on navigation tree. Let's check if the currently open view is volume disks view
+ // a volume is selected on navigation tree. Let's check if the currently open view is volume bricks view
IWorkbenchPart view = guiHelper.getActiveView();
if (view instanceof VolumeBricksView) {
- // volume disks view is open. check if any brick is selected
+ // volume bricks view is open. check if any brick is selected
bricks = GUIHelper.getInstance().getSelectedEntities(getWindow(), Brick.class);
action.setEnabled(bricks.size() > 0);
}
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java
index 0df91ab8..6407b322 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java
@@ -84,7 +84,7 @@ public class StartVolumeAction extends AbstractMonitoredActionDelegate {
}
try {
monitor.setTaskName("Starting volume [" + volume.getName() + "]");
- vc.startVolume(volume.getName());
+ vc.startVolume(volume.getName(), false);
startedVolumes.add(volume.getName());
} catch (Exception e) {
failedVolumes.add(volume.getName());
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java
index 31f8d164..dad5d4ac 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java
@@ -94,7 +94,7 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
}
try {
monitor.setTaskName("Stopping volume [" + volume.getName() + "]");
- vc.stopVolume(volume.getName());
+ vc.stopVolume(volume.getName(), false);
// modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE);
stoppedVolumes.add(volume.getName());
} catch (Exception e) {
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java
index 227c60b7..1558749c 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java
@@ -99,7 +99,7 @@ public class CreateVolumeWizard extends Wizard {
boolean warning = false;
if (page.startVolumeAfterCreation()) {
try {
- volumesClient.startVolume(newVolume.getName());
+ volumesClient.startVolume(newVolume.getName(), false);
newVolume.setStatus(VOLUME_STATUS.ONLINE);
message = "Volume created and started successfully!";
} catch(Exception e) {
@@ -127,7 +127,7 @@ public class CreateVolumeWizard extends Wizard {
+ errMsg + CoreConstants.NEWLINE + CoreConstants.NEWLINE
+ "Do you still want to start the volume [" + newVolume.getName() + "]?")) {
try {
- volumesClient.startVolume(newVolume.getName());
+ volumesClient.startVolume(newVolume.getName(), false);
newVolume.setStatus(VOLUME_STATUS.ONLINE);
message1 = "Volume [" + newVolume.getName() + "] started successfully!"; // Only start operation
} catch(Exception e1) {