Eli Mesika has uploaded a new change for review.

Change subject: core: support custom fencing params for PPC
......................................................................

core: support custom fencing params for PPC

Adding support for PPC hosts in 3.5 raised the need of having separate
default fencing parameters for PPC.

Default parameters are actually parameters with certain values per agent
that are sent implicitly to VDSM when the agent is used.

The problem is that those parameters that insures the correctness of the
call to the agent script may vary between X86 and PPC

This patch introduces a separate fencing default parameters for PPC and
an option to customize it for a custom agent as well.

Please note that the architecture checked is of the target fenced host for the
operation.

Change-Id: I89717ac346e2ca1b44021b18dbe989ca5399f3f5
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1149235
Signed-off-by: Eli Mesika <emes...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
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 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/FenceConfigHelper.java
M 
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/VdsFenceOptions.java
M packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
M packaging/etc/engine-config/engine-config.properties
8 files changed, 37 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/34536/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
index a0c9da7..b08a170 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceExecutor.java
@@ -5,6 +5,7 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.businessentities.ArchitectureType;
 import org.ovirt.engine.core.common.businessentities.FenceActionType;
 import org.ovirt.engine.core.common.businessentities.FenceAgentOrder;
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
@@ -240,12 +241,16 @@
 
     private String getManagementOptions(FenceAgentOrder order) {
         String managementOptions = "";
+        ArchitectureType architectureType = null;
+        if (_vds.getCpuName() != null) {
+            architectureType =  _vds.getCpuName().getArchitecture();
+        }
         if (order == FenceAgentOrder.Primary) {
-            managementOptions = 
VdsFenceOptions.getDefaultAgentOptions(_vds.getPmType(), _vds.getPmOptions());
+            managementOptions = 
VdsFenceOptions.getDefaultAgentOptions(_vds.getPmType(), _vds.getPmOptions(), 
architectureType);
         }
         else if (order == FenceAgentOrder.Secondary) {
             managementOptions =
-                    
VdsFenceOptions.getDefaultAgentOptions(_vds.getPmSecondaryType(), 
_vds.getPmSecondaryOptions());
+                    
VdsFenceOptions.getDefaultAgentOptions(_vds.getPmSecondaryType(), 
_vds.getPmSecondaryOptions(), architectureType);
         }
         return managementOptions;
     }
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
index 6f1d06a..fca6be2 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/FenceVdsBaseCommand.java
@@ -17,6 +17,7 @@
 import org.ovirt.engine.core.common.AuditLogType;
 import org.ovirt.engine.core.common.action.FenceVdsActionParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
+import org.ovirt.engine.core.common.businessentities.ArchitectureType;
 import org.ovirt.engine.core.common.businessentities.FenceActionType;
 import org.ovirt.engine.core.common.businessentities.FenceAgentOrder;
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
@@ -589,7 +590,8 @@
         // subsequent 'on' command issued during this delay will be overridden 
by the actual shutdown
         String agent = (order == FenceAgentOrder.Primary) ? 
getVds().getPmType() : getVds().getPmSecondaryType();
         String options =  (order == FenceAgentOrder.Primary) ? 
getVds().getPmOptions() : getVds().getPmSecondaryOptions();
-        options = VdsFenceOptions.getDefaultAgentOptions(agent, options);
+        ArchitectureType architectureType = (getVds().getCpuName() != null) ? 
getVds().getCpuName().getArchitecture() : null;
+        options = VdsFenceOptions.getDefaultAgentOptions(agent, options, 
architectureType);
         HashMap<String, String> optionsMap = 
VdsStatic.pmOptionsStringToMap(options);
         String powerWaitParamSettings = 
FenceConfigHelper.getFenceConfigurationValue(ConfigValues.FencePowerWaitParam.name(),
 ConfigCommon.defaultConfigurationVersion);
         String powerWaitParam = VdsFenceOptions.getAgentPowerWaitParam(agent, 
powerWaitParamSettings);
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 9610d02..c26c97d 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
@@ -865,6 +865,16 @@
     @DefaultValueAttribute("")
     CustomFenceAgentDefaultParams,
 
