Omer Frenkel has uploaded a new change for review.

Change subject: core: add support for tunnel migration
......................................................................

core: add support for tunnel migration

with 'tunnel migration' the migration process is using
libvirt-to-libvirt communication, which should be safer, but may have
overhead on the host' cpu.

the feature is supported only from 3.2 version clusters.
this patch allow the user to set default behaviour on the cluster,
(which by default is false),
and override the cluster value per vm.
if supported, engine will send 'tunnlled=true/false' on migrate verb.

Change-Id: I6fa684df7376f8470fe729d590ce0e63d39c4d1e
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M backend/manager/dbscripts/create_views.sql
A backend/manager/dbscripts/upgrade/03_02_0340_add_tunnel_migration.sql
M backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
M backend/manager/dbscripts/vds_groups_sp.sql
M backend/manager/dbscripts/vm_templates_sp.sql
M backend/manager/dbscripts/vms_sp.sql
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.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/vdscommands/MigrateVDSCommandParameters.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/MigrateBrokerVDSCommand.java
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
17 files changed, 123 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/62/11062/1

diff --git a/backend/manager/dbscripts/create_views.sql 
b/backend/manager/dbscripts/create_views.sql
index c01f4b3..30f2683 100644
--- a/backend/manager/dbscripts/create_views.sql
+++ b/backend/manager/dbscripts/create_views.sql
@@ -372,7 +372,8 @@
        vm_templates.db_generation as db_generation,
        vm_templates.migration_support,
        vm_templates.dedicated_vm_for_vds,
-       vm_templates.is_disabled
+       vm_templates.is_disabled,
+       vm_templates.tunnel_migration
 FROM       vm_static AS vm_templates  INNER JOIN
 vds_groups ON vm_templates.vds_group_id = vds_groups.vds_group_id
 left outer JOIN
@@ -545,7 +546,8 @@
                       vm_statistics.elapsed_time as elapsed_time, 
vm_statistics.usage_network_percent as usage_network_percent,
                       vm_statistics.usage_mem_percent as usage_mem_percent, 
vm_statistics.usage_cpu_percent as usage_cpu_percent, vds_static.vds_name as 
run_on_vds_name, vds_groups.cpu_name as vds_group_cpu_name,
                       vm_static.default_display_type as default_display_type, 
vm_static.priority as priority,vm_static.iso_path as iso_path, vm_static.origin 
as origin, vds_groups.compatibility_version as vds_group_compatibility_version,
-                      vm_static.initrd_url as initrd_url, vm_static.kernel_url 
as kernel_url, vm_static.kernel_params as kernel_params, 
vm_dynamic.pause_status as pause_status, vm_dynamic.exit_message as 
exit_message, vm_dynamic.exit_status as exit_status,vm_static.migration_support 
as migration_support,vm_static.predefined_properties as 
predefined_properties,vm_static.userdefined_properties as 
userdefined_properties,vm_static.min_allocated_mem as min_allocated_mem,  
vm_dynamic.hash as hash, vm_static.cpu_pinning as cpu_pinning, 
vm_static.db_generation as db_generation, vm_static.host_cpu_flags as 
host_cpu_flags
+                      vm_static.initrd_url as initrd_url, vm_static.kernel_url 
as kernel_url, vm_static.kernel_params as kernel_params, 
vm_dynamic.pause_status as pause_status, vm_dynamic.exit_message as 
exit_message, vm_dynamic.exit_status as exit_status,vm_static.migration_support 
as migration_support,vm_static.predefined_properties as 
predefined_properties,vm_static.userdefined_properties as 
userdefined_properties,vm_static.min_allocated_mem as min_allocated_mem,  
vm_dynamic.hash as hash, vm_static.cpu_pinning as cpu_pinning, 
vm_static.db_generation as db_generation, vm_static.host_cpu_flags as 
host_cpu_flags,
+                      vm_static.tunnel_migration as tunnel_migration
 FROM         vm_static INNER JOIN
 vm_dynamic ON vm_static.vm_guid = vm_dynamic.vm_guid INNER JOIN
 vm_static AS vm_templates ON vm_static.vmt_guid = vm_templates.vm_guid INNER 
