def live_migrate_vm(self, vm_name, dest_host):
        self.check_live_migration_config()

        conn_v2_local = self._get_conn_v2()
        conn_v2_remote = self._get_conn_v2(dest_host)

        vm = self._get_vm(conn_v2_local, vm_name)
        self._check_existing_planned_vm(conn_v2_remote, vm)

        rmt_ip_addr_list = self._get_remote_ip_address_list(
            conn_v2_remote, dest_host)

        iscsi_targets = {}
        planned_vm = None
        disk_paths = self._get_physical_disk_paths(vm_name)
        if disk_paths:
            vmutils_remote = vmutilsv2.VMUtilsV2(dest_host)
            (disk_paths_remote, iscsi_targets) = self._get_remote_disk_data(
                vmutils_remote, disk_paths, dest_host)

            planned_vm = self._create_remote_planned_vm(
                conn_v2_local, conn_v2_remote, vm, rmt_ip_addr_list, dest_host)

            self._update_planned_vm_disk_resources(vmutils_remote,
                                                   conn_v2_remote, planned_vm,
                                                   vm_name, disk_paths_remote)

        new_resource_setting_data = self._get_vhd_setting_data(vm)
        self._live_migrate_vm(conn_v2_local, vm, planned_vm, rmt_ip_addr_list,
                              new_resource_setting_data, dest_host)

        # In case the caller wants to log off the targets after migration
        return iscsi_targets
Esempio n. 2
0
    def live_migrate_vm(self, vm_name, dest_host):
        self.check_live_migration_config()

        conn_v2_local = self._get_conn_v2()
        conn_v2_remote = self._get_conn_v2(dest_host)

        vm = self._get_vm(conn_v2_local, vm_name)
        self._check_existing_planned_vm(conn_v2_remote, vm)

        rmt_ip_addr_list = self._get_remote_ip_address_list(
            conn_v2_remote, dest_host)

        planned_vm = None
        disk_paths = self._get_physical_disk_paths(vm_name)
        if disk_paths:
            vmutils_remote = vmutilsv2.VMUtilsV2(dest_host)
            disk_paths_remote = self._get_remote_disk_data(
                vmutils_remote, disk_paths, dest_host)

            planned_vm = self._create_remote_planned_vm(
                conn_v2_local, conn_v2_remote, vm, rmt_ip_addr_list, dest_host)

            self._update_planned_vm_disk_resources(vmutils_remote,
                                                   conn_v2_remote, planned_vm,
                                                   vm_name, disk_paths_remote)

        new_resource_setting_data = self._get_vhd_setting_data(vm)
        self._live_migrate_vm(conn_v2_local, vm, planned_vm, rmt_ip_addr_list,
                              new_resource_setting_data, dest_host)
Esempio n. 3
0
    def test_serial_port_setting_data_win_version_10(self, mock_sys,
                                                     mock_check_version):
        mock_sys.platform = 'win32'
        mock_check_version.return_value = True
        _vmutils = vmutilsv2.VMUtilsV2()

        self.assertEqual("Msvm_SerialPortSettingData",
                         _vmutils._SERIAL_PORT_SETTING_DATA_CLASS)
Esempio n. 4
0
    def __init__(self):
        # Live migration is supported starting from Hyper-V Server 2012
        if utilsfactory.get_hostutils().check_min_windows_version(6, 2):
            self._livemigrutils = utilsfactory.get_livemigrationutils()
        else:
            self._livemigrutils = None

        self._pathutils = utilsfactory.get_pathutils()
        self._vmops = vmops.VMOps()
        self._volumeops = volumeops.VolumeOps()
        self._imagecache = imagecache.ImageCache()
        self._vmutils = vmutilsv2.VMUtilsV2()
Esempio n. 5
0
 def setUp(self):
     super(VMUtilsV2TestCase, self).setUp()
     self._vmutils = vmutilsv2.VMUtilsV2()
     self._vmutils._conn = mock.MagicMock()
 def __init__(self):
     self._vmutils = vmutilsv2.VMUtilsV2()
     self._volutils = volumeutilsv2.VolumeUtilsV2()
Esempio n. 7
0
def get_vmutils(host='.'):
    return vmutilsv2.VMUtilsV2(host)
Esempio n. 8
0
 def __init__(self):
     self._vmutils = vmutilsv2.VMUtilsV2()
     if sys.platform == 'win32':
         self._conn = wmi.WMI(moniker='//./root/virtualization/v2')