diff options
| author | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-07-29 10:09:40 -0700 |
|---|---|---|
| committer | Shireesh Anjal <anjalshireesh@gmail.com> | 2011-07-29 10:09:40 -0700 |
| commit | 6a6cdc52e31eafaf7900a73fe8166f4d048d9327 (patch) | |
| tree | 819911632b6fae494f65b8cdc51a5ff12dcec649 /src | |
| parent | c841da7ead48d325e351c6a462589a6a43e0a754 (diff) | |
| parent | b98c95d1d700f60f65fd8932aa5c9fc4a825296a (diff) | |
Merge pull request #169 from Selvasundaram/master
Bug 3150 - Brick list is not getting updated after migrate operation - fix
Diffstat (limited to 'src')
6 files changed, 290 insertions, 74 deletions
diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml index 36a3f3d9..46326351 100644 --- a/src/com.gluster.storage.management.gui/plugin.xml +++ b/src/com.gluster.storage.management.gui/plugin.xml @@ -502,7 +502,7 @@ state="false" style="push" toolbarPath="Normal" - tooltip="Migrate Disk"> + tooltip="Migrate Brick"> <enablement> <objectClass name="com.gluster.storage.management.core.model.Disk"> diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java index 6a13fc8e..105af60d 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CommitTaskAction.java @@ -1,12 +1,21 @@ package com.gluster.storage.management.gui.actions; + +import java.util.ArrayList; +import java.util.List; + import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; import com.gluster.storage.management.client.TasksClient; +import com.gluster.storage.management.client.VolumesClient; +import com.gluster.storage.management.core.model.Brick; import com.gluster.storage.management.core.model.Status; import com.gluster.storage.management.core.model.TaskInfo; import com.gluster.storage.management.core.model.TaskStatus; +import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.gui.GlusterDataModelManager; public class CommitTaskAction extends AbstractActionDelegate { @@ -19,12 +28,29 @@ public class CommitTaskAction extends AbstractActionDelegate { try { new TasksClient().commitTask(taskInfo.getName()); taskInfo.setStatus(new TaskStatus(new Status(Status.STATUS_CODE_SUCCESS, "Committed"))); - showInfoDialog(actionDesc, "Commit successful"); modelManager.removeTask(taskInfo); + showInfoDialog(actionDesc, "Commit successful"); } catch (Exception e) { showErrorDialog(actionDesc, "Task [" + taskInfo.getName() + "] could not be Committed! Error: [" + e.getMessage() + "]"); + return; // Prevent to update model } + + BusyIndicator.showWhile(Display.getDefault(), new Runnable() { + @Override + public void run() { + try { + String volumeName = taskInfo.getReference(); + Volume oldVolume = modelManager.getModel().getCluster().getVolume(volumeName); + Volume newVolume = (new VolumesClient()).getVolume(volumeName); + + modelManager.volumeChanged(oldVolume, newVolume); + } catch (Exception e) { + logger.error(e); + showInfoDialog(actionDesc, "Volume brick update failed! [" + e.getMessage() + "]"); + } + } + }); } @Override @@ -37,6 +63,10 @@ public class CommitTaskAction extends AbstractActionDelegate { && taskInfo.getStatus().getCode() == Status.STATUS_CODE_COMMIT_PENDING); } } + + public void updateVolume(String volumeName) { + + } @Override public void dispose() { diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java index 058eabb1..fa686c72 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DeleteVolumeAction.java @@ -18,7 +18,10 @@ *******************************************************************************/ package com.gluster.storage.management.gui.actions; -import org.apache.log4j.Logger; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; @@ -26,24 +29,31 @@ import org.eclipse.jface.viewers.ISelection; import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; +import com.gluster.storage.management.core.utils.StringUtil; import com.gluster.storage.management.gui.GlusterDataModelManager; import com.gluster.storage.management.gui.IImageKeys; import com.gluster.storage.management.gui.utils.GUIHelper; public class DeleteVolumeAction extends AbstractActionDelegate { - private Volume volume; private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); - private static final Logger logger = Logger.getLogger(DeleteVolumeAction.class); + private List<Volume> volumes = new ArrayList<Volume>(); + private List<String> selectedVolumeNames = new ArrayList<String>(); + private List<String> onlineVolumeNames = new ArrayList<String>(); @Override protected void performAction(final IAction action) { final String actionDesc = action.getDescription(); + VolumesClient vc = new VolumesClient(); + collectVolumeNames(); String warningMessage; - if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { - warningMessage = "Are you sure to delete the Volume[" + volume.getName() + "] ?"; + if (onlineVolumeNames.size() > 0) { // There are some online volumes, get confirmation to stop and delete all + // the volumes + warningMessage = "Following volume(s) [" + StringUtil.collectionToString(onlineVolumeNames, ", ") + + "] are online, \nAre you sure to continue?"; } else { - warningMessage = "Volume [" + volume.getName() + "] is online, \nAre you sure to continue?"; + warningMessage = "Are you sure to delete the following volume(s) [" + + StringUtil.collectionToString(selectedVolumeNames, ", ") + "] ?"; } Integer deleteOption = new MessageDialog(getShell(), "Delete Volume", GUIHelper.getInstance().getImage( @@ -53,36 +63,56 @@ public class DeleteVolumeAction extends AbstractActionDelegate { return; } - VolumesClient client = new VolumesClient(); + boolean confirmDelete = (deleteOption == 1) ? true : false; + List<String> deletedVolumes = new ArrayList<String>(); + List<String> failedVolumes = new ArrayList<String>(); + String errorMessage = ""; - if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // To stop the volume service, if running + for (Volume volume : volumes) { try { - client.stopVolume(volume.getName()); + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // stop if online volume + vc.stopVolume(volume.getName()); + } + vc.deleteVolume(volume, confirmDelete); + modelManager.deleteVolume(volume); + deletedVolumes.add(volume.getName()); } catch (Exception e) { - showErrorDialog(actionDesc, - "Volume [" + volume.getName() + "] could not be stopped! Error: [" + e.getMessage() + "]"); - return; + // there is a possibility that the error was in post-delete operation, which means + // volume was deleted, but some other error happened. check if this is the case. + if (vc.volumeExists(volume.getName())) { + errorMessage += "\nVolume [" + volume.getName() + "] could not be deleted! Error: [" + + e.getMessage() + "]"; + failedVolumes.add(volume.getName()); + } else { + errorMessage += "\nVolume deleted, but following error(s) occured: [" + e.getMessage() + "]"; + modelManager.deleteVolume(volume); + deletedVolumes.add(volume.getName()); + } } } - boolean confirmDelete = false; - if (deleteOption == 1) { - confirmDelete = true; + // Display the success or failure info + if (deletedVolumes.size() == 0) { // No volume(s) deleted successfully + showErrorDialog(actionDesc, "Following colume(s) [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] could not be delete! " + "\nError: [" + errorMessage + "]"); + } else { + String info = "Following volumes [" + StringUtil.collectionToString(deletedVolumes, ", ") + + "] are deleted successfully!"; + if (errorMessage != "") { + info += "\n\nFollowing volumes [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] are failed to delete! [" + errorMessage + "]"; + } + showInfoDialog(actionDesc, info); } + } - try { - client.deleteVolume(volume, confirmDelete); - showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] deleted successfully!"); - modelManager.deleteVolume(volume); - } catch (Exception e) { - // there is a possibility that the error was in post-delete operation, which means - // volume was deleted, but some other error happened. check if this is the case. - if (client.volumeExists(volume.getName())) { - showErrorDialog(actionDesc, - "Volume [" + volume.getName() + "] could not be deleted! Error: [" + e.getMessage() + "]"); - } else { - showWarningDialog(actionDesc, "Volume deleted, but following error(s) occured: " + e.getMessage()); - modelManager.deleteVolume(volume); + private void collectVolumeNames() { + selectedVolumeNames.clear(); + onlineVolumeNames.clear(); + for (Volume volume : volumes) { + selectedVolumeNames.add(volume.getName()); + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { + onlineVolumeNames.add(volume.getName()); } } } @@ -94,9 +124,17 @@ public class DeleteVolumeAction extends AbstractActionDelegate { @Override public void selectionChanged(IAction action, ISelection selection) { - super.selectionChanged(action, selection); - if (selectedEntity instanceof Volume) { - volume = (Volume) selectedEntity; + Set<Volume> selectedVolumes = GUIHelper.getInstance().getSelectedEntities(getWindow(), Volume.class); + volumes.clear(); + if (selectedVolumes == null || selectedVolumes.isEmpty()) { + super.selectionChanged(action, selection); + if (selectedEntity instanceof Volume) { + volumes.add((Volume) selectedEntity); + } + } else { + volumes.addAll(selectedVolumes); //TODO reverse the collection to maintain the selected order } + + action.setEnabled( (volumes.size() > 0) ); } } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java index a6151824..b52952af 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StartVolumeAction.java @@ -18,39 +18,89 @@ *******************************************************************************/ package com.gluster.storage.management.gui.actions; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; +import com.gluster.storage.management.core.utils.StringUtil; import com.gluster.storage.management.gui.GlusterDataModelManager; +import com.gluster.storage.management.gui.utils.GUIHelper; public class StartVolumeAction extends AbstractActionDelegate { - private Volume volume; + //private Volume volume; private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); + private List<Volume> volumes = new ArrayList<Volume>(); + private List<String> selectedVolumeNames = new ArrayList<String>(); + private List<String> offlineVolumeNames = new ArrayList<String>(); @Override protected void performAction(IAction action) { - if (volume.getStatus() == VOLUME_STATUS.ONLINE) { + final String actionDesc = action.getDescription(); + VolumesClient vc = new VolumesClient(); + + collectVolumeNames(); + + if (offlineVolumeNames.size() == 0) { + String errorMessage; + if (selectedVolumeNames.size() == 1) { + errorMessage = "Volume [" + StringUtil.collectionToString(selectedVolumeNames, ", ") + "] is already online!"; + } else { + errorMessage = "Volumes [" + StringUtil.collectionToString(selectedVolumeNames, ", ") + "] are already online!"; + } + showWarningDialog(actionDesc, errorMessage); return; // Volume already online. Don't do anything. } + + List<String> startedVolumes = new ArrayList<String>(); + List<String> failedVolumes = new ArrayList<String>(); + String errorMessage = ""; + + for (Volume volume : volumes) { + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { + continue; // skip if online volume + } + try { + vc.startVolume(volume.getName()); + modelManager.updateVolumeStatus(volume, VOLUME_STATUS.ONLINE); + startedVolumes.add(volume.getName()); + }catch (Exception e) { + failedVolumes.add(volume.getName()); + errorMessage += e.getMessage(); + } + } - VolumesClient client = new VolumesClient(); - final String actionDesc = action.getDescription(); - try { - client.startVolume(volume.getName()); - showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] started successfully!"); - modelManager.updateVolumeStatus(volume, VOLUME_STATUS.ONLINE); - - Volume updatedVolume = client.getVolume(volume.getName()); - modelManager.volumeChanged(volume, updatedVolume); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Volume [" + volume.getName() + "] could not be started! Error: [" + e.getMessage() + "]"); + // Display the success or failure info + if (startedVolumes.size() == 0) { // No volume(s) started successfully + showErrorDialog(actionDesc, "Following volume(s) [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] could not be start! " + "\nError: [" + errorMessage + "]"); + } else { + String info = "Following volume(s) [" + StringUtil.collectionToString(startedVolumes, ", ") + + "] are started successfully!"; + if (errorMessage != "") { + info += "\n\nFollowing volume(s) [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] are failed to start! [" + errorMessage + "]"; + } + showInfoDialog(actionDesc, info); } } + private void collectVolumeNames() { + selectedVolumeNames.clear(); + offlineVolumeNames.clear(); + for (Volume volume : volumes) { + selectedVolumeNames.add(volume.getName()); + if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { + offlineVolumeNames.add(volume.getName()); + } + } + } + @Override public void dispose() { @@ -58,11 +108,24 @@ public class StartVolumeAction extends AbstractActionDelegate { @Override public void selectionChanged(IAction action, ISelection selection) { - super.selectionChanged(action, selection); + Set<Volume> selectedVolumes = GUIHelper.getInstance().getSelectedEntities(getWindow(), Volume.class); + volumes.clear(); + if (selectedVolumes == null || selectedVolumes.isEmpty()) { + super.selectionChanged(action, selection); + if (selectedEntity instanceof Volume) { + volumes.add((Volume) selectedEntity); + } + } else { + volumes.addAll(selectedVolumes); //TODO reverse the collection to maintain the selected order + } - if (selectedEntity instanceof Volume) { - volume = (Volume) selectedEntity; - action.setEnabled(volume.getStatus() == VOLUME_STATUS.OFFLINE); + action.setEnabled(false); + // To enable the action + for (Volume volume : volumes) { + if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { + action.setEnabled(true); + break;// If find an online volume, enable the action + } } } } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java index 4ee2cff3..f2d23490 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/StopVolumeAction.java @@ -18,6 +18,10 @@ *******************************************************************************/ package com.gluster.storage.management.gui.actions; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ISelection; @@ -25,37 +29,87 @@ import org.eclipse.jface.viewers.ISelection; import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; +import com.gluster.storage.management.core.utils.StringUtil; import com.gluster.storage.management.gui.GlusterDataModelManager; import com.gluster.storage.management.gui.IImageKeys; import com.gluster.storage.management.gui.utils.GUIHelper; public class StopVolumeAction extends AbstractActionDelegate { - private Volume volume; private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); + private List<Volume> volumes = new ArrayList<Volume>(); + private List<String> selectedVolumeNames = new ArrayList<String>(); + private List<String> onlineVolumeNames = new ArrayList<String>(); @Override protected void performAction(final IAction action) { final String actionDesc = action.getDescription(); - if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { - showWarningDialog(actionDesc, "Volume [" + volume.getName() + "] is already offline!"); + VolumesClient vc = new VolumesClient(); + + collectVolumeNames(); + + if (onlineVolumeNames.size() == 0) { + String errorMessage; + if (selectedVolumeNames.size() == 1) { + errorMessage = "Volume [" + StringUtil.collectionToString(selectedVolumeNames, ", ") + + "] is already offline!"; + } else { + errorMessage = "Volumes [" + StringUtil.collectionToString(selectedVolumeNames, ", ") + + "] are already offline!"; + } + showWarningDialog(actionDesc, errorMessage); return; // Volume already offline. Don't do anything. } - Integer deleteOption = new MessageDialog(getShell(), "Stop Volume", GUIHelper.getInstance().getImage( - IImageKeys.VOLUME_16x16), "Are you sure you want to stop the volume [" + volume.getName() + "] ?", - MessageDialog.QUESTION, new String[] { "No", "Yes" }, -1).open(); + Integer userAction = new MessageDialog(getShell(), "Stop Volume", GUIHelper.getInstance().getImage( + IImageKeys.VOLUME_16x16), "Are you sure you want to stop the following volume(s)?\n" + "[" + + StringUtil.collectionToString(onlineVolumeNames, ", ") + "]", MessageDialog.QUESTION, new String[] { + "No", "Yes" }, -1).open(); - if (deleteOption <= 0) { + if (userAction <= 0) { // user select cancel or pressed escape key return; } - try { - new VolumesClient().stopVolume(volume.getName()); - showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] stopped successfully!"); - modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); - } catch (Exception e) { - showErrorDialog(actionDesc, - "Volume [" + volume.getName() + "] could not be stopped! Error: [" + e.getMessage() + "]"); + List<String> stoppedVolumes = new ArrayList<String>(); + List<String> failedVolumes = new ArrayList<String>(); + String errorMessage = ""; + + for (Volume volume : volumes) { + if (volume.getStatus() == VOLUME_STATUS.OFFLINE) { + continue; // skip if offline volume + } + try { + vc.stopVolume(volume.getName()); + modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE); + stoppedVolumes.add(volume.getName()); + } catch (Exception e) { + failedVolumes.add(volume.getName()); + errorMessage += e.getMessage(); + } + } + + // Display the success or failure info + if (stoppedVolumes.size() == 0) { // No volume(s) stopped successfully + showErrorDialog(actionDesc, "Following volume(s) [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] could not be stopped! " + "\nError: [" + errorMessage + "]"); + } else { + String info = "Following volume(s) [" + StringUtil.collectionToString(stoppedVolumes, ", ") + + "] are stopped successfully!"; + if (errorMessage != "") { + info += "\n\nFollowing volume(s) [" + StringUtil.collectionToString(failedVolumes, ", ") + + "] are failed to stop! [" + errorMessage + "]"; + } + showInfoDialog(actionDesc, info); + } + } + + private void collectVolumeNames() { + selectedVolumeNames.clear(); + onlineVolumeNames.clear(); + for (Volume volume : volumes) { + selectedVolumeNames.add(volume.getName()); + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { + onlineVolumeNames.add(volume.getName()); + } } } @@ -72,11 +126,25 @@ public class StopVolumeAction extends AbstractActionDelegate { */ @Override public void selectionChanged(IAction action, ISelection selection) { - super.selectionChanged(action, selection); - if (selectedEntity instanceof Volume) { - volume = (Volume) selectedEntity; - action.setEnabled(volume.getStatus() == VOLUME_STATUS.ONLINE); + Set<Volume> selectedVolumes = GUIHelper.getInstance().getSelectedEntities(getWindow(), Volume.class); + volumes.clear(); + if (selectedVolumes == null || selectedVolumes.isEmpty()) { + super.selectionChanged(action, selection); + if (selectedEntity instanceof Volume) { + volumes.add((Volume) selectedEntity); + } + } else { + volumes.addAll(selectedVolumes); //TODO reverse the collection to maintain the selected order + } + + action.setEnabled(false); + // To enable the action + for (Volume volume : volumes) { + if (volume.getStatus() == VOLUME_STATUS.ONLINE) { + action.setEnabled(true); + break;// If find an online volume, enable the action + } } } } diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java index c125a3c8..055cb769 100644 --- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/dialogs/MigrateBrickWizard.java @@ -28,6 +28,7 @@ import com.gluster.storage.management.client.VolumesClient; import com.gluster.storage.management.core.model.Brick; import com.gluster.storage.management.core.model.Cluster; import com.gluster.storage.management.core.model.TaskInfo; +import com.gluster.storage.management.core.model.TaskStatus; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.gui.GlusterDataModelManager; @@ -35,7 +36,8 @@ public class MigrateBrickWizard extends Wizard { private Volume volume; private Brick brick; private MigrateBrickPage1 page; - private Cluster cluster = GlusterDataModelManager.getInstance().getModel().getCluster(); + private GlusterDataModelManager modelManager = GlusterDataModelManager.getInstance(); + private Cluster cluster = modelManager.getModel().getCluster(); public MigrateBrickWizard(Volume volume, Brick brick) { setWindowTitle("Gluster Management Console - Migrate Brick [" + volume.getName() + "]"); @@ -57,6 +59,7 @@ public class MigrateBrickWizard extends Wizard { String targetDir = page.getTargetBrickDir(); Boolean autoCommit = page.getAutoCommitSelection(); VolumesClient volumesClient = new VolumesClient(); + String dialogTitle = "Brick migration"; try { URI uri = volumesClient.startMigration(volume.getName(), sourceDir, targetDir, autoCommit); @@ -66,11 +69,25 @@ public class MigrateBrickWizard extends Wizard { TaskInfo taskInfo = taskClient.getTaskInfo(uri); if (taskInfo != null && taskInfo instanceof TaskInfo) { cluster.addTaskInfo(taskInfo); - GlusterDataModelManager.getInstance().refreshVolumeData(cluster.getVolume(taskInfo.getReference())); - } - MessageDialog.openInformation(getShell(), "Brick migration", "Brick migration started successfully"); + modelManager.refreshVolumeData(cluster.getVolume(taskInfo.getReference())); + + // If auto commit selected and migration operation complete immediately, + if (taskInfo.getStatus().getCode() == TaskStatus.STATUS_CODE_SUCCESS) { + + String volumeName = taskInfo.getReference(); + Volume oldVolume = cluster.getVolume(volumeName); + Volume newVolume = (new VolumesClient()).getVolume(volumeName); + + modelManager.volumeChanged(oldVolume, newVolume); + + MessageDialog.openInformation(getShell(), dialogTitle, "Brick migration completed successfully"); + return true; + } + } + MessageDialog.openInformation(getShell(), dialogTitle, "Brick migration started successfully"); + } catch (Exception e) { - MessageDialog.openError(getShell(), "Error: Migrate brick", e.getMessage()); + MessageDialog.openError(getShell(), dialogTitle, "Brick Migration failed! [" + e.getMessage() + "]"); } return true; } |
