Exemple #1
0
 def set_disk_host_resource(self, vm_name, controller_path, address,
                            mounted_disk_path):
     disk_found = False
     vm = self._lookup_vm_check(vm_name)
     (disk_resources, volume_resources) = self._get_vm_disks(vm)
     for disk_resource in disk_resources + volume_resources:
         if (disk_resource.Parent == controller_path and
                 self._get_disk_resource_address(disk_resource) ==
                 str(address)):
             if (disk_resource.HostResource and
                     disk_resource.HostResource[0] != mounted_disk_path):
                 LOG.debug('Updating disk host resource "%(old)s" to '
                             '"%(new)s"' %
                           {'old': disk_resource.HostResource[0],
                            'new': mounted_disk_path})
                 disk_resource.HostResource = [mounted_disk_path]
                 self._jobutils.modify_virt_resource(disk_resource, vm)
             disk_found = True
             break
     if not disk_found:
         LOG.warning(_LW('Disk not found on controller '
                         '"%(controller_path)s" with '
                         'address "%(address)s"'),
                     {'controller_path': controller_path,
                      'address': address})
Exemple #2
0
def get_networkutils():
    force_v1_flag = CONF.hyperv.force_hyperv_utils_v1
    if utils.check_min_windows_version(6, 3):
        if force_v1_flag:
            LOG.warning(_LW('V1 virtualization namespace no longer supported '
                            'on Windows Server / Hyper-V Server 2012 R2 or '
                            'above.'))
        cls = networkutilsv2.NetworkUtilsV2R2
    else:
        cls = _get_virt_utils_class(networkutils.NetworkUtils,
                                    networkutilsv2.NetworkUtilsV2)
    return cls()