summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDhandapani <dhandapani@gluster.com>2011-07-06 13:05:09 +0530
committerDhandapani <dhandapani@gluster.com>2011-07-06 13:05:09 +0530
commit4c3e0ccd5578d994f338f38cae204f92062c48b7 (patch)
treef6f14a6d01d630e2a52495f5ac2882453974f9a9 /src
parentd4af6dafe81c47570f1c377b4b01182ab041e9f9 (diff)
parentc29f95b551b72618f2e33b819d65777f984d2c03 (diff)
Merge branch 'master' of git@github.com:gluster/console
Diffstat (limited to 'src')
-rw-r--r--src/com.gluster.storage.management.gui/plugin.xml322
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java12
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/IActionConstants.java2
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/toolbar/GlusterToolbarManager.java5
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/GlusterViewsManager.java1
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/AbstractTableViewerPage.java24
-rw-r--r--src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java24
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/TasksResource.java13
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/DiskMigrationStatusTask.java43
-rw-r--r--src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/MigrateBrickTask.java10
-rw-r--r--src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml6
11 files changed, 331 insertions, 131 deletions
diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml
index b0dfa9a9..0a4c068d 100644
--- a/src/com.gluster.storage.management.gui/plugin.xml
+++ b/src/com.gluster.storage.management.gui/plugin.xml
@@ -403,7 +403,7 @@
icon="icons/volume-delete.png"
id="com.gluster.storage.management.gui.actions.DeleteVolumeAction"
label="&amp;Delete Volume(s)"
- menubarPath="com.gluster.storage.management.gui.menu.volumes/volumes"
+ menubarPath="com.gluster.storage.management.gui.actionsets.volumes/volumes"
mode="FORCE_TEXT"
pulldown="false"
retarget="false"
@@ -419,7 +419,7 @@
icon="icons/volume-stop.png"
id="com.gluster.storage.management.gui.actions.StopVolumeAction"
label="S&amp;top Volume(s)"
- menubarPath="com.gluster.storage.management.gui.menu.volumes/volumes"
+ menubarPath="com.gluster.storage.management.gui.actionsets.volumes/volumes"
mode="FORCE_TEXT"
pulldown="false"
retarget="false"
@@ -435,7 +435,7 @@
icon="icons/volume-start.png"
id="com.gluster.storage.management.gui.actions.StartVolumeAction"
label="&amp;Start Volume(s)"
- menubarPath="com.gluster.storage.management.gui.menu.volumes/volumes"
+ menubarPath="com.gluster.storage.management.gui.actionsets.volumes/volumes"
mode="FORCE_TEXT"
pulldown="false"
retarget="false"
@@ -448,10 +448,10 @@
allowLabelUpdate="false"
class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
- icon="icons/volume-create.png"
+ icon="icons/tango/32x32/volume-create.png"
id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
- label="&amp;Create Volume"
- menubarPath="com.gluster.storage.management.gui.menu.volumes/volumes"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.actionsets.volumes/volumes"
mode="FORCE_TEXT"
pulldown="false"
retarget="false"
@@ -461,7 +461,7 @@
tooltip="Create a new Volume">
</action>
<menu
- id="com.gluster.storage.management.gui.menu.volumes"
+ id="com.gluster.storage.management.gui.actionsets.volumes"
label="&amp;Gluster"
path="additions">
<groupMarker
@@ -623,100 +623,6 @@
toolbarPath="Normal"
tooltip="Add Brick to Volume">
</action>
- <menu
- id="com.gluster.storage.management.gui.menu.volume"
- label="&amp;Gluster"
- path="additions">
- <groupMarker
- name="volume">
- </groupMarker>
- </menu>
- </actionSet>
- <actionSet
- description="Set of actions that can be performed from &quot;Cluster&quot; context"
- id="com.gluster.storage.management.gui.actionsets.gluster"
- label="Cluster Action Set"
- visible="false">
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.ClearTaskAction"
- definitionId="com.gluster.storage.management.gui.commands.Clear"
- icon="icons/close_task.png"
- id="com.gluster.storage.management.gui.actions.Clear"
- label="&amp;Clear Task"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="To clear selected task from task list">
- </action>
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.CommitTaskAction"
- definitionId="com.gluster.storage.management.gui.commands.Commit"
- icon="icons/stop.png"
- id="com.gluster.storage.management.gui.actions.Commit"
- label="&amp;Commit Task"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="To Commit the selected task">
- </action>
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.StopTaskAction"
- definitionId="com.gluster.storage.management.gui.commands.Stop"
- icon="icons/stop_task.png"
- id="com.gluster.storage.management.gui.actions.Stop"
- label="&amp;Stop Task"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="To Stop the selected task">
- </action>
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.ResumeTaskAction"
- definitionId="com.gluster.storage.management.gui.commands.Pause"
- icon="icons/start_task.gif"
- id="com.gluster.storage.management.gui.actions.Resume"
- label="&amp;Resume Task"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="To Resume the selected task">
- </action>
- <action
- allowLabelUpdate="false"
- class="com.gluster.storage.management.gui.actions.PauseTaskAction"
- definitionId="com.gluster.storage.management.gui.commands.Pause"
- icon="icons/pause_task.png"
- id="com.gluster.storage.management.gui.actions.Pause"
- label="&amp;Pause Task"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
- mode="FORCE_TEXT"
- pulldown="false"
- retarget="false"
- state="false"
- style="push"
- toolbarPath="Normal"
- tooltip="To Pause the selected task">
- </action>
<action
allowLabelUpdate="false"
class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
@@ -724,7 +630,7 @@
icon="icons/tango/32x32/volume-create.png"
id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
label="Create &amp;Volume"
- menubarPath="com.gluster.storage.management.gui.menu.cluster/cluster"
+ menubarPath="com.gluster.storage.management.gui.menu.volume/volume"
mode="FORCE_TEXT"
pulldown="false"
retarget="false"
@@ -734,10 +640,11 @@
tooltip="Create a new Volume">
</action>
<menu
- id="com.gluster.storage.management.gui.menu.cluster"
- label="&amp;Gluster">
+ id="com.gluster.storage.management.gui.menu.volume"
+ label="&amp;Gluster"
+ path="additions">
<groupMarker
- name="cluster">
+ name="volume">
</groupMarker>
</menu>
</actionSet>
@@ -762,6 +669,22 @@
toolbarPath="Normal"
tooltip="Remove Server(s)">
</action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.servers/servers"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
<menu
id="com.gluster.storage.management.gui.menu.servers"
label="&amp;Gluster"
@@ -792,6 +715,22 @@
toolbarPath="Normal"
tooltip="Remove Server">
</action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.glusterserver/glusterserver"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
<menu
id="com.gluster.storage.management.gui.menu.glusterserver"
label="&amp;Gluster"
@@ -822,6 +761,22 @@
toolbarPath="Normal"
tooltip="Add Server(s) to Cluster">
</action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.discoveredservers/discoveredservers"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
<menu
id="com.gluster.storage.management.gui.menu.discoveredservers"
label="&amp;Gluster"
@@ -852,6 +807,22 @@
toolbarPath="Normal"
tooltip="Add Server(s) to Cluster">
</action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.discoveredserver/discoveredserver"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
<menu
id="com.gluster.storage.management.gui.menu.discoveredserver"
label="&amp;Gluster"
@@ -862,6 +833,145 @@
</menu>
</actionSet>
<actionSet
+ description="Set of actions that can be performed from &quot;Cluster&quot; context"
+ id="com.gluster.storage.management.gui.actionsets.task"
+ label="Task Action Set"
+ visible="false">
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.ClearTaskAction"
+ definitionId="com.gluster.storage.management.gui.commands.Clear"
+ icon="icons/close_task.png"
+ id="com.gluster.storage.management.gui.actions.Clear"
+ label="&amp;Clear Task"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="To clear selected task from task list">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CommitTaskAction"
+ definitionId="com.gluster.storage.management.gui.commands.Commit"
+ icon="icons/stop.png"
+ id="com.gluster.storage.management.gui.actions.Commit"
+ label="&amp;Commit Task"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="To Commit the selected task">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.StopTaskAction"
+ definitionId="com.gluster.storage.management.gui.commands.Stop"
+ icon="icons/stop_task.png"
+ id="com.gluster.storage.management.gui.actions.Stop"
+ label="&amp;Stop Task"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="To Stop the selected task">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.ResumeTaskAction"
+ definitionId="com.gluster.storage.management.gui.commands.Pause"
+ icon="icons/start_task.gif"
+ id="com.gluster.storage.management.gui.actions.Resume"
+ label="&amp;Resume Task"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="To Resume the selected task">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.PauseTaskAction"
+ definitionId="com.gluster.storage.management.gui.commands.Pause"
+ icon="icons/pause_task.png"
+ id="com.gluster.storage.management.gui.actions.Pause"
+ label="&amp;Pause Task"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="To Pause the selected task">
+ </action>
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.task/task"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
+ <menu
+ id="com.gluster.storage.management.gui.menu.task"
+ label="&amp;Gluster">
+ <groupMarker
+ name="task">
+ </groupMarker>
+ </menu>
+ </actionSet>
+ <actionSet
+ description="Set of actions that can be performed at Cluster context"
+ id="com.gluster.storage.management.gui.actionsets.gluster"
+ label="Gluster Actions"
+ visible="false">
+ <action
+ allowLabelUpdate="false"
+ class="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ definitionId="com.gluster.storage.management.gui.commands.CreateVolume"
+ icon="icons/tango/32x32/volume-create.png"
+ id="com.gluster.storage.management.gui.actions.CreateVolumeAction"
+ label="Create &amp;Volume"
+ menubarPath="com.gluster.storage.management.gui.menu.gluster/gluster"
+ mode="FORCE_TEXT"
+ pulldown="false"
+ retarget="false"
+ state="false"
+ style="push"
+ toolbarPath="Normal"
+ tooltip="Create a new Volume">
+ </action>
+ <menu
+ id="com.gluster.storage.management.gui.menu.gluster"
+ label="&amp;Gluster"
+ path="additions">
+ <groupMarker
+ name="gluster">
+ </groupMarker>
+ </menu>
+ </actionSet>
+ <actionSet
description="Set of Actions in &quot;Edit&quot; menu"
id="com.gluster.storage.management.gui.actionsets.edit"
label="Edit Action Set"
@@ -896,7 +1006,7 @@
state="false"
style="push"
toolbarPath="Normal"
- tooltip="Preferences">
+ tooltip="Settings">
</action>
<menu
id="com.gluster.storage.management.gui.menu.edit"
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java
index 2cfa0916..9bafd2b0 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/CreateVolumeAction.java
@@ -54,16 +54,4 @@ public class CreateVolumeAction extends AbstractActionDelegate {
public void dispose() {
window = null;
}
-
- @SuppressWarnings("rawtypes")
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- super.selectionChanged(action, selection);
-
- action.setEnabled(true);
- if(selectedEntity instanceof EntityGroup && ((EntityGroup)selectedEntity).getEntityType() != Volume.class) {
- // selected entity is either "servers" or "discovered servers".
- action.setEnabled(false);
- }
- }
}
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/IActionConstants.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/IActionConstants.java
index 2f696709..c5e8958f 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/IActionConstants.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/IActionConstants.java
@@ -28,7 +28,7 @@ public interface IActionConstants {
public static final String ACTION_SET_GLUSTER_SERVER = "com.gluster.storage.management.gui.actionsets.glusterserver";
public static final String ACTION_SET_DISCOVERED_SERVERS = "com.gluster.storage.management.gui.actionsets.serversdiscovered";
public static final String ACTION_SET_DISCOVERED_SERVER = "com.gluster.storage.management.gui.actionsets.serverdiscovered";
-
+ public static final String ACTION_SET_TASK = "com.gluster.storage.management.gui.actionsets.task";
public static final String ACTION_SET_EDIT = "com.gluster.storage.management.gui.actionsets.edit";
public static final String COMMAND_CREATE_VOLUME = "com.gluster.storage.management.gui.commands.CreateVolume";
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/toolbar/GlusterToolbarManager.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/toolbar/GlusterToolbarManager.java
index cef0bf5d..88c18a7f 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/toolbar/GlusterToolbarManager.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/toolbar/GlusterToolbarManager.java
@@ -29,12 +29,13 @@ import com.gluster.storage.management.core.model.Entity;
import com.gluster.storage.management.core.model.EntityGroup;
import com.gluster.storage.management.core.model.GlusterServer;
import com.gluster.storage.management.core.model.Server;
+import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.core.model.Volume;
import com.gluster.storage.management.gui.actions.IActionConstants;
public class GlusterToolbarManager implements ToolbarManager {
private enum ENTITY_TYPE {
- CLUSTER, VOLUMES, VOLUME, GLUSTER_SERVERS, GLUSTER_SERVER, DISCOVERED_SERVERS, DISCOVERED_SERVER
+ CLUSTER, VOLUMES, VOLUME, GLUSTER_SERVERS, GLUSTER_SERVER, DISCOVERED_SERVERS, DISCOVERED_SERVER, TASK
};
private IWorkbenchWindow window;
@@ -47,6 +48,7 @@ public class GlusterToolbarManager implements ToolbarManager {
entityTypeMap.put(Volume.class, ENTITY_TYPE.VOLUME);
entityTypeMap.put(Server.class, ENTITY_TYPE.DISCOVERED_SERVER);
entityTypeMap.put(GlusterServer.class, ENTITY_TYPE.GLUSTER_SERVER);
+ entityTypeMap.put(TaskInfo.class, ENTITY_TYPE.TASK);
return entityTypeMap;
}
@@ -60,6 +62,7 @@ public class GlusterToolbarManager implements ToolbarManager {
actionSetMap.put(ENTITY_TYPE.GLUSTER_SERVER, IActionConstants.ACTION_SET_GLUSTER_SERVER);
actionSetMap.put(ENTITY_TYPE.DISCOVERED_SERVERS, IActionConstants.ACTION_SET_DISCOVERED_SERVERS);
actionSetMap.put(ENTITY_TYPE.DISCOVERED_SERVER, IActionConstants.ACTION_SET_DISCOVERED_SERVER);
+ actionSetMap.put(ENTITY_TYPE.TASK, IActionConstants.ACTION_SET_TASK);
return actionSetMap;
}
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/GlusterViewsManager.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/GlusterViewsManager.java
index ab1e55ab..a13d41d7 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/GlusterViewsManager.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/GlusterViewsManager.java
@@ -49,7 +49,6 @@ public class GlusterViewsManager implements ViewsManager {
public void updateViews(Entity entity) {
closeAllViews();
-
try {
if (entity instanceof EntityGroup) {
showViewsForEntityGroup((EntityGroup)entity);
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/AbstractTableViewerPage.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/AbstractTableViewerPage.java
index a37773e1..80aceb8b 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/AbstractTableViewerPage.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/AbstractTableViewerPage.java
@@ -25,6 +25,7 @@ import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -39,6 +40,8 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -46,14 +49,16 @@ import org.eclipse.ui.forms.widgets.Hyperlink;
import com.gluster.storage.management.client.GlusterDataModelManager;
import com.gluster.storage.management.core.model.ClusterListener;
+import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.gui.utils.GUIHelper;
-public abstract class AbstractTableViewerPage<T> extends Composite {
+public abstract class AbstractTableViewerPage<T> extends Composite implements ISelectionListener {
- protected final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
- protected TableViewer tableViewer;
private boolean useCheckboxes;
private boolean multiSelection;
+
+ protected final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+ protected TableViewer tableViewer;
protected GUIHelper guiHelper = GUIHelper.getInstance();
protected Composite parent;
@@ -76,8 +81,12 @@ public abstract class AbstractTableViewerPage<T> extends Composite {
Text filterText = guiHelper.createFilterText(toolkit, this);
setupTableViewer(site, filterText);
-
tableViewer.setInput(model);
+ // register as selection provider so that other views can listen to any selection events on the tree
+ site.setSelectionProvider(tableViewer);
+ site.getPage().addSelectionListener(this);
+
+
parent.layout(); // Important - this actually paints the table
createListeners(parent);
@@ -213,4 +222,11 @@ public abstract class AbstractTableViewerPage<T> extends Composite {
// Create a case insensitive filter for the table viewer using the filter text field
guiHelper.createFilter(tableViewer, filterText, false);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ }
}
diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java
index 8d48af76..b3821c6b 100644
--- a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java
+++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/views/pages/TasksPage.java
@@ -25,21 +25,31 @@ import java.util.List;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import com.gluster.storage.management.core.model.ClusterListener;
import com.gluster.storage.management.core.model.DefaultClusterListener;
+import com.gluster.storage.management.core.model.Entity;
import com.gluster.storage.management.core.model.Event;
import com.gluster.storage.management.core.model.TaskInfo;
import com.gluster.storage.management.core.model.Volume;
import com.gluster.storage.management.core.model.Event.EVENT_TYPE;
import com.gluster.storage.management.gui.TasksTableLabelProvider;
+import com.gluster.storage.management.gui.actions.IActionConstants;
+import com.gluster.storage.management.gui.toolbar.GlusterToolbarManager;
+import com.gluster.storage.management.gui.utils.GUIHelper;
public class TasksPage extends AbstractTableViewerPage<TaskInfo> {
private List<TaskInfo> taskInfoList;
+ private TaskInfo selectedTask;
public enum TASK_TABLE_COLUMN_INDICES {
TASK, STATUS
@@ -132,4 +142,18 @@ public class TasksPage extends AbstractTableViewerPage<TaskInfo> {
protected List<TaskInfo> getAllEntities() {
return taskInfoList;
}
+
+ /* (non-Javadoc)
+ * @see com.gluster.storage.management.gui.views.pages.AbstractTableViewerPage#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ */
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (selection instanceof StructuredSelection) {
+ Entity selectedEntity = (Entity) ((StructuredSelection) selection).getFirstElement();
+ if (selectedEntity != null && selectedEntity instanceof TaskInfo && selectedEntity != selectedTask) {
+ selectedTask = (TaskInfo)selectedEntity;
+ new GlusterToolbarManager(part.getSite().getWorkbenchWindow()).updateToolbar(selectedTask);
+ }
+ }
+ }
}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/TasksResource.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/TasksResource.java
index 777565eb..1acba6b7 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/TasksResource.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/resources/v1_0/TasksResource.java
@@ -42,6 +42,8 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.springframework.stereotype.Component;
+
import com.gluster.storage.management.core.constants.RESTConstants;
import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
import com.gluster.storage.management.core.exceptions.GlusterValidationException;
@@ -52,6 +54,7 @@ import com.sun.jersey.spi.resource.Singleton;
@Path(RESOURCE_PATH_CLUSTERS + "/{" + PATH_PARAM_CLUSTER_NAME + "}/" + RESOURCE_TASKS)
@Singleton
+@Component
public class TasksResource extends AbstractResource {
private Map<String, Task> tasksMap = new HashMap<String, Task>();
@@ -84,6 +87,16 @@ public class TasksResource extends AbstractResource {
return null;
}
+ public List<Task> getAllTasks() {
+ List<Task> tasks = new ArrayList<Task>();
+ for (Map.Entry<String, Task> entry : tasksMap.entrySet()) {
+ checkTaskStatus(entry.getKey());
+ tasks.add( (Task) entry.getValue());
+ }
+ return tasks;
+ }
+
+
@GET
@Produces(MediaType.APPLICATION_XML)
public Response getTasks() {
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/DiskMigrationStatusTask.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/DiskMigrationStatusTask.java
new file mode 100644
index 00000000..ccfd58be
--- /dev/null
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/DiskMigrationStatusTask.java
@@ -0,0 +1,43 @@
+/**
+ * DiskMigrationStatusTask.java
+ *
+ * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com>
+ * This file is part of Gluster Management Console.
+ *
+ * Gluster Management Console is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Gluster Management Console is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+package com.gluster.storage.management.server.tasks;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.gluster.storage.management.core.model.TaskInfo.TASK_TYPE;
+import com.gluster.storage.management.server.resources.v1_0.TasksResource;
+
+@Component
+public class DiskMigrationStatusTask {
+
+ @Autowired
+ private TasksResource tasksResource;
+
+ public void checkMigrationStatus() {
+ for (Task task : tasksResource.getAllTasks() ) {
+ if (task.getType() == TASK_TYPE.BRICK_MIGRATE && ((MigrateBrickTask) task).getAutoCommit()) {
+ tasksResource.getTaskStatus( task.getId());
+ }
+ }
+ }
+
+}
diff --git a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/MigrateBrickTask.java b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/MigrateBrickTask.java
index 3961c427..af5e657a 100644
--- a/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/MigrateBrickTask.java
+++ b/src/com.gluster.storage.management.server/src/com/gluster/storage/management/server/tasks/MigrateBrickTask.java
@@ -23,6 +23,8 @@ package com.gluster.storage.management.server.tasks;
import java.util.concurrent.ExecutionException;
import org.apache.derby.iapi.sql.execute.ExecPreparedStatement;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.ContextLoader;
import com.gluster.storage.management.core.exceptions.ConnectionException;
import com.gluster.storage.management.core.exceptions.GlusterRuntimeException;
@@ -43,8 +45,6 @@ public class MigrateBrickTask extends Task {
private Boolean autoCommit;
private GlusterUtil glusterUtil = new GlusterUtil();
- private SshUtil sshUtil = new SshUtil();
-
public String getFromBrick() {
return fromBrick;
}
@@ -78,10 +78,6 @@ public class MigrateBrickTask extends Task {
taskInfo.setName(getId());
}
- public MigrateBrickTask(ClusterService clusterService, String clusterName, TaskInfo info) {
- super(clusterService, clusterName, info);
- }
-
@Override
public String getId() {
return new String(Base64.encode(clusterName + "-" + taskInfo.getType() + "-" + taskInfo.getReference() + "-" + fromBrick + "-"
@@ -99,6 +95,8 @@ public class MigrateBrickTask extends Task {
}
private void startMigration(String onlineServerName) {
+ ApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();
+ glusterUtil = ctx.getBean(GlusterUtil.class);
ProcessResult processResult = glusterUtil.executeBrickMigration(onlineServerName, getTaskInfo().getReference(),
getFromBrick(), getToBrick(), "start");
if (processResult.getOutput().trim().matches(".*started successfully$")) {
diff --git a/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml b/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml
index 700d996f..0a000732 100644
--- a/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml
+++ b/src/com.gluster.storage.management.server/src/spring/gluster-server-base.xml
@@ -16,6 +16,12 @@
<task:scheduled ref="serverDiscoveryTask" method="discoverServers" fixed-delay="60000" />
</task:scheduled-tasks>
+ <!-- This task keeps checking status of disk migration tasks (wherever auto-commit is set to true)
+ so that auto-commit can be performed as soon as the migration is complete -->
+ <task:scheduled-tasks>
+ <task:scheduled ref="diskMigrationStatusTask" method="checkMigrationStatus" fixed-delay="60000" />
+ </task:scheduled-tasks>
+
<!-- Cluster environment. Valid values: vmware, aws, baremetal -->
<bean id="environment" class="java.lang.String">
<constructor-arg value="vmware" />