JOIN
@@ -581,7 +583,7 @@
             vms.vds_group_cpu_name, tags_vm_map_view.tag_name, 
tags_vm_map_view.tag_id, vms.default_display_type, vms.priority,
             vms.vds_group_compatibility_version, vms.initrd_url, 
vms.kernel_url, vms.kernel_params, vms.pause_status,
             vms.exit_status, vms.exit_message, vms.min_allocated_mem, 
storage_domain_static.id AS storage_id,
-            vms.quota_id as quota_id, vms.quota_name as quota_name
+            vms.quota_id as quota_id, vms.quota_name as quota_name, 
vms.tunnel_migration as tunnel_migration
 FROM        vms LEFT OUTER JOIN
             tags_vm_map_view ON vms.vm_guid = tags_vm_map_view.vm_id LEFT 
OUTER JOIN
             vm_device ON vm_device.vm_id = vms.vm_guid LEFT OUTER JOIN
diff --git 
a/backend/manager/dbscripts/upgrade/03_02_0340_add_tunnel_migration.sql 
b/backend/manager/dbscripts/upgrade/03_02_0340_add_tunnel_migration.sql
new file mode 100644
index 0000000..ee32b35
--- /dev/null
+++ b/backend/manager/dbscripts/upgrade/03_02_0340_add_tunnel_migration.sql
@@ -0,0 +1,2 @@
+select fn_db_add_column('vds_groups', 'tunnel_migration', 'boolean NOT NULL 
default false');
+select fn_db_add_column('vm_static', 'tunnel_migration', 'boolean');
diff --git a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql 
b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
index 7a40991..ce6498d 100644
--- a/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
+++ b/backend/manager/dbscripts/upgrade/pre_upgrade/0000_config.sql
@@ -136,6 +136,9 @@
 select fn_db_add_config_value('DisconnectPoolOnReconstruct','0,2','general');
 select fn_db_add_config_value('HotPlugUnsupportedOsList','','general');
 select fn_db_add_config_value('InitStorageSparseSizeInGB','1','general');
+select fn_db_add_config_value('TunnelMigrationEnabled','false','3.0');
+select fn_db_add_config_value('TunnelMigrationEnabled','false','3.1');
+select fn_db_add_config_value('TunnelMigrationEnabled','true','3.2');
 --Handling Install virtualization software on Add Host
 
 select fn_db_add_config_value('InstallVds','true','general');
diff --git a/backend/manager/dbscripts/vds_groups_sp.sql 
b/backend/manager/dbscripts/vds_groups_sp.sql
index 8235fb1..046b481 100644
--- a/backend/manager/dbscripts/vds_groups_sp.sql
+++ b/backend/manager/dbscripts/vds_groups_sp.sql
@@ -23,16 +23,17 @@
        v_transparent_hugepages BOOLEAN ,
        v_migrate_on_error INTEGER,
        v_virt_service BOOLEAN,
-       v_gluster_service BOOLEAN)
+       v_gluster_service BOOLEAN,
+       v_tunnel_migration BOOLEAN)
 RETURNS VOID
    AS $procedure$
 BEGIN
       INSERT INTO vds_groups(vds_group_id,description, name, cpu_name, 
selection_algorithm, high_utilization, low_utilization,
        cpu_over_commit_duration_minutes, storage_pool_id,  
max_vds_memory_over_commit, count_threads_as_cores, compatibility_version,
-    transparent_hugepages, migrate_on_error, virt_service, gluster_service)
+    transparent_hugepages, migrate_on_error, virt_service, gluster_service, 
tunnel_migration)
        VALUES(v_vds_group_id,v_description, v_name, v_cpu_name, 
v_selection_algorithm, v_high_utilization, v_low_utilization,
        v_cpu_over_commit_duration_minutes, v_storage_pool_id,  
v_max_vds_memory_over_commit, v_count_threads_as_cores, v_compatibility_version,
-    v_transparent_hugepages, v_migrate_on_error, v_virt_service, 
v_gluster_service);
+    v_transparent_hugepages, v_migrate_on_error, v_virt_service, 
v_gluster_service, v_tunnel_migration);
 END; $procedure$
 LANGUAGE plpgsql;
 