+    @Reloadable
+    @TypeConverterAttribute(String.class)
+    
@DefaultValueAttribute("ilo3:lanplus=1,cipher=1,privlvl=administrator,power_wait=4;ilo4:lanplus=1,cipher=1,privlvl=administrator,power_wait=4;ipmilan:lanplus=1,cipher=1,privlvl=administrator,power_wait=4")
+    FenceAgentDefaultParamsForPPC,
+
+    @Reloadable
+    @TypeConverterAttribute(String.class)
+    @DefaultValueAttribute("")
+    CustomFenceAgentDefaultParamsForPPC,
+
     @TypeConverterAttribute(String.class)
     @DefaultValueAttribute("admin")
     AdminUser,
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 abccfae..eb4b98e 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
@@ -61,6 +61,7 @@
     VdsFenceOptionTypes,
     FenceAgentMapping,
     FenceAgentDefaultParams,
+    FenceAgentDefaultParamsForPPC,
     VdsFenceOptionMapping,
     VdsFenceType,
     SupportedClusterLevels(ConfigAuthType.User),
diff --git 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/FenceConfigHelper.java
 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/FenceConfigHelper.java
index 1b81d3c..41bfa41 100644
--- 
a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/FenceConfigHelper.java
+++ 
b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/pm/FenceConfigHelper.java
@@ -29,17 +29,20 @@
            keyValidatorMap = new HashMap<String, String>();
            keyValidatorMap.put("FenceAgentMapping", FenceAgentMappingExpr);
            keyValidatorMap.put("FenceAgentDefaultParams", 
FenceAgentDefaultParamsExpr);
+           keyValidatorMap.put("FenceAgentDefaultParamsForPPC", 
FenceAgentDefaultParamsExpr);
            keyValidatorMap.put("VdsFenceOptionMapping", 
VdsFenceOptionMappingExpr);
            keyValidatorMap.put("VdsFenceType", CustomVdsFenceTypeExpr);
            keyValidatorMap.put("FencePowerWaitParam", FencePowerWaitParamExpr);
            keyValidatorMap.put("CustomFenceAgentMapping", 
FenceAgentMappingExpr);
            keyValidatorMap.put("CustomFenceAgentDefaultParams", 
FenceAgentDefaultParamsExpr);
+           keyValidatorMap.put("CustomFenceAgentDefaultParamsForPPC", 
FenceAgentDefaultParamsExpr);
            keyValidatorMap.put("CustomVdsFenceOptionMapping", 
VdsFenceOptionMappingExpr);
            keyValidatorMap.put("CustomVdsFenceType", CustomVdsFenceTypeExpr);
            keyValidatorMap.put("CustomFencePowerWaitParam", 
FencePowerWaitParamExpr);
            keyValidatorExampleMap = new HashMap<String, String>();
            keyValidatorExampleMap.put("CustomFenceAgentMapping", 
"agent1=agent2,agent3=agent4");
            keyValidatorExampleMap.put("CustomFenceAgentDefaultParams", 
"agent1=key1=val1,flag;key2=val2");
+           keyValidatorExampleMap.put("CustomFenceAgentDefaultParamsForPPC", 
"agent1=key1=val1,flag;key2=val2");
            keyValidatorExampleMap.put("CustomVdsFenceOptionMapping", 
"agent1:secure=secure;agent2:port=ipport,slot=slot");
            keyValidatorExampleMap.put("CustomVdsFenceType", "agent1,agent2");
            keyValidatorExampleMap.put("CustomFencePowerWaitParam", 
"agent1=power_wait,agent2=delay");
@@ -47,6 +50,7 @@
            keySeparatorMap = new HashMap<String, String>();
            keySeparatorMap.put("FenceAgentMapping", COMMA);
            keySeparatorMap.put("FenceAgentDefaultParams", SEMICOLON);
+           keySeparatorMap.put("FenceAgentDefaultParamsForPPC", SEMICOLON);
            keySeparatorMap.put("VdsFenceOptionMapping", SEMICOLON);
            keySeparatorMap.put("VdsFenceType", COMMA);
            keySeparatorMap.put("FencePowerWaitParam", COMMA);
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 7975b79..56bebf2 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
@@ -8,6 +8,7 @@
 import java.util.regex.Pattern;
 
 import org.apache.commons.lang.StringUtils;
+import org.ovirt.engine.core.common.businessentities.ArchitectureType;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigCommon;
 import org.ovirt.engine.core.common.config.ConfigValues;
@@ -321,8 +322,12 @@
      * @param fenceOptions
      * @return String the options after adding default agent parameters
      */
