Eli Mesika has uploaded a new change for review.

Change subject: core:  in PM only selecting apc or ipmilan...
......................................................................

core:  in PM only selecting apc or ipmilan...

in PM only selecting apc or ipmilan changes the options, choosing other types 
is static

The reason for that was that fence options mapping were called with
'general' version and since this key is versioned, the static value for
this key in ConfigValues.java was returned. This value misses some of
the recent agents added in 3.2 and 3.3 and cause this BZ.

This patch fix this issue by getting 6the fence options mapping from the
database for the given cluster version.

Change-Id: I2f815e90d95e8cd21aca51a803dccde8079dee5d
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1014513
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAgentFenceOptionsQuery.java
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/GetAgentFenceOptionsQueryParameters.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
6 files changed, 42 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/20090/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAgentFenceOptionsQuery.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAgentFenceOptionsQuery.java
index 040eb37..c5b0171 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAgentFenceOptionsQuery.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAgentFenceOptionsQuery.java
@@ -2,6 +2,7 @@
 
 import java.util.HashMap;
 
+import 
org.ovirt.engine.core.common.queries.GetAgentFenceOptionsQueryParameters;
 import org.ovirt.engine.core.common.queries.VdcQueryParametersBase;
 import org.ovirt.engine.core.utils.pm.VdsFenceOptions;
 
