diff options
| author | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-11-02 00:47:54 -0700 |
|---|---|---|
| committer | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-11-02 00:47:54 -0700 |
| commit | 3fd5258868fd6361d5cc2856be619e6243458fad (patch) | |
| tree | ea69f63242529af35c981f9df6819cfafd474a13 /src/com.gluster.storage.management.console | |
| parent | 7e88adeca93e3a91cb94ae97dfeaaf34abeebe52 (diff) | |
| parent | 4d5d0e128c35bbff661966b5a5daea6cc8698b26 (diff) | |
Merge pull request #292 from Dhandapani/master
Force start volume option implemented to start offline brick
Diffstat (limited to 'src/com.gluster.storage.management.console')
7 files changed, 89 insertions, 7 deletions
diff --git a/src/com.gluster.storage.management.console/plugin.xml b/src/com.gluster.storage.management.console/plugin.xml index 95615346..2b27f496 100644 --- a/src/com.gluster.storage.management.console/plugin.xml +++ b/src/com.gluster.storage.management.console/plugin.xml @@ -526,6 +526,17 @@ label="Volume Actions" visible="false"> <action + class="com.gluster.storage.management.console.actions.ForceStartVolumeAction" + definitionId="com.gluster.storage.management.console.commands.ForceStartVolume" + icon="icons/tango/32x32/start-volume.png" + id="com.gluster.storage.management.console.actions.ForceStartVolumeAction" + label="Start Offline Bricks" + menubarPath="com.gluster.storage.management.console.menu.volume/volume" + style="push" + toolbarPath="Normal" + tooltip="Start all Offline Bricks of the selected Volume"> + </action> + <action class="com.gluster.storage.management.console.actions.VolumeLogRotateAction" definitionId="com.gluster.storage.management.console.commands.LogRotate" icon="icons/tango/32x32/log-rotate.png" 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..101b7982 --- /dev/null +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java @@ -0,0 +1,71 @@ +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; +import com.gluster.storage.management.core.utils.StringUtil; + +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, + "The offline Bricks [" + StringUtil.collectionToString(bricks, ", ") + "] of Volume [" + + volume.getName() + "] will be started. Are you sure you want to continue?"); + if (!confirmed) { + return; + } + try { + new VolumesClient().startVolume(volume.getName(), true); + showInfoDialog(actionDesc, "Offline Bricks of Volume [" + volume.getName() + "] started successfully!"); + } catch (Exception e) { + showErrorDialog(actionDesc, 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) { |
