Vitor de Lima has uploaded a new change for review.

Change subject: core, engine: Disable Migrate On Error on ppc64 clusters
......................................................................

core, engine: Disable Migrate On Error on ppc64 clusters

This change handles the use case where a host enters a cluster without
a CPU name, changing this value to have the same value as the one
reported by the host. If the architecture of the host does not support
migration, this change forces the Migrate On Error option to be
disabled.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1057178

Change-Id: I556ef1ce4896ddeb39b93a93520fd0535b4fa28c
Signed-off-by: Vitor de Lima <vitor.l...@eldorado.org.br>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsCpuFlagsOrClusterChangedCommand.java
1 file changed, 25 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/52/25052/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsCpuFlagsOrClusterChangedCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsCpuFlagsOrClusterChangedCommand.java
index 67eb704..acc6325 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsCpuFlagsOrClusterChangedCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HandleVdsCpuFlagsOrClusterChangedCommand.java
@@ -5,11 +5,13 @@
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.action.SetNonOperationalVdsParameters;
 import org.ovirt.engine.core.common.action.VdcActionType;
 import org.ovirt.engine.core.common.action.VdsActionParameters;
 import org.ovirt.engine.core.common.action.VdsGroupOperationParameters;
 import org.ovirt.engine.core.common.businessentities.ArchitectureType;
+import org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions;
 import org.ovirt.engine.core.common.businessentities.NonOperationalReason;
 import org.ovirt.engine.core.common.businessentities.ServerCpu;
 import org.ovirt.engine.core.common.businessentities.VDSGroup;
@@ -85,6 +87,8 @@
                     grp.setcpu_name(sc.getCpuName());
                     grp.setArchitecture(ArchitectureType.undefined);
 
+                    updateMigrateOnError(grp);
+
                     // use suppress in order to update group even if action 
fails
                     // (out of the transaction)
                     VdsGroupOperationParameters tempVar = new 
VdsGroupOperationParameters(grp);
@@ -125,6 +129,27 @@
         setSucceeded(true);
     }
 
+    private void updateMigrateOnError(VDSGroup group) {
+        ArchitectureType arch = getArchitecture(group);
+
+        boolean isMigrationSupported = 
FeatureSupported.isMigrationSupported(arch, group.getcompatibility_version());
+
+        if (!isMigrationSupported) {
+            group.setMigrateOnError(MigrateOnErrorOptions.NO);
+        }
+    }
+
+    protected ArchitectureType getArchitecture(VDSGroup group) {
+        if (StringUtils.isNotEmpty(group.getcpu_name())) {
+            return 
CpuFlagsManagerHandler.getArchitectureByCpuName(group.getcpu_name(),
+                    group.getcompatibility_version());
+        } else if (group.getArchitecture() == null) {
+            return ArchitectureType.undefined;
+        }
+
+        return group.getArchitecture();
+    }
+
     @Override
     public AuditLogType getAuditLogTypeValue() {
         if (!foundCPU) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I556ef1ce4896ddeb39b93a93520fd0535b4fa28c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4
Gerrit-Owner: Vitor de Lima <vitor.l...@eldorado.org.br>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to