def __init__(self, volumeops): self._vmutils = vmutils.VMUtils() self._vhdutils = vhdutils.VHDUtils() self._pathutils = pathutils.PathUtils() self._volumeops = volumeops self._vif_driver = None self._load_vif_driver_class()
def __init__(self): self._hostutils = hostutils.HostUtils() self._vmutils = vmutils.VMUtils() self._vhdutils = vhdutils.VHDUtils() self._pathutils = pathutils.PathUtils() self._volumeops = volumeops.VolumeOps() self._vmops = vmops.VMOps() self._imagecache = imagecache.ImageCache()
def test_get_internal_vhd_size_by_file_size_unsupported(self): vhdutil = vhdutils.VHDUtils() root_vhd_size = 20 * 1024**3 vhdutil.get_vhd_info = mock.MagicMock() vhdutil.get_vhd_info.return_value = {'Type': 5} self.assertRaises(vmutils.HyperVException, vhdutil.get_internal_vhd_size_by_file_size, None, root_vhd_size)
def __init__(self): self._hostutils = hostutils.HostUtils() self._vmutils = vmutils.VMUtils() self._vhdutils = vhdutils.VHDUtils() self._pathutils = pathutils.PathUtils() self._volumeops = volumeops.VolumeOps() self._imagecache = imagecache.ImageCache() self._vif_driver = None self._load_vif_driver_class()
def test_get_internal_vhd_size_by_file_size_fixed(self): vhdutil = vhdutils.VHDUtils() root_vhd_size = 1 * 1024**3 vhdutil.get_vhd_info = mock.MagicMock() vhdutil.get_vhd_info.return_value = {'Type': constants.VHD_TYPE_FIXED} real_size = vhdutil.get_internal_vhd_size_by_file_size( None, root_vhd_size) expected_vhd_size = 1 * 1024**3 - 512 self.assertEqual(expected_vhd_size, real_size)
def setUp(self): super(VHDUtilsTestCase, self).setUp() self._vhdutils = vhdutils.VHDUtils() self._vhdutils._conn = mock.MagicMock() self._vhdutils._vmutils = mock.MagicMock() self._fake_vhd_info = { 'ParentPath': self._FAKE_PARENT_PATH, 'MaxInternalSize': self._FAKE_MAX_INTERNAL_SIZE, 'Type': self._FAKE_TYPE}
def test_get_internal_vhd_size_by_file_size_dynamic(self): vhdutil = vhdutils.VHDUtils() root_vhd_size = 20 * 1024 ** 3 vhdutil.get_vhd_info = mock.MagicMock() vhdutil.get_vhd_info.return_value = {'Type': constants.VHD_TYPE_DYNAMIC} vhdutil._get_vhd_dynamic_blk_size = mock.MagicMock() vhdutil._get_vhd_dynamic_blk_size.return_value = 2097152 real_size = vhdutil.get_internal_vhd_size_by_file_size(None, root_vhd_size) expected_vhd_size = 20 * 1024 ** 3 - 43008 self.assertEqual(expected_vhd_size, real_size)
def test_get_internal_vhd_size_by_file_size_differencing(self): # For differencing images, the internal size of the parent vhd # is returned vhdutil = vhdutils.VHDUtils() root_vhd_size = 20 * 1024 ** 3 vhdutil.get_vhd_info = mock.MagicMock() vhdutil.get_vhd_parent_path = mock.MagicMock() vhdutil.get_vhd_parent_path.return_value = self._FAKE_VHD_PATH vhdutil.get_vhd_info.side_effect = [ {'Type': 4}, {'Type': constants.VHD_TYPE_DYNAMIC}] vhdutil._get_vhd_dynamic_blk_size = mock.MagicMock() vhdutil._get_vhd_dynamic_blk_size.return_value = 2097152 real_size = vhdutil.get_internal_vhd_size_by_file_size(None, root_vhd_size) expected_vhd_size = 20 * 1024 ** 3 - 43008 self.assertEqual(expected_vhd_size, real_size)
def __init__(self): self._pathutils = pathutils.PathUtils() self._vhdutils = vhdutils.VHDUtils()
def setUp(self): self._vhdutils = vhdutils.VHDUtils() self._vhdutils._conn = mock.MagicMock() self._vhdutils._vmutils = mock.MagicMock() super(VHDUtilsTestCase, self).setUp()
def get_vhdutils(): return vhdutils.VHDUtils()