-    public static String getDefaultAgentOptions(String agent, String 
fenceOptions) {
-        String agentDefaultParams = 
FenceConfigHelper.getFenceConfigurationValue(ConfigValues.FenceAgentDefaultParams.name(),
 ConfigCommon.defaultConfigurationVersion);
+    public static String getDefaultAgentOptions(String agent, String 
fenceOptions, ArchitectureType architectureType) {
+        String agentDefaultParams =  (architectureType != null && 
architectureType == ArchitectureType.ppc64)
+                ?
+                
FenceConfigHelper.getFenceConfigurationValue(ConfigValues.FenceAgentDefaultParamsForPPC.name(),
 ConfigCommon.defaultConfigurationVersion)
+                :
+                
FenceConfigHelper.getFenceConfigurationValue(ConfigValues.FenceAgentDefaultParams.name(),
 ConfigCommon.defaultConfigurationVersion);
         StringBuilder realOptions = new StringBuilder(fenceOptions);
         // result has the format [<agent>:param=value[,]...;]*
         String[] params = agentDefaultParams.split(Pattern.quote(SEMICOLON), 
-1);
diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 6cdb521..7e3ed75 100644
--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -126,6 +126,8 @@
 select fn_db_add_config_value('FailedJobCleanupTimeInMinutes','60','general');
 select 
fn_db_add_config_value('FenceAgentDefaultParams','ilo3:lanplus,power_wait=4;ilo4:lanplus,power_wait=4','general');
 select fn_db_add_config_value('CustomFenceAgentDefaultParams','','general');
+select 
fn_db_add_config_value('FenceAgentDefaultParamsForPPC','ilo3:lanplus=1,cipher=1,privlvl=administrator,power_wait=4;ilo4:ilanplus=1,cipher=1,privlvl=administrator,power_wait=4;ipmilan:lanplus=1,cipher=1,privlvl=administrator,power_wait=4','general');
+select 
fn_db_add_config_value('CustomFenceAgentDefaultParamsForPPC','','general');
 select 
fn_db_add_config_value('FenceAgentMapping','drac7=ipmilan,ilo2=ilo,ilo3=ipmilan,ilo4=ipmilan','general');
 select fn_db_add_config_value('CustomFenceAgentMapping','','general');
 select fn_db_add_config_value('CustomFencePowerWaitParam','','general');
diff --git a/packaging/etc/engine-config/engine-config.properties 
b/packaging/etc/engine-config/engine-config.properties
index 783b620..07407c7 100644
--- a/packaging/etc/engine-config/engine-config.properties
+++ b/packaging/etc/engine-config/engine-config.properties
@@ -426,7 +426,9 @@
 CustomFenceAgentMapping.type=FenceConfig
 CustomFenceAgentDefaultParams.description="Default parameters per agent. 
Format ([\\w]+([=][\\w]+){0,1}[,]{0,1})+. Example: 
agent1=key1=val1,flag;key2=val2"
 CustomFenceAgentDefaultParams.type=FenceConfig
-CustomVdsFenceOptionMapping.description="secure/port/slot mapping support per 
agent. Format ([\\w]+[:]([\\w]*[=][\\w]*[,]{0,1}[;]{0,1}){0,3}[;]{0,1})+. 
Example: agent1:secure=secure;agent2:port=ipport,slot=slot"
+CustomFenceAgentDefaultParamsForPPC.description="Default parameters per agent 
for PPC. Format ([\\w]+([=][\\w]+){0,1}[,]{0,1})+. Example: 
agent1=key1=val1,flag;key2=val2"
+CustomFenceAgentDefaultParamsForPPC.type=FenceConfig
+CustomVdsFenceOptionMapping.description="secure/port/slot mapping support per 
agent for PPC. Format 
([\\w]+[:]([\\w]*[=][\\w]*[,]{0,1}[;]{0,1}){0,3}[;]{0,1})+. Example: 
agent1:secure=secure;agent2:port=ipport,slot=slot"
 CustomVdsFenceOptionMapping.type=FenceConfig
 CustomVdsFenceType.description="Fence agents types. Format ((\\w)+[,]{0,1})+. 
Example: agent1,agent2"
 CustomVdsFenceType.type=FenceConfig


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89717ac346e2ca1b44021b18dbe989ca5399f3f5
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
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