本文整理汇总了Python中vdsm.virt.vmdevices.storage.Drive._blockDev方法的典型用法代码示例。如果您正苦于以下问题:Python Drive._blockDev方法的具体用法?Python Drive._blockDev怎么用?Python Drive._blockDev使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vdsm.virt.vmdevices.storage.Drive
的用法示例。
在下文中一共展示了Drive._blockDev方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_block
# 需要导入模块: from vdsm.virt.vmdevices.storage import Drive [as 别名]
# 或者: from vdsm.virt.vmdevices.storage.Drive import _blockDev [as 别名]
def test_block(self):
drive = Drive(self.log, **self.conf)
drive._blockDev = True
expected = """
<disk name='vda' snapshot='external' type='block'>
<source dev='/dev/dm-1' type='block'/>
</disk>
"""
snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
actual = drive.get_snapshot_xml(snap_info)
self.assertXMLEqual(vmxml.format_xml(actual), expected)
示例2: make_env
# 需要导入模块: from vdsm.virt.vmdevices.storage import Drive [as 别名]
# 或者: from vdsm.virt.vmdevices.storage.Drive import _blockDev [as 别名]
def make_env(self):
with namedTemporaryDir() as tmpdir:
"""
Below we imitate that behaviour by providing
two different directories under /rhv/data-center
root and one of those directories
is a symlink to another one.
We fill VolumeChain with real directory and
use symlinked directory in XML, emulating
libvirt reply.
"""
dc_base = os.path.join(tmpdir, "dc")
run_base = os.path.join(tmpdir, "run")
images_path = os.path.join(dc_base, "images")
os.makedirs(images_path)
os.symlink(dc_base, run_base)
dc_top_vol = os.path.join(
images_path,
"11111111-1111-1111-1111-111111111111")
dc_base_vol = os.path.join(
images_path,
"22222222-2222-2222-2222-222222222222")
make_file(dc_top_vol)
make_file(dc_base_vol)
run_top_vol = os.path.join(
run_base,
"images",
"11111111-1111-1111-1111-111111111111")
run_base_vol = os.path.join(
run_base,
"images",
"22222222-2222-2222-2222-222222222222")
volume_chain = [
{'path': dc_top_vol,
'volumeID': '11111111-1111-1111-1111-111111111111'},
{'path': dc_base_vol,
'volumeID': '22222222-2222-2222-2222-222222222222'}
]
conf = drive_config(volumeChain=volume_chain)
drive = Drive(self.log, **conf)
drive._blockDev = True
yield VolumeChainEnv(
drive, run_top_vol,
run_base_vol
)
示例3: test_replica
# 需要导入模块: from vdsm.virt.vmdevices.storage import Drive [as 别名]
# 或者: from vdsm.virt.vmdevices.storage.Drive import _blockDev [as 别名]
def test_replica(self, diskType, format):
conf = drive_config(diskReplicate=replica(diskType, format=format))
drive = Drive(self.log, **conf)
drive._blockDev = False
self.assertEqual(drive.chunked, False)
示例4: test_drive
# 需要导入模块: from vdsm.virt.vmdevices.storage import Drive [as 别名]
# 或者: from vdsm.virt.vmdevices.storage.Drive import _blockDev [as 别名]
def test_drive(self, device, blockDev, format, chunked):
conf = drive_config(device=device, format=format)
drive = Drive(self.log, **conf)
drive._blockDev = blockDev
self.assertEqual(drive.chunked, chunked)
示例5: check
# 需要导入模块: from vdsm.virt.vmdevices.storage import Drive [as 别名]
# 或者: from vdsm.virt.vmdevices.storage.Drive import _blockDev [as 别名]
def check(self, device_conf, xml, is_block_device=False):
drive = Drive(self.log, **device_conf)
# Patch to skip the block device checking.
drive._blockDev = is_block_device
self.assertXMLEqual(vmxml.format_xml(drive.getReplicaXML()), xml)