summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShireesh Anjal <anjalshireesh@gmail.com>2011-11-09 23:06:10 -0800
committerShireesh Anjal <anjalshireesh@gmail.com>2011-11-09 23:06:10 -0800
commit0dd987f2af100ae5879d31eb1459b8317caaf4f1 (patch)
tree071c270c9dc4baf9c43973ee0de1d89ee8f0a674
parent10896cbdfc28fb2e1e3fb118c4194b23bcb907b2 (diff)
parentdcba1b60f258d98ab0ef654af1883cc5c295143c (diff)
Merge pull request #294 from Dhandapani/master
Story #70: "Force" option in volume stop
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/GlusterDataModelManager.java42
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/DeleteVolumeAction.java106
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/ForceStartVolumeAction.java2
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StartVolumeAction.java16
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/actions/StopVolumeAction.java103
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterServersSummaryView.java7
-rw-r--r--src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumesSummaryView.java23
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java4
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java10
-rw-r--r--src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java2
10 files changed, 250 insertions, 65 deletions
diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/GlusterDataModelManager.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/GlusterDataModelManager.java
index e43bcbae..a6daee79 100644
--- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/GlusterDataModelManager.java
+++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/GlusterDataModelManager.java
@@ -408,6 +408,11 @@ public class GlusterDataModelManager {
public void volumeChanged(Volume oldVolume, Volume newVolume) {
oldVolume.copyFrom(newVolume);
+
+ if (oldVolume.getStatus() != newVolume.getStatus()) {
+ updateVolumeStatusAlert(newVolume, newVolume.getStatus());
+ }
+
for (ClusterListener listener : listeners) {
listener.volumeChanged(oldVolume, new Event(EVENT_TYPE.VOLUME_CHANGED, newVolume));
}
@@ -746,6 +751,7 @@ public class GlusterDataModelManager {
public void updateVolumeStatus(Volume volume, VOLUME_STATUS newStatus) {
volume.setStatus(newStatus);
+ updateVolumeStatusAlert(volume, newStatus);
if(newStatus == VOLUME_STATUS.OFFLINE) {
// mark as bricks also as offline
@@ -762,6 +768,42 @@ public class GlusterDataModelManager {
listener.volumeChanged(volume, new Event(EVENT_TYPE.BRICKS_CHANGED, volume.getBricks()));
}
}
+
+ private void updateVolumeStatusAlert(Volume volume, VOLUME_STATUS newStatus) {
+ Alert alert = null;
+ if (newStatus == VOLUME_STATUS.OFFLINE) {
+ alert = createOfflineVolumeAlert(volume);
+ for (ClusterListener listener : listeners) {
+ listener.alertCreated(alert);
+ }
+ } else {
+ alert = removeOfflineVolumeAlert(volume);
+ for (ClusterListener listener : listeners) {
+ listener.alertRemoved(alert);
+ }
+ }
+ }
+
+ private Alert createOfflineVolumeAlert(Volume volume) {
+ Alert alert = new Alert(ALERT_TYPES.OFFLINE_VOLUME_ALERT, volume.getName(),
+ Alert.ALERT_TYPE_STR[ALERT_TYPES.OFFLINE_VOLUME_ALERT.ordinal()] + " [" + volume.getName() + "]");
+ getModel().getCluster().addAlert(alert);
+ return alert;
+ }
+
+ private Alert removeOfflineVolumeAlert(Volume volume) {
+ List<Alert> clusterAlerts = getModel().getCluster().getAlerts();
+ Alert removedAlert = null;
+ for (Alert alert : clusterAlerts) {
+ if (alert.getType().equals(ALERT_TYPES.OFFLINE_VOLUME_ALERT)
+ && alert.getReference().equals(volume.getName())) {
+ removedAlert = alert;
+ clusterAlerts.remove(alert);
+ break;
+ }
+ }
+ return removedAlert;
+ }
public void resetVolumeOptions(Volume volume) {
volume.getOptions().clear();
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 f5f7d209..ba2ef5c7 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
@@ -40,6 +40,8 @@ public class DeleteVolumeAction extends AbstractMonitoredActionDelegate {
private List<Volume> selectedVolumes = new ArrayList<Volume>();
private List<String> selectedVolumeNames = new ArrayList<String>();
private List<String> onlineVolumeNames = new ArrayList<String>();
+ private List<String> deletedVolumeNames = new ArrayList<String>();
+ private List<Volume> failedVolumes = new ArrayList<Volume>();
@Override
protected void performAction(final IAction action, IProgressMonitor monitor) {
@@ -69,59 +71,111 @@ public class DeleteVolumeAction extends AbstractMonitoredActionDelegate {
warningMessage = "Are you sure to delete the volumes " + selectedVolumeNames + " ?";
}
- final Integer directoryDeleteOption = new MessageDialog(getShell(), "Delete Volume", GUIHelper.getInstance()
+ final Integer deleteOption = new MessageDialog(getShell(), "Delete Volume", GUIHelper.getInstance()
.getImage(IImageKeys.VOLUME_16x16), warningMessage, MessageDialog.QUESTION, new String[] { "Cancel",
"Delete volume and data", "Delete volume, keep data" }, -1).open();
- if (directoryDeleteOption <= 0) { // By Cancel button(0) or Escape key(-1)
+ if (deleteOption <= 0) { // By Cancel button(0) or Escape key(-1)
return;
}
+ String errorMessage = deleteVolumes(selectedVolumes, deleteOption, monitor);
+
+ // Display the success or failure info
+ if (deletedVolumeNames.size() == 0) { // No volume(s) deleted successfully
+ showErrorDialog(actionDesc, "Volume(s) could not be deleted! " + CoreConstants.NEWLINE + errorMessage);
+ } else {
+ String info = "Volume(s) " + deletedVolumeNames + " deleted successfully!";
+ if (!failedVolumes.isEmpty()) {
+ info += CoreConstants.NEWLINE + CoreConstants.NEWLINE + "Volumes " + failedVolumes
+ + " could not be deleted!" + CoreConstants.NEWLINE + errorMessage;
+ }
+
+ if (selectedVolumes.size() == deletedVolumeNames.size()) {
+ showInfoDialog(actionDesc, info);
+ } else {
+ showWarningDialog(actionDesc, info);
+ }
+ }
+ }
+
+ private String deleteVolumes(List<Volume> volumes, final Integer deleteOption, IProgressMonitor monitor) {
+ deletedVolumeNames.clear();
+ failedVolumes.clear();
VolumesClient vc = new VolumesClient();
- boolean confirmDeleteDir = (directoryDeleteOption == 1) ? true : false;
- List<String> deletedVolumeNames = new ArrayList<String>();
- List<String> failedVolumes = new ArrayList<String>();
+ boolean confirmDeleteDir = (deleteOption == 1) ? true : false;
+
String errorMessage = "";
- monitor.beginTask("Deleting Selected Volumes...", selectedVolumes.size());
- for (Volume volume : selectedVolumes.toArray(new Volume[0])) {
- try {
- monitor.setTaskName("Deleting volume [" + volume.getName() + "]");
- if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // stop if online volume
+ // To calculate the total work we need to sum volumes size + online volumes (because we treat stop and delete as
+ // separate steps)
+ List<Volume> onlineVolumes = getOnlineVolumes(volumes);
+ monitor.beginTask("Deleting Selected Volumes...", volumes.size() + onlineVolumes.size());
+
+ // Deletion of a volume results in changes to the model, and ultimately updates the "selectedVolumes" list,
+ // over which we are iterating, thus resulting in ConcurrentModificationException. To avoid this, we iterate
+ // over an array obtained from the list.
+ for (Volume volume : volumes.toArray(new Volume[0])) {
+ if (volume.getStatus() == VOLUME_STATUS.ONLINE) { // stop if online volume
+ monitor.setTaskName("Stopping volume [" + volume.getName() + "]");
+ try {
vc.stopVolume(volume.getName(), false);
+ } catch (Exception e1) {
+ // try again with force = true
+ try {
+ vc.stopVolume(volume.getName(), true);
+ } catch(Exception e2) {
+ // force stop also failed.
+ // Mark as deletion failed, append error message.
+ errorMessage += CoreConstants.NEWLINE + "Stop [" + volume.getName() + "] : [" + e2.getMessage()
+ + "]";
+ failedVolumes.add(volume);
+ // since we are not going to perform delete on this volume,
+ // mark the deletion task as worked
+ monitor.worked(1);
+
+ // continue to next volume without trying to delete this one
+ continue;
+ }
+ } finally {
+ // worked for "stop" operation
+ monitor.worked(1);
}
+ }
+
+ monitor.setTaskName("Deleting volume [" + volume.getName() + "]");
+ try {
vc.deleteVolume(volume.getName(), confirmDeleteDir);
modelManager.deleteVolume(volume);
deletedVolumeNames.add(volume.getName());
} catch (Exception e) {
// Volume delete succeeded and post delete operation (directory cleanup, CIFS etc) may fail
if (vc.volumeExists(volume.getName())) {
- errorMessage += CoreConstants.NEWLINE + "[" + volume.getName() + "] : [" + e.getMessage() + "]";
- failedVolumes.add(volume.getName());
+ errorMessage += CoreConstants.NEWLINE + "Delete [" + volume.getName() + "] : [" + e.getMessage() + "]";
+ failedVolumes.add(volume);
} else {
- errorMessage += CoreConstants.NEWLINE + "Volume deleted, but following error occured: ["
- + e.getMessage() + "]";
+ errorMessage += CoreConstants.NEWLINE + "Volume [" + volume.getName()
+ + "] deleted, but following error occured: [" + e.getMessage() + "]";
modelManager.deleteVolume(volume);
deletedVolumeNames.add(volume.getName());
}
+ } finally {
+ monitor.worked(1);
}
- monitor.worked(1);
}
monitor.done();
+ return errorMessage;
+ }
- // Display the success or failure info
- if (deletedVolumeNames.size() == 0) { // No volume(s) deleted successfully
- showErrorDialog(actionDesc, "volumes " + failedVolumes + " could not be delete! " + CoreConstants.NEWLINE
- + "Error: [" + errorMessage + "]");
- } else {
- String info = "Volumes " + deletedVolumeNames + " deleted successfully!";
- if (!errorMessage.equals("")) {
- info += CoreConstants.NEWLINE + CoreConstants.NEWLINE + "Volumes " + failedVolumes
- + " could not be deleted! [" + errorMessage + "]";
+ private List<Volume> getOnlineVolumes(List<Volume> volumes) {
+ List<Volume> onlineVolumes = new ArrayList<Volume>();
+ for (Volume volume : volumes) {
+ if (volume.getStatus() == VOLUME_STATUS.ONLINE) {
+ onlineVolumes.add(volume);
}
- showInfoDialog(actionDesc, info);
}
+ return onlineVolumes;
}
-
+
private void collectVolumeNames() {
selectedVolumeNames.clear();
onlineVolumeNames.clear();
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
index 101b7982..9201aadb 100644
--- 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
@@ -47,7 +47,7 @@ public class ForceStartVolumeAction extends AbstractActionDelegate {
@Override
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
-
+ 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 bricks view
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 6407b322..d82ab62f 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
@@ -26,13 +26,16 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.osgi.internal.signedcontent.Base64;
import com.gluster.storage.management.client.VolumesClient;
+import com.gluster.storage.management.console.AlertsManager;
import com.gluster.storage.management.console.GlusterDataModelManager;
import com.gluster.storage.management.console.IImageKeys;
import com.gluster.storage.management.console.utils.GUIHelper;
import com.gluster.storage.management.core.constants.CoreConstants;
import com.gluster.storage.management.core.model.Volume;
+import com.gluster.storage.management.core.model.Alert.ALERT_TYPES;
import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS;
public class StartVolumeAction extends AbstractMonitoredActionDelegate {
@@ -74,6 +77,9 @@ public class StartVolumeAction extends AbstractMonitoredActionDelegate {
}
monitor.beginTask("Starting Selected Volumes...", selectedVolumes.size());
+ // Starting of a volume results in changes to the model, and ultimately updates the "selectedVolumes" list,
+ // over which we are iterating, thus resulting in ConcurrentModificationException. To avoid this, we iterate
+ // over an array obtained from the list.
for (Volume volume : selectedVolumes.toArray(new Volume[0])) {
if(monitor.isCanceled()) {
break;
@@ -107,15 +113,19 @@ public class StartVolumeAction extends AbstractMonitoredActionDelegate {
// Display the success or failure info
if (startedVolumes.size() == 0) { // No volume(s) started successfully
- showErrorDialog(actionDesc, "Following volumes " + failedVolumes + " could not be started!"
+ showErrorDialog(actionDesc, "Volume(s) " + failedVolumes + " could not be started!"
+ CoreConstants.NEWLINE + "Error: [" + errorMessage + "]");
} else {
- String info = "Volumes " + startedVolumes + " started successfully!";
+ String info = "Volume(s) " + startedVolumes + " started successfully!";
if (!errorMessage.equals("")) {
info += CoreConstants.NEWLINE + CoreConstants.NEWLINE + "Volumes " + failedVolumes
+ " failed to start! [" + errorMessage + "]";
}
- showInfoDialog(actionDesc, info);
+ if (selectedVolumes.size() == startedVolumes.size()) {
+ showInfoDialog(actionDesc, info);
+ } else {
+ showWarningDialog(actionDesc, info);
+ }
}
}
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 dad5d4ac..d4ab0452 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
@@ -40,15 +40,16 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
private List<Volume> selectedVolumes = new ArrayList<Volume>();
private List<String> selectedVolumeNames = new ArrayList<String>();
private List<String> onlineVolumeNames = new ArrayList<String>();
+ private List<String> stoppedVolumes = new ArrayList<String>();
+ private List<Volume> failedVolumes = new ArrayList<Volume>();
+ private String errorMessage = null;
@Override
protected void performAction(final IAction action, IProgressMonitor monitor) {
- final String actionDesc = action.getDescription();
-
collectVolumeNames();
if (onlineVolumeNames.size() == 0) {
- showWarningDialog(actionDesc, "Volumes " + selectedVolumeNames + " already stopped!");
+ showWarningDialog(action.getDescription(), "Volumes " + selectedVolumeNames + " already stopped!");
return; // Volumes already stopped, Don't do anything.
}
@@ -61,10 +62,6 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
return;
}
- VolumesClient vc = new VolumesClient();
- List<String> stoppedVolumes = new ArrayList<String>();
- List<String> failedVolumes = new ArrayList<String>();
- String errorMessage = "";
List<String> cifsVolumes = GlusterDataModelManager.getInstance().getCifsEnabledVolumeNames(selectedVolumes);
List<String> offlineServers = GlusterDataModelManager.getInstance().getOfflineServers();
// One or more servers are offline, Show warning if cifs is enabled
@@ -80,10 +77,73 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
}
}
+ stopVolumes(selectedVolumes, false, monitor);
+
+ // Check for errors, trying to force stop in case of errors
+ checkForErrors(action, monitor, true);
+ }
+
+ private void checkForErrors(final IAction action, IProgressMonitor monitor, boolean tryForceStop) {
+ String message = null;
+ if (stoppedVolumes.size() == 0) { // No volume(s) stopped successfully
+ message = "Volume(s) " + failedVolumes + " could not be stopped! " + CoreConstants.NEWLINE
+ + "Error: [" + errorMessage + "]";
+ if(tryForceStop) {
+ forceStopVolumes(action.getDescription(), message + CoreConstants.NEWLINE
+ + "Do you want to stop forcefully?", monitor);
+ // check for errors without trying to force stop in case of errors
+ checkForErrors(action, monitor, false);
+ return;
+ } else {
+ showErrorDialog(action.getDescription(), message);
+ return;
+ }
+ } else {
+ message = "Volume(s) " + stoppedVolumes + " stopped successfully!";
+ if (!errorMessage.isEmpty()) {
+ if (failedVolumes.size() > 0) {
+ message = message + CoreConstants.NEWLINE + CoreConstants.NEWLINE + "Volume(s) "
+ + failedVolumes + " could not be stopped! [" + errorMessage + "]";
+ if(tryForceStop) {
+ forceStopVolumes(action.getDescription(), message + CoreConstants.NEWLINE
+ + "Do you want to stop forcefully?", monitor);
+ // check for errors without trying to force stop in case of errors
+ checkForErrors(action, monitor, false);
+ return;
+ }
+ } else { // Stop volume success, but post stop volume fails, append the error message
+ message += CoreConstants.NEWLINE + CoreConstants.NEWLINE + errorMessage;
+ }
+ }
+
+ if (errorMessage.isEmpty()) {
+ showInfoDialog(action.getDescription(), message);
+ } else {
+ showWarningDialog(action.getDescription(), message);
+ }
+ }
+ }
+
+ private void forceStopVolumes(String actionDesc, String message, IProgressMonitor monitor) {
+ boolean forceStop = showConfirmDialog(actionDesc, message);
+ if (!forceStop) {
+ return;
+ }
+ stopVolumes(failedVolumes, true, monitor);
+ }
+
+ private void stopVolumes(List<Volume> volumes, Boolean force, IProgressMonitor monitor) {
+ VolumesClient vc = new VolumesClient();
Volume newVolume = new Volume();
+ stoppedVolumes.clear();
+ failedVolumes.clear();
+ errorMessage = "";
- monitor.beginTask("Stopping Selected Volumes...", selectedVolumes.size());
- for (Volume volume : selectedVolumes.toArray(new Volume[0])) {
+ monitor.beginTask("Stopping Selected Volumes...", volumes.size());
+ // Stopping of a volume results in changes to the model, and ultimately updates the "selectedVolumes" list,
+ // over which we are iterating, thus resulting in ConcurrentModificationException. To avoid this, we iterate
+ // over an array obtained from the list.
+ for (Volume volume : volumes.toArray(new Volume[0])) {
if(monitor.isCanceled()) {
break;
}
@@ -94,16 +154,22 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
}
try {
monitor.setTaskName("Stopping volume [" + volume.getName() + "]");
- vc.stopVolume(volume.getName(), false);
+ vc.stopVolume(volume.getName(), force);
// modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE);
stoppedVolumes.add(volume.getName());
} catch (Exception e) {
- failedVolumes.add(volume.getName());
// If any post volume stop activity failed, update the volume status
if (vc.getVolume(volume.getName()).getStatus() == VOLUME_STATUS.OFFLINE) {
+ // stop volume succeed, so add it to stoppedVolumes
+ stoppedVolumes.add(volume.getName());
modelManager.updateVolumeStatus(volume, VOLUME_STATUS.OFFLINE);
+ errorMessage += "Volume [" + volume.getName() + "] stopped, but following error occured: ["
+ + e.getMessage() + "]";
+ } else {
+ failedVolumes.add(volume);
+ errorMessage += "[" + volume.getName() + "] : " + e.getMessage() + CoreConstants.NEWLINE;
}
- errorMessage += e.getMessage() + CoreConstants.NEWLINE;
+
}
// Update the model by fetching latest volume info (NOT JUST STATUS)
@@ -116,19 +182,6 @@ public class StopVolumeAction extends AbstractMonitoredActionDelegate {
monitor.worked(1);
}
monitor.done();
-
- // Display the success or failure info
- if (stoppedVolumes.size() == 0) { // No volume(s) stopped successfully
- showErrorDialog(actionDesc, "Volumes " + failedVolumes + " could not be stopped! " + CoreConstants.NEWLINE
- + "Error: [" + errorMessage + "]");
- } else {
- String info = "Volumes " + stoppedVolumes + " stopped successfully!";
- if (!errorMessage.equals("")) {
- info += CoreConstants.NEWLINE + CoreConstants.NEWLINE + "Volumes " + failedVolumes
- + " failed to stop! [" + errorMessage + "]";
- }
- showInfoDialog(actionDesc, info);
- }
}
private void collectVolumeNames() {
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 ad2f6331..afca5ad5 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
@@ -197,7 +197,9 @@ public class GlusterServersSummaryView extends ViewPart {
List<Alert> alerts = GlusterDataModelManager.getInstance().getModel().getCluster().getAlerts();
for (Alert alert : alerts) {
- if (alert.getType() != ALERT_TYPES.OFFLINE_VOLUME_BRICKS_ALERT) {
+ if (alert.getType() == ALERT_TYPES.DISK_USAGE_ALERT || alert.getType() != ALERT_TYPES.OFFLINE_SERVERS_ALERT
+ || alert.getType() == ALERT_TYPES.MEMORY_USAGE_ALERT
+ || alert.getType() == ALERT_TYPES.CPU_USAGE_ALERT) {
addAlertLabel(alertsSection, alert);
}
}
@@ -209,9 +211,6 @@ public class GlusterServersSummaryView extends ViewPart {
CLabel lblAlert = new CLabel(section, SWT.FLAT);
Image alertImage = null;
switch (alert.getType()) {
- case OFFLINE_VOLUME_BRICKS_ALERT:
- alertImage = guiHelper.getImage(IImageKeys.BRICK_OFFLINE_22x22);
- break;
case DISK_USAGE_ALERT:
alertImage = guiHelper.getImage(IImageKeys.LOW_DISK_SPACE_22x22);
break;
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 376345e6..cd937215 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
@@ -103,7 +103,11 @@ public class VolumesSummaryView extends ViewPart {
public void volumeChanged(Volume volume, Event event) {
super.volumeChanged(volume, event);
updateSummarySection();
- updateAlertSection();
+ }
+
+ private void updateAlertSection() {
+ guiHelper.clearSection(alertsSection);
+ populateAlertSection();
}
private void updateSummarySection() {
@@ -119,6 +123,18 @@ public class VolumesSummaryView extends ViewPart {
guiHelper.clearSection(alertsSection);
populateAlertSection();
}
+
+ @Override
+ public void alertRemoved(Alert alert) {
+ super.alertRemoved(alert);
+ updateAlertSection();
+ }
+
+ @Override
+ public void alertCreated(Alert alert) {
+ super.alertCreated(alert);
+ updateAlertSection();
+ }
@Override
public void taskAdded(TaskInfo taskInfo) {
@@ -142,11 +158,6 @@ public class VolumesSummaryView extends ViewPart {
guiHelper.clearSection(tasksSection);
populateTasks();
}
-
- private void updateAlertSection() {
- guiHelper.clearSection(alertsSection);
- populateAlertSection();
- }
};
GlusterDataModelManager.getInstance().addClusterListener(clusterListener);
}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java
index bff717b7..eb8c191e 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/ClusterListener.java
@@ -50,4 +50,8 @@ public interface ClusterListener {
public void alertsGenerated();
public void aggregatedStatsChanged();
+
+ public void alertRemoved(Alert alert);
+
+ public void alertCreated(Alert alert);
}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java
index f09d78bb..eb98090f 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/DefaultClusterListener.java
@@ -105,4 +105,14 @@ public class DefaultClusterListener implements ClusterListener {
public void aggregatedStatsChanged() {
modelChanged();
}
+
+ @Override
+ public void alertRemoved(Alert alert) {
+ modelChanged();
+ }
+
+ @Override
+ public void alertCreated(Alert alert) {
+ modelChanged();
+ }
}
diff --git a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java
index 4ff52189..fe7b8495 100644
--- a/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java
+++ b/src/com.gluster.storage.management.core/src/com/gluster/storage/management/core/model/Event.java
@@ -24,6 +24,8 @@ public class Event {
BRICKS_REMOVED,
BRICKS_CHANGED,
VOLUME_STATUS_CHANGED,
+ ALERT_CREATED,
+ ALERT_REMOVED,
VOLUME_OPTIONS_RESET,
VOLUME_OPTION_SET,
VOLUME_CHANGED,