summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSelvasundaram <selvam@gluster.com>2011-08-07 19:25:38 +0530
committerSelvasundaram <selvam@gluster.com>2011-08-07 19:27:01 +0530
commitc61b6300cb55cf186a4a01d0a8316c12e8556e82 (patch)
tree8d090df5488a846a2e115bb5a3756f031774f010 /src
parent1468f3020481bc4243e46111f4faf8d550085238 (diff)
Bug 3349 - Completed tasks still showing as running task - fix
Diffstat (limited to 'src')
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/AlertsManager.java13
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/ClusterSummaryView.java26
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java31
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java41
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java1
5 files changed, 78 insertions, 34 deletions
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/AlertsManager.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/AlertsManager.java
index 26419446..40a64498 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/AlertsManager.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/AlertsManager.java
@@ -37,7 +37,7 @@ import com.gluster.storage.management.core.model.Partition;
import com.gluster.storage.management.core.model.Server.SERVER_STATUS;
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.core.utils.NumberUtil;
public class AlertsManager {
private List<Alert> alerts = new ArrayList<Alert>();
@@ -118,8 +118,9 @@ public class AlertsManager {
// To check High CPU usage
if (server.getCpuUsage() >= CPU_USAGE_THRESHOLD) {
serverAlerts.add(new Alert(ALERT_TYPES.CPU_USAGE_ALERT, server.getName(),
- Alert.ALERT_TYPE_STR[ALERT_TYPES.CPU_USAGE_ALERT.ordinal()] + " [" + server.getCpuUsage()
- + "] in server [" + server.getName() + "]"));
+ Alert.ALERT_TYPE_STR[ALERT_TYPES.CPU_USAGE_ALERT.ordinal()] + " ["
+ + NumberUtil.formatNumber(server.getCpuUsage()) + "] in server [" + server.getName()
+ + "]"));
}
// To check High Memory usage
@@ -127,7 +128,7 @@ public class AlertsManager {
if (memoryUtilized >= MEMORY_USAGE_THRESHOLD) {
serverAlerts.add(new Alert(ALERT_TYPES.MEMORY_USAGE_ALERT, server.getName(),
Alert.ALERT_TYPE_STR[ALERT_TYPES.MEMORY_USAGE_ALERT.ordinal()] + " ["
- + StringUtil.formatNumber(memoryUtilized, 2) + "%] in server [" + server.getName()
+ + NumberUtil.formatNumber(memoryUtilized) + "%] in server [" + server.getName()
+ "]"));
}
@@ -164,7 +165,7 @@ public class AlertsManager {
if (deviceSpaceUsed >= DISK_SPACE_USAGE_THRESHOLD) {
diskAlerts.add(new Alert(ALERT_TYPES.DISK_USAGE_ALERT, partition.getQualifiedName(),
Alert.ALERT_TYPE_STR[ALERT_TYPES.DISK_USAGE_ALERT.ordinal()] + " ["
- + StringUtil.formatNumber(deviceSpaceUsed, 2) + "% used] in disk ["
+ + NumberUtil.formatNumber(deviceSpaceUsed) + "% used] in disk ["
+ partition.getQualifiedName() + "]"));
}
}
@@ -177,7 +178,7 @@ public class AlertsManager {
if (deviceSpaceUsed >= DISK_SPACE_USAGE_THRESHOLD) {
diskAlerts.add(new Alert(ALERT_TYPES.DISK_USAGE_ALERT, disk.getQualifiedName(),
Alert.ALERT_TYPE_STR[ALERT_TYPES.DISK_USAGE_ALERT.ordinal()] + " ["
- + StringUtil.formatNumber(deviceSpaceUsed, 2) + "% used] in ["
+ + NumberUtil.formatNumber(deviceSpaceUsed) + "% used] in ["
+ disk.getQualifiedName() + "]"));
}
}
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/ClusterSummaryView.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/ClusterSummaryView.java
index 436b7134..c48bfb83 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/ClusterSummaryView.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/ClusterSummaryView.java
@@ -62,6 +62,7 @@ import com.gluster.storage.management.core.model.GlusterServer;
import com.gluster.storage.management.core.model.Server;
import com.gluster.storage.management.core.model.Server.SERVER_STATUS;
import com.gluster.storage.management.core.model.ServerStats;
+import com.gluster.storage.management.core.model.Status;
import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.core.utils.NumberUtil;
@@ -326,7 +327,7 @@ public class ClusterSummaryView extends ViewPart {
createNetworkUsageSection();
createActionsSection();
createAlertsSection();
- createRunningTasksSection();
+ createTasksSection();
parent.layout(); // IMP: lays out the form properly
}
@@ -373,14 +374,16 @@ public class ClusterSummaryView extends ViewPart {
chartUtil.new NetworkChartPeriodLinkListener(null, networkStatsPeriod, toolkit), -1, 4);
}
- private void createRunningTasksSection() {
- tasksSection = guiHelper.createSection(form, toolkit, "Running Tasks", null, 1, false);
+ private void createTasksSection() {
+ tasksSection = guiHelper.createSection(form, toolkit, CoreConstants.RUNNING_TASKS, null, 1, false);
populateTasksSection();
}
private void populateTasksSection() {
for (TaskInfo taskInfo : cluster.getTaskInfoList()) {
- addTaskLabel(tasksSection, taskInfo);
+ if (taskInfo.getStatus().getCode() != Status.STATUS_CODE_SUCCESS) {
+ addTaskLabel(tasksSection, taskInfo);
+ }
}
tasksSection.layout();
form.reflow(true);
@@ -389,7 +392,6 @@ public class ClusterSummaryView extends ViewPart {
private void addTaskLabel(Composite section, TaskInfo taskInfo) {
//TODO: create link and open the task progress view
CLabel lblAlert = new CLabel(section, SWT.NONE);
- lblAlert.setText(taskInfo.getDescription());
Image taskImage = null;
switch(taskInfo.getType()) {
@@ -403,6 +405,20 @@ public class ClusterSummaryView extends ViewPart {
taskImage = guiHelper.getImage(IImageKeys.VOLUME_REBALANCE_22x22);
break;
}
+
+ String description = taskInfo.getDescription();
+ switch (taskInfo.getStatus().getCode()) {
+ case Status.STATUS_CODE_PAUSE:
+ description += " (paused)";
+ break;
+ case Status.STATUS_CODE_COMMIT_PENDING:
+ description += " (commit pending)";
+ break;
+ case Status.STATUS_CODE_FAILURE:
+ description += " (failed)";
+ break;
+ }
+ lblAlert.setText(description);
lblAlert.setImage(taskImage);
lblAlert.redraw();
}
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java
index 3d33a1eb..b3879e4f 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java
@@ -45,6 +45,7 @@ import com.gluster.storage.management.core.model.EntityGroup;
import com.gluster.storage.management.core.model.Event;
import com.gluster.storage.management.core.model.GlusterServer;
import com.gluster.storage.management.core.model.Server.SERVER_STATUS;
+import com.gluster.storage.management.core.model.Status;
import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.core.model.TaskInfo.TASK_TYPE;
@@ -230,15 +231,16 @@ public class GlusterServersSummaryView extends ViewPart {
}
private void createRunningTasksSection() {
- tasksSection = guiHelper.createSection(form, toolkit, "Running Tasks", null, 1, false);
+ tasksSection = guiHelper.createSection(form, toolkit, CoreConstants.RUNNING_TASKS, null, 1, false);
populateTasksSection();
-
}
private void populateTasksSection() {
for (TaskInfo taskInfo : GlusterDataModelManager.getInstance().getModel().getCluster().getTaskInfoList()) {
// Exclude volume related tasks
- if (taskInfo.getType() != TASK_TYPE.VOLUME_REBALANCE && taskInfo.getType() != TASK_TYPE.BRICK_MIGRATE) {
+ if (taskInfo.getStatus().getCode() != Status.STATUS_CODE_SUCCESS
+ && taskInfo.getType() != TASK_TYPE.VOLUME_REBALANCE
+ && taskInfo.getType() != TASK_TYPE.BRICK_MIGRATE) {
addTaskLabel(tasksSection, taskInfo);
}
}
@@ -247,9 +249,7 @@ public class GlusterServersSummaryView extends ViewPart {
}
private void addTaskLabel(Composite section, TaskInfo taskInfo) {
- CLabel lblAlert = new CLabel(section, SWT.NONE);
- lblAlert.setText(taskInfo.getDescription());
-
+ CLabel lblTask = new CLabel(section, SWT.NONE);
Image taskImage = null;
switch(taskInfo.getType()) {
case DISK_FORMAT:
@@ -262,8 +262,23 @@ public class GlusterServersSummaryView extends ViewPart {
taskImage = guiHelper.getImage(IImageKeys.VOLUME_REBALANCE_22x22);
break;
}
- lblAlert.setImage(taskImage);
- lblAlert.redraw();
+
+ String description = taskInfo.getDescription();
+ switch (taskInfo.getStatus().getCode()) {
+ case Status.STATUS_CODE_PAUSE:
+ description += " (paused)";
+ break;
+ case Status.STATUS_CODE_COMMIT_PENDING:
+ description += " (commit pending)";
+ break;
+ case Status.STATUS_CODE_FAILURE:
+ description += " (failed)";
+ break;
+ }
+
+ lblTask.setText(description);
+ lblTask.setImage(taskImage);
+ lblTask.redraw();
}
/* (non-Javadoc)
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java
index 51ca834c..79ebd84c 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java
@@ -42,6 +42,7 @@ import com.gluster.storage.management.core.model.ClusterListener;
import com.gluster.storage.management.core.model.DefaultClusterListener;
import com.gluster.storage.management.core.model.EntityGroup;
import com.gluster.storage.management.core.model.Event;
+import com.gluster.storage.management.core.model.Status;
import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.core.model.TaskInfo.TASK_TYPE;
import com.gluster.storage.management.core.model.Volume;
@@ -60,7 +61,6 @@ public class VolumesSummaryView extends ViewPart {
private ClusterListener clusterListener;
private static final String ALERTS = "Alerts";
- private static final String RUNNING_TASKS = "Running Tasks";
private static final String VOLUMES_SUMMARY = "Volumes - Summary";
private static final String AVAILABILITY = "Availability";
private Composite alertsSection;
@@ -155,7 +155,7 @@ public class VolumesSummaryView extends ViewPart {
private void createSections(Composite parent) {
form = guiHelper.setupForm(parent, toolkit, VOLUMES_SUMMARY);
createSummarySection();
- createRunningTasksSection();
+ createTasksSection();
createAlertsSection();
parent.layout(); // IMP: lays out the form properly
@@ -184,14 +184,15 @@ public class VolumesSummaryView extends ViewPart {
lblAlert.redraw();
}
- private void createRunningTasksSection() {
- tasksSection = guiHelper.createSection(form, toolkit, RUNNING_TASKS, null, 1, false);
+ private void createTasksSection() {
+ tasksSection = guiHelper.createSection(form, toolkit, CoreConstants.RUNNING_TASKS, null, 1, false);
populateTasks();
}
private void populateTasks() {
for (TaskInfo taskInfo : cluster.getTaskInfoList()) {
- if (taskInfo.getType() == TASK_TYPE.BRICK_MIGRATE || taskInfo.getType() == TASK_TYPE.VOLUME_REBALANCE)
+ if ((taskInfo.getType() == TASK_TYPE.BRICK_MIGRATE || taskInfo.getType() == TASK_TYPE.VOLUME_REBALANCE)
+ && taskInfo.getStatus().getCode() != Status.STATUS_CODE_SUCCESS)
addTaskLabel(tasksSection, taskInfo);
}
tasksSection.pack(true);
@@ -200,17 +201,27 @@ public class VolumesSummaryView extends ViewPart {
private void addTaskLabel(Composite section, TaskInfo taskInfo) {
// Task related to Volumes context
- if (taskInfo.getType() == TASK_TYPE.BRICK_MIGRATE
- || taskInfo.getType() == TASK_TYPE.VOLUME_REBALANCE) {
- if (taskInfo.getStatus().isPercentageSupported()) {
- // TODO Progress bar or link to progress view
- }
- CLabel lblAlert = new CLabel(section, SWT.NONE);
- lblAlert.setText(taskInfo.getDescription());
- lblAlert.setImage((taskInfo.getType() == TASK_TYPE.BRICK_MIGRATE) ? guiHelper
- .getImage(IImageKeys.BRICK_MIGRATE_32x32) : guiHelper.getImage(IImageKeys.VOLUME_REBALANCE_32x32));
- lblAlert.redraw();
+ if (taskInfo.getStatus().isPercentageSupported()) {
+ // TODO Progress bar or link to progress view
+ }
+
+ CLabel lblTask = new CLabel(section, SWT.NONE);
+ String description = taskInfo.getDescription();
+ switch (taskInfo.getStatus().getCode()) {
+ case Status.STATUS_CODE_PAUSE:
+ description += " (paused)";
+ break;
+ case Status.STATUS_CODE_COMMIT_PENDING:
+ description += " (commit pending)";
+ break;
+ case Status.STATUS_CODE_FAILURE:
+ description += " (failed)";
+ break;
}
+ lblTask.setText(description);
+ lblTask.setImage((taskInfo.getType() == TASK_TYPE.BRICK_MIGRATE) ? guiHelper
+ .getImage(IImageKeys.BRICK_MIGRATE_32x32) : guiHelper.getImage(IImageKeys.VOLUME_REBALANCE_32x32));
+ lblTask.redraw();
}
private void createSummarySection() {
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java
index a9309c85..42f0e7a9 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/constants/CoreConstants.java
@@ -36,4 +36,5 @@ public class CoreConstants {
public static final String OFFLINE = "OFFLINE";
public static final String ONLINE = "ONLINE";
public static final String UNKNOWN = "UNKNOWN";
+ public static final String RUNNING_TASKS = "Tasks";
}