summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShireesh Anjal <anjalshireesh@gmail.com>2011-12-09 03:58:10 -0800
committerShireesh Anjal <anjalshireesh@gmail.com>2011-12-09 03:58:10 -0800
commit6d2b4b7f75f4b1e88f6af78408e38b769b0b44ad (patch)
treeef8b6923493da5b8e432ebdf3bc76c78debcd2f9
parentf74c1187a69f7033aaca9133a5b406b5107c2436 (diff)
parent638cebcf4433b12cf6ba29a4ec3964ef55edf1e6 (diff)
Merge pull request #19 from Dhandapani/master
Bug 3857: Replace-brick operation fails. Fails to generate tasks view - fixed
-rw-r--r--src/org.gluster.storage.management.console/icons/tango/16x16/error.pngbin0 -> 603 bytes
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/IImageKeys.java1
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/TasksTableLabelProvider.java4
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/ClearTaskAction.java3
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/RebalanceVolumeAction.java7
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/StopTaskAction.java5
-rw-r--r--src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/MigrateBrickWizard.java7
-rw-r--r--src/org.gluster.storage.management.core/src/org/gluster/storage/management/core/model/Status.java1
-rw-r--r--src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/TasksResource.java3
-rw-r--r--src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/MigrateBrickTask.java8
-rw-r--r--src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/RebalanceVolumeTask.java4
11 files changed, 29 insertions, 14 deletions
diff --git a/src/org.gluster.storage.management.console/icons/tango/16x16/error.png b/src/org.gluster.storage.management.console/icons/tango/16x16/error.png
new file mode 100644
index 0000000..a9e4ff3
--- /dev/null
+++ b/src/org.gluster.storage.management.console/icons/tango/16x16/error.png
Binary files differ
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/IImageKeys.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/IImageKeys.java
index 6a6c96e..c1d7dd2 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/IImageKeys.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/IImageKeys.java
@@ -81,6 +81,7 @@ public interface IImageKeys {
public static final String COMMIT_TASK_32x32 = "icons/tango/32x32/commit-task.png";
public static final String PAUSE_TASK_16x16 = "icons/tango/16x16/pause.png";
public static final String RESUME_TASK_16x16 = "icons/tango/16x16/start.png";
+ public static final String ERROR_TASK_16x16 = "icons/tango/16x16/error.png";
public static final String STOP_TASK_16x16 = "icons/tango/16x16/stop.png";
public static final String CLEAR_TASK_16x16 = "icons/tango/16x16/close_task.png";
public static final String COMPLETED_TASK_16x16 = "icons/tango/16x16/task-completed.png";
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/TasksTableLabelProvider.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/TasksTableLabelProvider.java
index 65b37c3..72f2556 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/TasksTableLabelProvider.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/TasksTableLabelProvider.java
@@ -48,7 +48,9 @@ public class TasksTableLabelProvider extends TableLabelProviderAdapter {
case Status.STATUS_CODE_RUNNING:
return guiHelper.getImage(IImageKeys.RESUME_TASK_16x16);
case Status.STATUS_CODE_FAILURE:
- return guiHelper.getImage(IImageKeys.STATUS_OFFLINE_16x16);
+ return guiHelper.getImage(IImageKeys.STATUS_OFFLINE_16x16);
+ case Status.STATUS_CODE_ERROR:
+ return guiHelper.getImage(IImageKeys.ERROR_TASK_16x16);
default:
break;
}
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/ClearTaskAction.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/ClearTaskAction.java
index d22d765..d22abe6 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/ClearTaskAction.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/ClearTaskAction.java
@@ -51,7 +51,8 @@ public class ClearTaskAction extends AbstractActionDelegate {
if (selectedEntity instanceof TaskInfo) {
taskInfo = (TaskInfo) selectedEntity;
action.setEnabled(taskInfo.getStatus().getCode() == Status.STATUS_CODE_SUCCESS
- || taskInfo.getStatus().getCode() == Status.STATUS_CODE_FAILURE);
+ || taskInfo.getStatus().getCode() == Status.STATUS_CODE_FAILURE
+ || taskInfo.getStatus().getCode() == Status.STATUS_CODE_ERROR);
} else {
action.setEnabled(false);
}
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/RebalanceVolumeAction.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/RebalanceVolumeAction.java
index 2f8d8f6..4e1d712 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/RebalanceVolumeAction.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/RebalanceVolumeAction.java
@@ -54,7 +54,12 @@ public class RebalanceVolumeAction extends AbstractActionDelegate {
if (taskInfo != null) {
GlusterDataModelManager.getInstance().addTask(taskInfo);
}
- showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] rebalance started successfully!");
+ if (taskInfo.getStatus().getCode() == Status.STATUS_CODE_ERROR) {
+ showWarningDialog(actionDesc, "Volume [" + volume.getName()
+ + "] rebalance started, but following error occured: " + taskInfo.getStatus());
+ } else {
+ showInfoDialog(actionDesc, "Volume [" + volume.getName() + "] rebalance started successfully!");
+ }
guiHelper.showTaskView();
} catch (Exception e) {
showErrorDialog(actionDesc, "Volume rebalance could not be started on [" + volume.getName() + "]! Error: ["
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/StopTaskAction.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/StopTaskAction.java
index 5bf9948..1a38741 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/StopTaskAction.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/actions/StopTaskAction.java
@@ -52,8 +52,9 @@ public class StopTaskAction extends AbstractActionDelegate {
if (selectedEntity instanceof TaskInfo) {
taskInfo = (TaskInfo) selectedEntity;
action.setEnabled(taskInfo.getStopSupported()
- && (taskInfo.getStatus().getCode() == Status.STATUS_CODE_PAUSE
- || taskInfo.getStatus().getCode() == Status.STATUS_CODE_RUNNING));
+ && (taskInfo.getStatus().getCode() == Status.STATUS_CODE_PAUSE
+ || taskInfo.getStatus().getCode() == Status.STATUS_CODE_RUNNING || taskInfo.getStatus()
+ .getCode() == Status.STATUS_CODE_ERROR));
}
}
diff --git a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/MigrateBrickWizard.java b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/MigrateBrickWizard.java
index 7baae6b..51d5e1d 100644
--- a/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/MigrateBrickWizard.java
+++ b/src/org.gluster.storage.management.console/src/org/gluster/storage/management/console/dialogs/MigrateBrickWizard.java
@@ -95,7 +95,12 @@ public class MigrateBrickWizard extends Wizard {
return true;
}
}
- MessageDialog.openInformation(getShell(), dialogTitle, "Brick migration started successfully");
+ if (taskInfo.getStatus().getCode() == TaskStatus.STATUS_CODE_RUNNING) {
+ MessageDialog.openInformation(getShell(), dialogTitle, "Brick migration started successfully");
+ } else {
+ MessageDialog.openWarning(getShell(), dialogTitle,
+ "Brick migration started, but following error occured: " + taskInfo.getStatus());
+ }
GUIHelper.getInstance().showTaskView();
} catch (Exception e) {
diff --git a/src/org.gluster.storage.management.core/src/org/gluster/storage/management/core/model/Status.java b/src/org.gluster.storage.management.core/src/org/gluster/storage/management/core/model/Status.java
index 754e715..4fdcd53 100644
--- a/src/org.gluster.storage.management.core/src/org/gluster/storage/management/core/model/Status.java
+++ b/src/org.gluster.storage.management.core/src/org/gluster/storage/management/core/model/Status.java
@@ -34,6 +34,7 @@ public class Status {
public static final int STATUS_CODE_PAUSE = 4;
public static final int STATUS_CODE_WARNING = 5;
public static final int STATUS_CODE_COMMIT_PENDING = 6;
+ public static final int STATUS_CODE_ERROR = 7;
public static final Status STATUS_SUCCESS = new Status(STATUS_CODE_SUCCESS, "Success");
public static final Status STATUS_FAILURE = new Status(STATUS_CODE_FAILURE, "Failure");
diff --git a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/TasksResource.java b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/TasksResource.java
index 9efe51b..e147a7a 100644
--- a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/TasksResource.java
+++ b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/resources/v1_0/TasksResource.java
@@ -192,7 +192,8 @@ public class TasksResource extends AbstractResource {
if(taskOperation == null || taskOperation.isEmpty()) {
int taskStatus = task.getTaskInfo().getStatus().getCode();
- if (taskStatus == Status.STATUS_CODE_SUCCESS || taskStatus == Status.STATUS_CODE_FAILURE) {
+ if (taskStatus == Status.STATUS_CODE_SUCCESS || taskStatus == Status.STATUS_CODE_FAILURE
+ || taskStatus == Status.STATUS_CODE_ERROR) {
taskOperation = RESTConstants.TASK_DELETE;
} else {
taskOperation = RESTConstants.TASK_STOP;
diff --git a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/MigrateBrickTask.java b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/MigrateBrickTask.java
index 7e61f61..8f0f4ef 100644
--- a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/MigrateBrickTask.java
+++ b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/MigrateBrickTask.java
@@ -105,7 +105,6 @@ public class MigrateBrickTask extends Task {
String volumeName = getTaskInfo().getReference().split("#")[0];
glusterInterface.startBrickMigration(onlineServerName, volumeName, getFromBrick(), getToBrick());
getTaskInfo().setStatus(new TaskStatus(new Status(Status.STATUS_CODE_RUNNING, "Brick Migration Started.")));
- System.out.println(getTaskInfo().getStatus().toString());
}
@Override
@@ -195,11 +194,8 @@ public class MigrateBrickTask extends Task {
// online server might have gone offline. try with a new one.
return checkMigrationStatus(getNewOnlineServer().getName());
} else {
- if(e instanceof GlusterRuntimeException) {
- throw ((GlusterRuntimeException)e);
- } else {
- throw new GlusterRuntimeException("Exception while checking brick migration status!", e);
- }
+ getTaskInfo().setStatus(new TaskStatus(new Status(Status.STATUS_CODE_ERROR, e.getMessage())));
+ return taskInfo.getStatus();
}
}
}
diff --git a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/RebalanceVolumeTask.java b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/RebalanceVolumeTask.java
index ef8563e..3f68206 100644
--- a/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/RebalanceVolumeTask.java
+++ b/src/org.gluster.storage.management.gateway/src/org/gluster/storage/management/gateway/tasks/RebalanceVolumeTask.java
@@ -119,9 +119,11 @@ public class RebalanceVolumeTask extends Task {
// online server might have gone offline. update the failure status
getTaskInfo().setStatus(new TaskStatus(new Status(Status.STATUS_CODE_FAILURE, e.getMessage())));
return getTaskInfo().getStatus();
+ } else {
+ getTaskInfo().setStatus(new TaskStatus(new Status(Status.STATUS_CODE_ERROR, e.getMessage())));
+ return getTaskInfo().getStatus();
}
}
- return null;
}
public void setLayout(String layout) {