本文整理汇总了Python中ovs.lib.vdisk.VDiskController.resize_from_voldrv方法的典型用法代码示例。如果您正苦于以下问题:Python VDiskController.resize_from_voldrv方法的具体用法?Python VDiskController.resize_from_voldrv怎么用?Python VDiskController.resize_from_voldrv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovs.lib.vdisk.VDiskController
的用法示例。
在下文中一共展示了VDiskController.resize_from_voldrv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_event_resize_from_volumedriver
# 需要导入模块: from ovs.lib.vdisk import VDiskController [as 别名]
# 或者: from ovs.lib.vdisk.VDiskController import resize_from_voldrv [as 别名]
def test_event_resize_from_volumedriver(self):
"""
Test resize from volumedriver event
- Create a vDisk using the resize event
- Resize the created vDisk using the same resize event
"""
structure = Helper.build_service_structure(
{'vpools': [1],
'storagerouters': [1],
'storagedrivers': [(1, 1, 1)], # (<id>, <vpool_id>, <storagerouter_id>)
'mds_services': [(1, 1)]} # (<id>, <storagedriver_id>)
)
vpools = structure['vpools']
storagedrivers = structure['storagedrivers']
mds_service = structure['mds_services'][1]
# Create volume using resize from voldrv
device_name = '/vdisk.raw'
srclient = StorageRouterClient(vpools[1].guid, None)
mds_backend_config = Helper._generate_mdsmetadatabackendconfig([mds_service])
volume_id = srclient.create_volume(device_name, mds_backend_config, 1024 ** 4, str(storagedrivers[1].storagedriver_id))
VDiskController.resize_from_voldrv(volume_id=volume_id,
volume_size=1024 ** 4,
volume_path=device_name,
storagedriver_id=storagedrivers[1].storagedriver_id)
vdisks = VDiskList.get_vdisks()
self.assertTrue(expr=len(vdisks) == 1,
msg='Expected to find 1 vDisk in model')
self.assertEqual(first=vdisks[0].name,
second='vdisk',
msg='Volume name should be vdisk')
self.assertEqual(first=vdisks[0].volume_id,
second=volume_id,
msg='Volume ID should be {0}'.format(volume_id))
self.assertEqual(first=vdisks[0].devicename,
second=device_name,
msg='Device name should be {0}'.format(device_name))
self.assertEqual(first=vdisks[0].size,
second=1024 ** 4,
msg='Size should be 1 TiB')
# Resize volume using resize from voldrv
VDiskController.resize_from_voldrv(volume_id=volume_id,
volume_size=2 * 1024 ** 4,
volume_path=device_name,
storagedriver_id=storagedrivers[1].storagedriver_id)
vdisks = VDiskList.get_vdisks()
self.assertTrue(expr=len(vdisks) == 1,
msg='Expected to find 1 vDisk in model')
self.assertEqual(first=vdisks[0].name,
second='vdisk',
msg='Volume name should be vdisk')
self.assertEqual(first=vdisks[0].size,
second=2 * 1024 ** 4,
msg='Size should be 2 TiB')