def setUp(self): super(VolumeUtilsV2TestCase, self).setUp() self._volutilsv2 = volumeutilsv2.VolumeUtilsV2() self._volutilsv2._conn_storage = mock.MagicMock() self._volutilsv2._conn_wmi = mock.MagicMock() self.flags(volume_attach_retry_count=4, group='hyperv') self.flags(volume_attach_retry_interval=0, group='hyperv')
def _get_remote_disk_data(self, vmutils_remote, disk_paths, dest_host): volutils_remote = volumeutilsv2.VolumeUtilsV2(dest_host) disk_paths_remote = {} iscsi_targets = [] for (rasd_rel_path, disk_path) in disk_paths.items(): (target_iqn, target_lun) = self._volutils.get_target_from_disk_path(disk_path) iscsi_targets.append((target_iqn, target_lun)) dev_num = volutils_remote.get_device_number_for_target(target_iqn, target_lun) disk_path_remote = vmutils_remote.get_mounted_disk_by_drive_number( dev_num) disk_paths_remote[rasd_rel_path] = disk_path_remote return (disk_paths_remote, iscsi_targets)
def _get_remote_disk_data(self, vmutils_remote, disk_paths, dest_host): volutils_remote = volumeutilsv2.VolumeUtilsV2(dest_host) disk_paths_remote = {} for (rasd_rel_path, disk_path) in disk_paths.items(): target = self._volutils.get_target_from_disk_path(disk_path) if target: (target_iqn, target_lun) = target dev_num = volutils_remote.get_device_number_for_target( target_iqn, target_lun) disk_path_remote = ( vmutils_remote.get_mounted_disk_by_drive_number(dev_num)) disk_paths_remote[rasd_rel_path] = disk_path_remote else: LOG.debug("Could not retrieve iSCSI target " "from disk path: %s", disk_path) return disk_paths_remote
def __init__(self): self._vmutils = vmutilsv2.VMUtilsV2() self._volutils = volumeutilsv2.VolumeUtilsV2()
def _get_volume_utils(self): if(not CONF.hyperv.force_volumeutils_v1 and self._hostutils.get_windows_version() >= 6.2): return volumeutilsv2.VolumeUtilsV2() else: return volumeutils.VolumeUtils()