@@ -55,7 +56,8 @@
        v_transparent_hugepages BOOLEAN ,
        v_migrate_on_error INTEGER,
        v_virt_service BOOLEAN,
-       v_gluster_service BOOLEAN)
+       v_gluster_service BOOLEAN,
+       v_tunnel_migration BOOLEAN)
 RETURNS VOID
 
        --The [vds_groups] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -70,7 +72,7 @@
       count_threads_as_cores = v_count_threads_as_cores,
       compatibility_version = v_compatibility_version,transparent_hugepages = 
v_transparent_hugepages,
       migrate_on_error = v_migrate_on_error,
-      virt_service = v_virt_service, gluster_service = v_gluster_service
+      virt_service = v_virt_service, gluster_service = v_gluster_service, 
tunnel_migration = v_tunnel_migration
       WHERE vds_group_id = v_vds_group_id;
 END; $procedure$
 LANGUAGE plpgsql;
diff --git a/backend/manager/dbscripts/vm_templates_sp.sql 
b/backend/manager/dbscripts/vm_templates_sp.sql
index df312f7..b65922f 100644
--- a/backend/manager/dbscripts/vm_templates_sp.sql
+++ b/backend/manager/dbscripts/vm_templates_sp.sql
@@ -42,7 +42,8 @@
  v_kernel_params VARCHAR(4000) ,
  v_quota_id UUID,
  v_migration_support integer,
- v_dedicated_vm_for_vds UUID)
+ v_dedicated_vm_for_vds UUID,
+ v_tunnel_migration BOOLEAN)
 
 RETURNS VOID
    AS $procedure$
@@ -86,7 +87,8 @@
     is_disabled,
     dedicated_vm_for_vds,
     is_smartcard_enabled,
-    is_delete_protected)
+    is_delete_protected,
+    tunnel_migration)
 VALUES(
     -- This field is meaningless for templates for the time being, however we 
want to keep it not null for VMs.
     -- Thus, since templates are top level elements they "point" to the 
'Blank' template.
@@ -127,7 +129,8 @@
     v_is_disabled,
     v_dedicated_vm_for_vds,
     v_is_smartcard_enabled,
-    v_is_delete_protected);
+    v_is_delete_protected,
+    v_tunnel_migration);
 -- perform deletion from vm_ovf_generations to ensure that no record exists 
when performing insert to avoid PK violation.
 DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vmt_guid;
 INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id)
@@ -176,7 +179,8 @@
  v_kernel_params VARCHAR(4000),
  v_quota_id UUID,
  v_migration_support integer,
- v_dedicated_vm_for_vds uuid)
+ v_dedicated_vm_for_vds uuid,
+ v_tunnel_migration BOOLEAN)
 RETURNS VOID
 
        --The [vm_templates] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -197,7 +201,7 @@
       iso_path = v_iso_path,origin = v_origin,initrd_url = v_initrd_url,
       kernel_url = v_kernel_url,kernel_params = v_kernel_params, _update_date 
= CURRENT_TIMESTAMP, quota_id = v_quota_id,
       migration_support = v_migration_support, dedicated_vm_for_vds = 
v_dedicated_vm_for_vds, is_smartcard_enabled = v_is_smartcard_enabled,
-      is_delete_protected = v_is_delete_protected, is_disabled = v_is_disabled
+      is_delete_protected = v_is_delete_protected, is_disabled = 
v_is_disabled, tunnel_migration = v_tunnel_migration
       WHERE vm_guid = v_vmt_guid
       AND   entity_type = 'TEMPLATE';
 END; $procedure$
