Kanagaraj M has uploaded a new change for review.

Change subject: webadmin: Gluster Volume - Optimize for Virt Store action
......................................................................

webadmin: Gluster Volume - Optimize for Virt Store action

Optimize for Virt Store action is added to the Volumes Tab.
This will intern set the group option for the selected volumes.

Change-Id: I96397d30bc419ee1faa55d05451be862a766cda9
Signed-off-by: Kanagaraj M <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
M 
frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java
3 files changed, 45 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/51/7551/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
index 85c60c5..c27495a 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
@@ -8,12 +8,14 @@
 import org.ovirt.engine.core.common.action.VdcReturnValueBase;
 import 
org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters;
+import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters;
 import 
org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.storage_pool;
 import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity;
-import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
 import org.ovirt.engine.core.common.interfaces.SearchType;
@@ -78,6 +80,7 @@
     private UICommand startCommand;
     private UICommand stopCommand;
     private UICommand rebalanceCommand;
+    private UICommand optimizeForVirtStoreCommand;
 
     public UICommand getRebalanceCommand() {
         return rebalanceCommand;
@@ -103,6 +106,14 @@
         this.stopCommand = stopCommand;
     }
 
+    public UICommand getOptimizeForVirtStoreCommand() {
+        return optimizeForVirtStoreCommand;
+    }
+
+    public void setOptimizeForVirtStoreCommand(UICommand 
optimizeForVirtStoreCommand) {
+        this.optimizeForVirtStoreCommand = optimizeForVirtStoreCommand;
+    }
+
     public VolumeListModel() {
         setTitle(ConstantsManager.getInstance().getConstants().volumesTitle());
 
@@ -116,7 +127,7 @@
         setStartCommand(new UICommand("Start", this)); //$NON-NLS-1$
         setStopCommand(new UICommand("Stop", this)); //$NON-NLS-1$
         setRebalanceCommand(new UICommand("Rebalance", this)); //$NON-NLS-1$
-
+        setOptimizeForVirtStoreCommand(new UICommand("OptimizeForVirtStore", 
this)); //$NON-NLS-1$
         getRebalanceCommand().setIsAvailable(false);
 
         getRemoveVolumeCommand().setIsExecutionAllowed(false);
@@ -324,6 +335,7 @@
             getStopCommand().setIsExecutionAllowed(false);
             getStartCommand().setIsExecutionAllowed(false);
             getRebalanceCommand().setIsExecutionAllowed(false);
+            getOptimizeForVirtStoreCommand().setIsExecutionAllowed(false);
             return;
         }
 
@@ -331,6 +343,7 @@
         getStopCommand().setIsExecutionAllowed(true);
         getStartCommand().setIsExecutionAllowed(true);
         getRebalanceCommand().setIsExecutionAllowed(true);
+        getOptimizeForVirtStoreCommand().setIsExecutionAllowed(true);
 
         for (GlusterVolumeEntity volume : Linq.<GlusterVolumeEntity> 
Cast(getSelectedItems()))
         {
@@ -370,6 +383,8 @@
             stop();
         } else if (command.equals(getRebalanceCommand())) {
             rebalance();
+        } else if (command.equals(getOptimizeForVirtStoreCommand())) {
+            optimizeForVirtStore();
         } else if (command.getName().equals("onStop")) {//$NON-NLS-1$
             onStop();
         } else if (command.getName().equals("OnRemove")) { //$NON-NLS-1$
@@ -392,6 +407,24 @@
         Frontend.RunMultipleAction(VdcActionType.StartRebalanceGlusterVolume, 
list);
     }
 
+    private void optimizeForVirtStore() {
+        if (getSelectedItems() == null) {
+            return;
+        }
+
+        ArrayList<VdcActionParametersBase> list = new 
java.util.ArrayList<VdcActionParametersBase>();
+        for (Object item : getSelectedItems())
+        {
+            GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
+            GlusterVolumeOptionEntity option = new GlusterVolumeOptionEntity();
+            option.setVolumeId(volume.getId());
+            option.setKey("group"); //$NON-NLS-1$
+            option.setValue("rhev"); //$NON-NLS-1$
+            list.add(new GlusterVolumeOptionParameters(option));
+        }
+        Frontend.RunMultipleAction(VdcActionType.SetGlusterVolumeOption, list);
+    }
+
     private void stop() {
         if (getWindow() != null)
         {
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
index 5801754..5b4e43a 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/ApplicationConstants.java
@@ -2001,6 +2001,9 @@
     @DefaultStringValue("Rebalance")
     String rebalanceVolume();
 
+    @DefaultStringValue("Optimize for Virt Store")
+    String optimizeForVirtStore();
+
     // Inteface editor
     @DefaultStringValue("Address:")
     String addressInterfaceEditor();
diff --git 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java
 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java
index 00356f3..290c804 100644
--- 
a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java
+++ 
b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/MainTabVolumeView.java
@@ -2,8 +2,8 @@
 
 import java.util.Iterator;
 
-import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus;
+import 
org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity;
 import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType;
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
 import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
@@ -136,5 +136,11 @@
                 return getMainModel().getRebalanceCommand();
             }
         });
+        getTable().addActionButton(new 
WebAdminButtonDefinition<GlusterVolumeEntity>(constants.optimizeForVirtStore()) 
{
+            @Override
+            protected UICommand resolveCommand() {
+                return getMainModel().getOptimizeForVirtStoreCommand();
+            }
+        });
     }
 }


--
To view, visit http://gerrit.ovirt.org/7551
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96397d30bc419ee1faa55d05451be862a766cda9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Kanagaraj M <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to