Arik Hadas has uploaded a new change for review.

Change subject: core: change inner representation for tunnel migration
......................................................................

core: change inner representation for tunnel migration

Findbugs complained about setting tunnel-migration to null, when it was
represented as Boolean. We used null value to indicate that the
'VdsProperties.TUNNELED' attribute should not be sent to VDSM (in order
to maintain backward compatibility).

This patch changes the representation of tunnel-migration from Boolean
to boolean, and in MigrateBrokerVDSCommand we check again if the
tunnel-migration feature is supported or not, and if it is not supported
then we don't send the 'VdsProperties.TUNNELED' to VDSM.

Change-Id: I9f1df36ec741f09f49a436854486d37c442fc042
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateVDSCommandParameters.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
3 files changed, 17 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/38/20938/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index 6feef6a..b1b5443 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -166,15 +166,15 @@
                 dstVdsHost, MigrationMethod.ONLINE, isTunnelMigrationUsed(), 
getMigrationNetworkIp(), getVds().getVdsGroupCompatibilityVersion());
     }
 
-    private Boolean isTunnelMigrationUsed() {
-        if 
(FeatureSupported.tunnelMigration(getVm().getVdsGroupCompatibilityVersion())) {
-            // if vm has no override for tunnel migration (its null),
-            // use cluster's setting
-            return getVm().getTunnelMigration() != null ?
-                    getVm().getTunnelMigration()
-                    : getVdsGroup().isTunnelMigration();
+    private boolean isTunnelMigrationUsed() {
+        if 
(!FeatureSupported.tunnelMigration(getVm().getVdsGroupCompatibilityVersion())) {
+            return false;
         }
-        return null;
+        // if vm has no override for tunnel migration (its null),
+        // use cluster's setting
+        return getVm().getTunnelMigration() != null ?
+                getVm().getTunnelMigration()
+                : getVdsGroup().isTunnelMigration();
     }
 
     private String getMigrationNetworkIp() {
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateVDSCommandParameters.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateVDSCommandParameters.java
index aa91ab3..49c4d85 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateVDSCommandParameters.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/vdscommands/MigrateVDSCommandParameters.java
@@ -9,12 +9,12 @@
     private Guid _dstVdsId;
     private String _dstHost;
     private MigrationMethod _migrationMethod;
-    private Boolean tunnelMigration;
+    private boolean tunnelMigration;
     private String dstQemu;
     private Version clusterVersion;
 
     public MigrateVDSCommandParameters(Guid vdsId, Guid vmId, String srcHost, 
Guid dstVdsId, String dstHost,
-            MigrationMethod migrationMethod, Boolean tunnelMigration, String 
dstQemu, Version clusterVersion) {
+            MigrationMethod migrationMethod, boolean tunnelMigration, String 
dstQemu, Version clusterVersion) {
         super(vdsId, vmId);
         _srcHost = srcHost;
         _dstVdsId = dstVdsId;
@@ -41,7 +41,7 @@
         return _migrationMethod;
     }
 
-    public Boolean getTunnelMigration() {
+    public boolean isTunnelMigration() {
         return tunnelMigration;
     }
 
@@ -61,7 +61,7 @@
                 getDstVdsId(),
                 getDstHost(),
                 getMigrationMethod(),
-                getTunnelMigration());
+                isTunnelMigration());
     }
 
     public void setClusterVersion(Version clusterVersion) {
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
index ecd74b0..3aa3a56 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
@@ -4,6 +4,7 @@
 import java.util.Map;
 
 import org.apache.commons.lang.StringUtils;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.config.Config;
 import org.ovirt.engine.core.common.config.ConfigValues;
 import org.ovirt.engine.core.common.vdscommands.MigrateVDSCommandParameters;
@@ -16,13 +17,14 @@
         String migMethod = 
VdsProperties.migrationMethodtoString(parameters.getMigrationMethod());
         log.infoFormat("VdsBroker::migrate::Entered (vm_guid='{0}', 
srcHost='{1}', dstHost='{2}',  method='{3}'",
                 parameters.getVmId().toString(), parameters.getSrcHost(), 
parameters.getDstHost(), migMethod);
-        migrationInfo = new HashMap<String, String>();
+        migrationInfo = new HashMap<>();
         migrationInfo.put(VdsProperties.vm_guid, 
parameters.getVmId().toString());
         migrationInfo.put(VdsProperties.src, String.format("%1$s", 
parameters.getSrcHost()));
         migrationInfo.put(VdsProperties.dst, String.format("%1$s", 
parameters.getDstHost()));
         migrationInfo.put(VdsProperties.method, migMethod);
-        if (parameters.getTunnelMigration() != null) {
-            migrationInfo.put(VdsProperties.TUNNELED, 
parameters.getTunnelMigration().toString());
+
+        if (FeatureSupported.tunnelMigration(parameters.getClusterVersion())) {
+            migrationInfo.put(VdsProperties.TUNNELED, 
Boolean.toString(parameters.isTunnelMigration()));
         }
 
         if (StringUtils.isNotBlank(parameters.getDstQemu())) {


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

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

Reply via email to