diff --git a/backend/manager/dbscripts/vms_sp.sql 
b/backend/manager/dbscripts/vms_sp.sql
index feb12b1..cbb5b1a 100644
--- a/backend/manager/dbscripts/vms_sp.sql
+++ b/backend/manager/dbscripts/vms_sp.sql
@@ -428,12 +428,13 @@
     v_min_allocated_mem INTEGER,
     v_quota_id UUID,
     v_cpu_pinning VARCHAR(4000),
-    v_host_cpu_flags BOOLEAN)
+    v_host_cpu_flags BOOLEAN,
+    v_tunnel_migration BOOLEAN)
 RETURNS VOID
    AS $procedure$
 BEGIN
-INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, 
VM_NAME, 
vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,is_auto_suspend,num_of_sockets,cpu_per_socket,usb_policy,
 time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, 
default_boot_sequence, vm_type, nice_level, default_display_type, 
priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,
 entity_type, quota_id, cpu_pinning, 
is_smartcard_enabled,is_delete_protected,host_cpu_flags)
-       VALUES(v_description,  v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, 
v_vm_name, v_vmt_guid, v_domain, v_creation_date, v_num_of_monitors, 
v_allow_console_reconnect, v_is_initialized, v_is_auto_suspend, 
v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, 
v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, 
v_default_boot_sequence, v_vm_type, v_nice_level, v_default_display_type, 
v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,
 'VM', v_quota_id, v_cpu_pinning, 
v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags);
+INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, 
VM_NAME, 
vmt_guid,domain,creation_date,num_of_monitors,allow_console_reconnect,is_initialized,is_auto_suspend,num_of_sockets,cpu_per_socket,usb_policy,
 time_zone,auto_startup,is_stateless,dedicated_vm_for_vds, fail_back, 
default_boot_sequence, vm_type, nice_level, default_display_type, 
priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,
 entity_type, quota_id, cpu_pinning, 
is_smartcard_enabled,is_delete_protected,host_cpu_flags, tunnel_migration)
+       VALUES(v_description,  v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, 
v_vm_name, v_vmt_guid, v_domain, v_creation_date, v_num_of_monitors, 
v_allow_console_reconnect, v_is_initialized, v_is_auto_suspend, 
v_num_of_sockets, v_cpu_per_socket, v_usb_policy, v_time_zone, 
v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back, 
v_default_boot_sequence, v_vm_type, v_nice_level, v_default_display_type, 
v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,
 'VM', v_quota_id, v_cpu_pinning, 
v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags, 
v_tunnel_migration);
 -- perform deletion from vm_ovf_generations to ensure that no record exists 
when performing insert to avoid PK violation.
 DELETE FROM vm_ovf_generations gen WHERE gen.vm_guid = v_vm_guid;
 INSERT INTO vm_ovf_generations(vm_guid, storage_pool_id) VALUES (v_vm_guid, 
(SELECT storage_pool_id FROM vds_groups vg WHERE vg.vds_group_id = 
v_vds_group_id));
@@ -541,7 +542,8 @@
 v_min_allocated_mem INTEGER,
 v_quota_id UUID,
 v_cpu_pinning VARCHAR(4000),
-v_host_cpu_flags BOOLEAN)
+v_host_cpu_flags BOOLEAN,
+v_tunnel_migration BOOLEAN)
 RETURNS VOID
 
        --The [vm_static] table doesn't have a timestamp column. Optimistic 
concurrency logic cannot be generated
@@ -564,7 +566,7 @@
       kernel_params = v_kernel_params,migration_support = v_migration_support,
       predefined_properties = v_predefined_properties,userdefined_properties = 
v_userdefined_properties,
       min_allocated_mem = v_min_allocated_mem, quota_id = v_quota_id, 
cpu_pinning = v_cpu_pinning, is_smartcard_enabled = v_is_smartcard_enabled,
-      is_delete_protected = v_is_delete_protected, host_cpu_flags = 
v_host_cpu_flags
+      is_delete_protected = v_is_delete_protected, host_cpu_flags = 
v_host_cpu_flags, tunnel_migration = v_tunnel_migration
       WHERE vm_guid = v_vm_guid
       AND   entity_type = 'VM';
 END; $procedure$
