Eli Mesika has uploaded a new change for review.

Change subject: core: handle host architecture in fence flow
......................................................................

core: handle host architecture in fence flow

This patch adds a getArchitecture method to VDS.
It is used in order to get the host architecture using its cpu flags, in
case that this is null, the architecture of the containing cluster is
used.

Please note that a separate call to get VdsDynamic information for the
host since the VDS object passed to the fencing code is slim and does
not contain any dymanic information.

Change-Id: I081361c9f956ea71a715acf0368c79c7130674c7
Bug-Url: core: support default fencing params for PPC
Signed-off-by: Eli Mesika <[email protected]>
---
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/businessentities/VDS.java
3 files changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/46/34646/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 51ade4a..8ccc255 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
@@ -12,6 +12,7 @@
 import org.ovirt.engine.core.common.businessentities.FencingPolicy;
 import org.ovirt.engine.core.common.businessentities.NonOperationalReason;
 import org.ovirt.engine.core.common.businessentities.VDS;
+import org.ovirt.engine.core.common.businessentities.VDSGroup;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VdsDynamic;
 import org.ovirt.engine.core.common.businessentities.VdsSpmStatus;
@@ -243,9 +244,9 @@
     private String getManagementOptions(FenceAgentOrder order) {
         String managementOptions = "";
         ArchitectureType architectureType = null;
-        if (_vds.getCpuName() != null) {
-            architectureType =  _vds.getCpuName().getArchitecture();
-        }
+        VDSGroup cluster = 
DbFacade.getInstance().getVdsGroupDao().get(_vds.getVdsGroupId());
+        VdsDynamic vdsDynamic = 
DbFacade.getInstance().getVdsDynamicDao().get(_vds.getId());
+        architectureType = 
_vds.getArchitecture(CpuFlagsManagerHandler.FindMaxServerCpuByFlags(vdsDynamic.getcpu_flags(),
 cluster.getcompatibility_version()), cluster);
         if (order == FenceAgentOrder.Primary) {
             managementOptions = 
VdsFenceOptions.getDefaultAgentOptions(_vds.getPmType(), _vds.getPmOptions(), 
architectureType);
         }
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 b2699ca..e278c81 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
@@ -23,6 +23,7 @@
 import org.ovirt.engine.core.common.businessentities.FenceStatusReturnValue;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VM;
+import org.ovirt.engine.core.common.businessentities.VdsDynamic;
 import org.ovirt.engine.core.common.businessentities.VdsStatic;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigCommon;
@@ -595,7 +596,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();
-        ArchitectureType architectureType = (getVds().getCpuName() != null) ? 
getVds().getCpuName().getArchitecture() : null;
+        VdsDynamic vdsDynamic = 
DbFacade.getInstance().getVdsDynamicDao().get(getVds().getId());
+        ArchitectureType architectureType = 
getVds().getArchitecture(CpuFlagsManagerHandler.FindMaxServerCpuByFlags(vdsDynamic.getcpu_flags(),
 getVdsGroup().getcompatibility_version()), getVdsGroup());
         options = VdsFenceOptions.getDefaultAgentOptions(agent, options, 
architectureType);
         HashMap<String, String> optionsMap = 
VdsStatic.pmOptionsStringToMap(options);
         String powerWaitParamSettings = 
FenceConfigHelper.getFenceConfigurationValue(ConfigValues.FencePowerWaitParam.name(),
 ConfigCommon.defaultConfigurationVersion);
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
index 4380be4..b171f99 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDS.java
@@ -1435,4 +1435,11 @@
         this.balloonEnabled = enableBalloon;
     }
 
+    public ArchitectureType getArchitecture(ServerCpu cpu, VDSGroup cluster) {
+        if (cpu != null && cpu.getArchitecture() != null) {
+            return cpu.getArchitecture();
+        }
+        // take architecture from the cluster if it is null on the host level
+        return cluster.getArchitecture();
+    }
 }


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

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

Reply via email to