@@ -13,7 +14,8 @@
 
     @Override
     protected void executeQueryCommand() {
-        VdsFenceOptions options = new VdsFenceOptions();
+        String version = 
((GetAgentFenceOptionsQueryParameters)getParameters()).getVersion();
+        VdsFenceOptions options = new VdsFenceOptions(version);
         HashMap<String, HashMap<String, String>> map = 
options.getFencingOptionMappingMap();
         getQueryReturnValue().setReturnValue(map);
         getQueryReturnValue().setSucceeded(map.size() > 0);
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/GetAgentFenceOptionsQueryParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/GetAgentFenceOptionsQueryParameters.java
new file mode 100644
index 0000000..c26aaba
--- /dev/null
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/GetAgentFenceOptionsQueryParameters.java
@@ -0,0 +1,19 @@
+package org.ovirt.engine.core.common.queries;
+
+public class GetAgentFenceOptionsQueryParameters extends 
VdcQueryParametersBase {
+    private static final long serialVersionUID = 3645032828911858219L;
+    private String version;
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public GetAgentFenceOptionsQueryParameters(String version) {
+        super();
+        this.version = version;
+    }
+}
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
index b70f1cf..d00b988 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
@@ -37,11 +37,13 @@
     private String fencingOptions;
     private static HashMap<String, String> fencingAgentInstanceOptions;
     private static HashSet<String> fencingSpecialParams;
+    private String version;
 
     /**
      * Initializes a new instance of the <see cref="VdsFencingOptions"/> class.
      */
-    public VdsFenceOptions() {
+    public VdsFenceOptions(String version) {
+        this.version = version;
         InitCache();
         Init();
     }
@@ -54,11 +56,12 @@
      * @param fencingOptions
      *            The fencing options.
      */
-    public VdsFenceOptions(String agent, String fencingOptions) {
+    public VdsFenceOptions(String agent, String fencingOptions, String 
version) {
         if (StringUtils.isNotEmpty(agent)) {
             this.fenceAgent = agent;
             this.fencingOptions = fencingOptions;
         }
+        this.version = version;
         InitCache();
         Init();
     }
@@ -74,7 +77,7 @@
      * alom:secure=secure,port=ipport;apc:secure=secure,port=ipport,slot=port
      */
     private void CacheFencingAgentsOptionMapping() {
-        String localfencingOptionMapping = Config.<String> 
GetValue(ConfigValues.VdsFenceOptionMapping);
+        String localfencingOptionMapping = Config.<String> 
GetValue(ConfigValues.VdsFenceOptionMapping, version);
         String[] agentsOptionsStr = 
localfencingOptionMapping.split(Pattern.quote(SEMICOLON), -1);
         for (String agentOptionsStr : agentsOptionsStr) {
             String[] parts = agentOptionsStr.split(Pattern.quote(COLON), -1);
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
index 0233b0d..e2e8283 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/FenceVdsVDSCommand.java
@@ -3,6 +3,7 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.businessentities.FenceActionType;
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.vdscommands.FenceVdsVDSCommandParameters;
 import org.ovirt.engine.core.compat.Guid;
 import org.ovirt.engine.core.dal.dbbroker.DbFacade;
@@ -45,8 +46,10 @@
 
     @Override
     protected void executeVdsBrokerCommand() {
+        // We have to pass here the proxy host cluster compatibility version
+        VDS vds = getDbFacade().getVdsDao().get(getParameters().getVdsId());
         VdsFenceOptions vdsFencingOptions = new 
VdsFenceOptions(getParameters().getType(),
-                getParameters().getOptions());
+                getParameters().getOptions(), 
vds.getVdsGroupCompatibilityVersion().toString());
         String options = vdsFencingOptions.ToInternalString();
         // ignore starting already started host or stopping already stopped 
host.
         if (!isAlreadyInRequestedStatus(options)) {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
index 8f360fc..25db20c 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java
@@ -68,6 +68,7 @@
 import org.ovirt.engine.core.common.mode.ApplicationMode;
 import org.ovirt.engine.core.common.queries.CommandVersionsInfo;
 import org.ovirt.engine.core.common.queries.ConfigurationValues;
+import 
org.ovirt.engine.core.common.queries.GetAgentFenceOptionsQueryParameters;
 import org.ovirt.engine.core.common.queries.GetAllAttachableDisks;
 import 
org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters;
 import org.ovirt.engine.core.common.queries.GetAllProvidersParameters;
@@ -1692,7 +1693,7 @@
         getConfigFromCache(tempVar, aQuery);
     }
 
-    public static void getPmOptions(AsyncQuery aQuery, String pmType) {
+    public static void getPmOptions(AsyncQuery aQuery, String pmType, String 
version) {
         aQuery.converterCallback = new IAsyncConverter() {
             @Override
             public Object Convert(Object source, AsyncQuery _asyncQuery)
@@ -1716,7 +1717,7 @@
             }
         };
         aQuery.setData(new Object[] { pmType });
-        Frontend.RunQuery(VdcQueryType.GetAgentFenceOptions, new 
VdcQueryParametersBase(), aQuery);
+        Frontend.RunQuery(VdcQueryType.GetAgentFenceOptions, new 
GetAgentFenceOptionsQueryParameters(version), aQuery);
     }
 
     public static void getNetworkList(AsyncQuery aQuery, Guid dataCenterId) {
diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
index 87bc0ad..d0c0b83 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java
@@ -1334,7 +1334,11 @@
         getPmOptions().setIsChangable(isPm);
         getPmOptions().setIsValid(true);
         getPmSecure().setIsChangable(isPm);
-
+        VDSGroup cluster = (VDSGroup) getCluster().getSelectedItem();
+        String version = "general"; //$NON-NLS-1$
+        if (cluster != null) {
+            version = cluster.getcompatibility_version().toString();
+        }
         String pmType = (String) getPmType().getSelectedItem();
         if (!StringHelper.isNullOrEmpty(pmType)) {
             AsyncDataProvider.getPmOptions(new AsyncQuery(this, new 
INewAsyncCallback() {
@@ -1348,7 +1352,7 @@
                         
getPmSecure().setIsAvailable(pmOptions.contains(PmSecureKey));
                     }
                 }
-            }), pmType);
+            }), pmType, version);
         } else {
             getPmPort().setIsAvailable(false);
             getPmSlot().setIsAvailable(false);
@@ -1386,7 +1390,7 @@
                         
getPmSecondarySecure().setIsAvailable(pmOptions.contains(PmSecureKey));
                     }
                 }
-            }), pmSecondaryType);
+            }), pmSecondaryType, version);
         } else {
             getPmSecondaryPort().setIsAvailable(false);
             getPmSecondarySlot().setIsAvailable(false);


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

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

Reply via email to