@@ -872,12 +874,13 @@
     v_userdefined_properties VARCHAR(4000),
     v_min_allocated_mem INTEGER,
     v_cpu_pinning varchar(4000),
-    v_host_cpu_flags BOOLEAN)
+    v_host_cpu_flags BOOLEAN,
+    v_tunnel_migration BOOLEAN)
 RETURNS VOID
    AS $procedure$
 BEGIN
-INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, 
VM_NAME, vmt_guid, num_of_monitors, allow_console_reconnect, is_initialized, 
is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, 
time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,is_delete_protected,host_cpu_flags)
-       VALUES(v_description, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, 
v_vm_name, v_vmt_guid, v_num_of_monitors, v_num_of_monitors, v_is_initialized, 
v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, 
v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,v_default_display_type,v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,v_cpu_pinning,v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags);
+INSERT INTO vm_static(description, mem_size_mb, os, vds_group_id, vm_guid, 
VM_NAME, vmt_guid, num_of_monitors, allow_console_reconnect, is_initialized, 
is_auto_suspend, num_of_sockets, cpu_per_socket, usb_policy, 
time_zone,auto_startup,is_stateless,dedicated_vm_for_vds,fail_back,vm_type,nice_level,default_boot_sequence,default_display_type,priority,iso_path,origin,initrd_url,kernel_url,kernel_params,migration_support,predefined_properties,userdefined_properties,min_allocated_mem,cpu_pinning,is_smartcard_enabled,is_delete_protected,host_cpu_flags,
 tunnel_migration)
+       VALUES(v_description, v_mem_size_mb, v_os, v_vds_group_id, v_vm_guid, 
v_vm_name, v_vmt_guid, v_num_of_monitors, v_num_of_monitors, v_is_initialized, 
v_is_auto_suspend, v_num_of_sockets, v_cpu_per_socket, v_usb_policy, 
v_time_zone,v_auto_startup,v_is_stateless,v_dedicated_vm_for_vds,v_fail_back,v_vm_type,v_nice_level,v_default_boot_sequence,v_default_display_type,v_priority,v_iso_path,v_origin,v_initrd_url,v_kernel_url,v_kernel_params,v_migration_support,v_predefined_properties,v_userdefined_properties,v_min_allocated_mem,v_cpu_pinning,v_is_smartcard_enabled,v_is_delete_protected,v_host_cpu_flags,
 v_tunnel_migration);
 
       INSERT INTO vm_dynamic(vm_guid, status) VALUES(v_vm_guid, 0);
 
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 a8c76e2..7f41bd7 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
@@ -5,6 +5,7 @@
 import org.ovirt.engine.core.bll.job.ExecutionHandler;
 import org.ovirt.engine.core.bll.snapshots.SnapshotsValidator;
 import org.ovirt.engine.core.common.AuditLogType;
+import org.ovirt.engine.core.common.FeatureSupported;
 import org.ovirt.engine.core.common.action.MigrateVmParameters;
 import org.ovirt.engine.core.common.businessentities.MigrationMethod;
 import org.ovirt.engine.core.common.businessentities.MigrationSupport;
@@ -116,6 +117,14 @@
         String srcVdsHost = getVds().gethost_name();
         String dstVdsHost = String.format("%1$s:%2$s", 
getDestinationVds().gethost_name(), getDestinationVds()
                 .getport());
