Kanagaraj M has uploaded a new change for review.

Change subject: engine: Adding gluster volume virt options to configuration
......................................................................

engine: Adding gluster volume virt options to configuration

While optimizing a gluster volume to be used a virt store,
there will be 2 options needs to be set named 'group' and 'owner'.
The values for these options will be stored in the configuration.

Default values will be 'group'='virt' and 'owner'='36.36'.

Here we are representing vdsm:kvm as 36:36, as these Ids might change
in the future, we are keeping them in the configuration.

Change-Id: I4b0bed1fd2d904c7261f547907a1b3ec34c6afcb
Signed-off-by: Kanagaraj M <kmayi...@redhat.com>
---
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/volumes/VolumeListModel.java
4 files changed, 55 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/7946/1

diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 4f4115d..dc6e04b 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -134,6 +134,8 @@
 select fn_db_add_config_value('FindFenceProxyRetries','3','general');
 select fn_db_add_config_value('FreeSpaceCriticalLowInGB','5','general');
 select fn_db_add_config_value('FreeSpaceLow','10','general');
+select 
fn_db_add_config_value('GlusterVolumeOptionGroupVirtValue','virt','general');
+select 
fn_db_add_config_value('GlusterVolumeOptionPermissionVirtValue','36:36','general');
 select 
fn_db_add_config_value('GuestToolsSetupIsoPrefix','RHEV-toolsSetup_','general');
 select 
fn_db_add_config_value('HighUtilizationForEvenlyDistribute','75','general');
 select fn_db_add_config_value('HighUtilizationForPowerSave','75','general');
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
index 71ec451..69caf6d 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java
@@ -1487,6 +1487,14 @@
     @DefaultValueAttribute("1800")
     SSHInactivityHardTimoutSeconds(383),
 
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("virt")
+    GlusterVolumeOptionGroupVirtValue(384),
+
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("36:36")
+    GlusterVolumeOptionPermissionVirtValue(385),
+
     Invalid(65535);
 
     private int intValue;
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
index 3bd142e..49b85fe 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/ConfigurationValues.java
@@ -80,7 +80,9 @@
     SupportForceCreateVG,
     NetworkConnectivityCheckTimeoutInSeconds,
     AllowClusterWithVirtGlusterEnabled,
-    MTUOverrideSupported(ConfigAuthType.User);
+    MTUOverrideSupported(ConfigAuthType.User),
+    GlusterVolumeOptionGroupVirtValue,
+    GlusterVolumeOptionPermissionVirtValue;
 
     public static enum ConfigAuthType {
         Admin,
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 c27495a..1004be0 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
@@ -20,6 +20,8 @@
 import org.ovirt.engine.core.common.businessentities.gluster.TransportType;
 import org.ovirt.engine.core.common.interfaces.SearchType;
 import org.ovirt.engine.core.common.mode.ApplicationMode;
+import org.ovirt.engine.core.common.queries.ConfigurationValues;
+import org.ovirt.engine.core.common.queries.GetConfigurationValueParameters;
 import org.ovirt.engine.core.common.queries.SearchParameters;
 import org.ovirt.engine.core.common.queries.VdcQueryType;
 import org.ovirt.engine.core.compat.Guid;
@@ -411,18 +413,47 @@
         if (getSelectedItems() == null) {
             return;
         }
+        AsyncQuery aQuery = new AsyncQuery();
+        aQuery.setModel(this);
+        aQuery.asyncCallback = new INewAsyncCallback() {
+            @Override
+            public void OnSuccess(Object model, final Object result)
+            {
+                AsyncQuery aQueryInner = new AsyncQuery();
+                aQueryInner.setModel(this);
+                aQueryInner.asyncCallback = new INewAsyncCallback() {
+                    @Override
+                    public void OnSuccess(Object modelInner, Object 
resultInner)
+                    {
+                        String optionGroupVirt = (String) result;
+                        String optionPermissionVirt = (String) resultInner;
 
-        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);
+                        ArrayList<VdcActionParametersBase> list = new 
java.util.ArrayList<VdcActionParametersBase>();
+                        for (Object item : getSelectedItems())
+                        {
+                            GlusterVolumeEntity volume = (GlusterVolumeEntity) 
item;
+
+                            GlusterVolumeOptionEntity optionGroup = new 
GlusterVolumeOptionEntity();
+                            optionGroup.setVolumeId(volume.getId());
+                            optionGroup.setKey("group"); //$NON-NLS-1$
+                            optionGroup.setValue(optionGroupVirt);
+                            list.add(new 
GlusterVolumeOptionParameters(optionGroup));
+
+                            GlusterVolumeOptionEntity optionPermission = new 
GlusterVolumeOptionEntity();
+                            optionPermission.setVolumeId(volume.getId());
+                            optionPermission.setKey("owner"); //$NON-NLS-1$
+                            optionPermission.setValue(optionPermissionVirt);
+                            list.add(new 
GlusterVolumeOptionParameters(optionPermission));
+                        }
+                        
Frontend.RunMultipleAction(VdcActionType.SetGlusterVolumeOption, list);
+                    }
+                };
+                AsyncDataProvider.GetConfigFromCache(new 
GetConfigurationValueParameters(ConfigurationValues.GlusterVolumeOptionPermissionVirtValue),
+                        aQueryInner);
+            }
+        };
+        AsyncDataProvider.GetConfigFromCache(new 
GetConfigurationValueParameters(ConfigurationValues.GlusterVolumeOptionGroupVirtValue),
+                aQuery);
     }
 
     private void stop() {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b0bed1fd2d904c7261f547907a1b3ec34c6afcb
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Kanagaraj M <kmayi...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to