+        Boolean tunnelMigration = null;
+        if 
(FeatureSupported.tunnelMigration(getVm().getVdsGroupCompatibilityVersion())) {
+            // if vm has no override for tunnel migration (its null),
+            // use cluster's setting
+            tunnelMigration =
+                    getVm().isTunnelMigration() != null ? 
getVm().isTunnelMigration()
+                            : getVdsGroup().isTunnelMigration();
+        }
         // Starting migration at src VDS
         boolean connectToLunDiskSuccess = connectLunDisks(_vdsDestinationId);
         if (connectToLunDiskSuccess) {
@@ -125,7 +134,7 @@
                     .RunAsyncVdsCommand(
                             VDSCommandType.Migrate,
                             new MigrateVDSCommandParameters(getVdsId(), 
getVmId(), srcVdsHost, _vdsDestinationId,
-                                    dstVdsHost, MigrationMethod.ONLINE), 
this).getReturnValue());
+                                    dstVdsHost, MigrationMethod.ONLINE, 
tunnelMigration), this).getReturnValue());
         }
         if (!connectToLunDiskSuccess || (VMStatus) getActionReturnValue() != 
VMStatus.MigratingFrom) {
             getVm().setMigreatingToPort(0);
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
index b518b35..b49e11d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java
@@ -88,7 +88,8 @@
                 "images", // images list is relational entity - ignore value 
changes
                 "interfaces", // interfaces is relational entity - ignore 
value changes
                 "useHostCpuFlags",
-                "quotaDefault"
+                "quotaDefault",
+                "tunnelMigration"
         });
         mUpdateVmsStatic.AddFields(
                 Arrays.asList(new Enum<?>[] { VMStatus.Down }),
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java
index 39d6647..2fced9d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java
@@ -36,7 +36,7 @@
                 "isoPath", "diskImageMap", "defaultDisplayType", "priority", 
"autoStartup", "stateless",
                 "initrdUrl", "kernelUrl", "kernelParams", "images", 
"interfaces", "quotaId", "quotaName",
                 "quotaEnforcementType", "migrationSupport", 
"dedicatedVmForVds", "smartcardEnabled","dbGeneration", "deleteProtected",
-                "quotaDefault"
+                "quotaDefault", "tunnelMigration"
         });
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
index b78a6e3..93fb58a 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/FeatureSupported.java
@@ -59,4 +59,13 @@
     public static boolean antiMacSpoofing(Version version) {
         return 
supportedInConfig(ConfigValues.EnableMACAntiSpoofingFilterRules, version);
     }
+
+    /**
+     * @param version
+     *            Compatibility version to check for.
+     * @return <code>true</code> if anti MAC spoofing is supported for the 
version, <code>false</code> if it's not.
+     */
+    public static boolean tunnelMigration(Version version) {
+        return supportedInConfig(ConfigValues.TunnelMigrationEnabled, version);
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
index 9ab4165..21adf74 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VDSGroup.java
@@ -108,6 +108,9 @@
     @Column(name = "gluster_service")
     private boolean glusterService = false;
 
+    @Column(name = "tunnel_migration")
+    private boolean tunnelMigration = false;
+
     public VDSGroup() {
         selection_algorithm = VdsSelectionAlgorithm.None;
         high_utilization = -1;
@@ -266,6 +269,14 @@
         return glusterService;
     }
 
+    public boolean isTunnelMigration() {
+        return tunnelMigration;
+    }
+
+    public void setTunnelMigration(boolean value) {
+        tunnelMigration = value;
+    }
+
     @Override
     public int hashCode() {
         final int prime = 31;
@@ -290,6 +301,7 @@
         result = prime * result + (transparentHugepages ? 1231 : 1237);
         result = prime * result + (virtService ? 1231 : 1237);
         result = prime * result + (glusterService ? 1231 : 1237);
+        result = prime * result + (tunnelMigration ? 1231 : 1237);
         return result;
     }
 
@@ -361,6 +373,9 @@
         if (glusterService != other.glusterService) {
             return false;
         }
+        if (tunnelMigration != other.tunnelMigration) {
+            return false;
+        }
         return true;
     }
 
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
index 27b859f..6cedc91 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VM.java
@@ -1522,4 +1522,12 @@
     public boolean isNotRunning() {
         return getStatus().isNotRunning();
     }
+
+    public Boolean isTunnelMigration() {
+        return vmStatic.isTunnelMigration();
+    }
+
+    public void setTunnelMigration(Boolean value) {
+        vmStatic.setTunnelMigration(value);
+    }
 }
diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
index d6eb124..778400c 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java
@@ -140,6 +140,12 @@
     private boolean allowConsoleReconnect;
 
     /**
+     * if this field is null then value should be taken from cluster
+     */
+    @Column(name = "tunnel_migration")
+    private Boolean tunnelMigration;
+
+    /**
      * this field is used to save the ovf version,
      * in case the vm object was built from ovf.
      * not persisted to db.
@@ -561,6 +567,7 @@
         result = prime * result + (allowConsoleReconnect ? 1231 : 1237);
         result = prime * result + ((migrationSupport == null) ? 0 : 
migrationSupport.hashCode());
         result = prime * result + ((dedicatedVmForVds == null) ? 0 : 
dedicatedVmForVds.hashCode());
+        result = prime * result + ((tunnelMigration == null) ? 0 : 
tunnelMigration.hashCode());
 
         return result;
     }
@@ -718,6 +725,13 @@
         if (migrationSupport != other.migrationSupport) {
             return false;
         }
+        if (tunnelMigration == null) {
+            if (other.tunnelMigration != null) {
+                return false;
+            }
+        } else if (!tunnelMigration.equals(other.tunnelMigration)) {
+            return false;
+        }
         return true;
     }
 
@@ -784,4 +798,12 @@
     public void setOvfVersion(String ovfVersion) {
         this.ovfVersion = ovfVersion;
     }
+
+    public Boolean isTunnelMigration() {
+        return tunnelMigration;
+    }
+
+    public void setTunnelMigration(Boolean value) {
+        tunnelMigration = value;
+    }
 }
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 942ec43..702b563 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
@@ -1331,6 +1331,11 @@
     @DefaultValueAttribute("false")
     HardwareInfoEnabled(410),
 
+    @Reloadable
+    @TypeConverterAttribute(Boolean.class)
+    @DefaultValueAttribute("false")
+    TunnelMigrationEnabled(411),
+
     Invalid(65535);
 
     private int intValue;
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 2ac41b7..7da72cb 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
@@ -8,14 +8,16 @@
     private Guid _dstVdsId;
     private String _dstHost;
     private MigrationMethod _migrationMethod = MigrationMethod.forValue(0);
+    private Boolean tunnelMigration;
 
     public MigrateVDSCommandParameters(Guid vdsId, Guid vmId, String srcHost, 
Guid dstVdsId, String dstHost,
-            MigrationMethod migrationMethod) {
+            MigrationMethod migrationMethod, Boolean tunnelMigration) {
         super(vdsId, vmId);
         _srcHost = srcHost;
         _dstVdsId = dstVdsId;
         _dstHost = dstHost;
         _migrationMethod = migrationMethod;
+        this.tunnelMigration = tunnelMigration;
     }
 
     public String getSrcHost() {
@@ -34,16 +36,21 @@
         return _migrationMethod;
     }
 
+    public Boolean getTunnelMigration() {
+        return tunnelMigration;
+    }
+
     public MigrateVDSCommandParameters() {
     }
 
     @Override
     public String toString() {
-        return String.format("%s, srcHost=%s, dstVdsId=%s, dstHost=%s, 
migrationMethod=%s",
+        return String.format("%s, srcHost=%s, dstVdsId=%s, dstHost=%s, 
migrationMethod=%s, tunnelMigration=%s",
                 super.toString(),
                 getSrcHost(),
                 getDstVdsId(),
                 getDstHost(),
-                getMigrationMethod());
+                getMigrationMethod(),
+                getTunnelMigration());
     }
 }
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 8ef50c9..c4b17cc 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
@@ -20,6 +20,9 @@
         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.tunnlled, 
String.valueOf(parameters.getTunnelMigration()));
+        }
     }
 
     @Override
diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
index 9226521..5643df8 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/VdsProperties.java
@@ -253,6 +253,7 @@
     public static final String online = "online";
     public static final String domains = "storageDomains";
     public static final String hooks = "hooks";
+    public static final String tunnlled = "tunnlled";
 
     // storage domains
     public static final String code = "code";


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

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

Reply via email to