本文整理汇总了Python中vdsm.virt.vmdevices.storage.Drive类的典型用法代码示例。如果您正苦于以下问题:Python Drive类的具体用法?Python Drive怎么用?Python Drive使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Drive类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_migrate_network_to_block
def test_migrate_network_to_block(self):
conf = drive_config(diskType=DISK_TYPE.NETWORK, path='pool/volume')
drive = Drive(self.log, **conf)
# Migrate drive to block domain...
drive.path = '/blockdomain/volume'
drive.diskType = DISK_TYPE.BLOCK
self.assertEqual(DISK_TYPE.BLOCK, drive.diskType)
开发者ID:nirs,项目名称:vdsm,代码行数:7,代码来源:vmstorage_test.py
示例2: test_parse_volume_chain_network
def test_parse_volume_chain_network(self):
volume_chain = [
{'path': 'server:/vol/11111111-1111-1111-1111-111111111111',
'volumeID': '11111111-1111-1111-1111-111111111111'},
{'path': 'server:/vol/22222222-2222-2222-2222-222222222222',
'volumeID': '22222222-2222-2222-2222-222222222222'}
]
conf = drive_config(volumeChain=volume_chain)
drive = Drive(self.log, diskType=DISK_TYPE.NETWORK, **conf)
disk_xml = etree.fromstring("""
<disk>
<source name='server:/vol/11111111-1111-1111-1111-111111111111'/>
<backingStore type='network' index='1'>
<source
name='server:/vol/22222222-2222-2222-2222-222222222222'/>
<backingStore/>
</backingStore>
</disk>""")
chain = drive.parse_volume_chain(disk_xml)
expected = [
storage.VolumeChainEntry(
path='server:/vol/22222222-2222-2222-2222-222222222222',
allocation=None,
uuid='22222222-2222-2222-2222-222222222222',
index=1),
storage.VolumeChainEntry(
path='server:/vol/11111111-1111-1111-1111-111111111111',
allocation=None,
uuid='11111111-1111-1111-1111-111111111111',
index=None)
]
self.assertEqual(chain, expected)
开发者ID:EdDev,项目名称:vdsm,代码行数:34,代码来源:vmstorage_test.py
示例3: test_migrate_from_block_to_file
def test_migrate_from_block_to_file(self):
conf = drive_config(path='/blockdomain/volume')
drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **conf)
# Migrate drive to file domain...
drive.diskType = DISK_TYPE.FILE
drive.path = "/filedomain/volume"
self.assertEqual(DISK_TYPE.FILE, drive.diskType)
开发者ID:nirs,项目名称:vdsm,代码行数:7,代码来源:vmstorage_test.py
示例4: test_block_threshold_stale_path
def test_block_threshold_stale_path(self):
conf = drive_config(diskType=DISK_TYPE.BLOCK, path='/new/path')
drive = Drive(self.log, **conf)
drive.threshold_state = BLOCK_THRESHOLD.SET
drive.on_block_threshold('/old/path')
self.assertEqual(drive.threshold_state, BLOCK_THRESHOLD.SET)
开发者ID:nirs,项目名称:vdsm,代码行数:7,代码来源:vmstorage_test.py
示例5: test_migrate_from_block_to_network
def test_migrate_from_block_to_network(self):
conf = drive_config(path='/blockdomain/volume')
drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **conf)
# Migrate drive to network disk...
drive.path = "pool/volume"
drive.diskType = DISK_TYPE.NETWORK
self.assertEqual(DISK_TYPE.NETWORK, drive.diskType)
开发者ID:nirs,项目名称:vdsm,代码行数:7,代码来源:vmstorage_test.py
示例6: test_set_iotune
def test_set_iotune(self, iotune):
conf = drive_config(
serial='54-a672-23e5b495a9ea',
)
drive = Drive(self.log, **conf)
with self.assertRaises(Exception):
drive.iotune = iotune
开发者ID:EdDev,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例7: test_path_change_reset_threshold_state
def test_path_change_reset_threshold_state(self):
conf = drive_config(diskType=DISK_TYPE.BLOCK, path='/old/path')
drive = Drive(self.log, **conf)
# Simulating drive in SET state
drive.threshold_state = BLOCK_THRESHOLD.SET
drive.path = '/new/path'
self.assertEqual(drive.threshold_state, BLOCK_THRESHOLD.UNSET)
开发者ID:nirs,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例8: test_block_threshold_set_state
def test_block_threshold_set_state(self):
path = '/old/path'
conf = drive_config(diskType=DISK_TYPE.BLOCK, path=path)
drive = Drive(self.log, **conf)
drive.threshold_state = BLOCK_THRESHOLD.SET
drive.on_block_threshold(path)
self.assertEqual(drive.threshold_state, BLOCK_THRESHOLD.EXCEEDED)
开发者ID:nirs,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例9: test_migrate_network_to_block
def test_migrate_network_to_block(self):
conf = drive_config(diskType=DISK_TYPE.NETWORK, path='pool/volume')
drive = Drive(self.log, **conf)
self.assertTrue(drive.networkDev)
# Migrate drive to block domain...
drive.path = '/blockdomain/volume'
drive.diskType = None
self.assertTrue(drive.blockDev)
开发者ID:EdDev,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例10: test_migrate_from_block_to_network
def test_migrate_from_block_to_network(self):
conf = drive_config(path='/blockdomain/volume')
drive = Drive(self.log, **conf)
self.assertTrue(drive.blockDev)
# Migrate drive to network disk...
drive.path = "pool/volume"
drive.diskType = DISK_TYPE.NETWORK
self.assertFalse(drive.blockDev)
开发者ID:EdDev,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例11: test_migrate_from_block_to_file
def test_migrate_from_block_to_file(self):
conf = drive_config(path='/blockdomain/volume')
drive = Drive(self.log, **conf)
self.assertTrue(drive.blockDev)
# Migrate drive to file domain...
utils.isBlockDevice = lambda path: False
drive.path = "/filedomain/volume"
self.assertFalse(drive.blockDev)
开发者ID:EdDev,项目名称:vdsm,代码行数:8,代码来源:vmstorage_test.py
示例12: test_file
def test_file(self):
drive = Drive(self.log, **self.conf)
expected = """
<disk name='vda' snapshot='external' type='file'>
<source file='/image' type='file'/>
</disk>
"""
snap_info = {'path': '/image', 'device': 'disk'}
actual = drive.get_snapshot_xml(snap_info)
self.assertXMLEqual(vmxml.format_xml(actual), expected)
开发者ID:EdDev,项目名称:vdsm,代码行数:11,代码来源:vmstorage_test.py
示例13: check_leases
def check_leases(self, conf):
drive = Drive(self.log, **conf)
leases = list(drive.getLeasesXML())
self.assertEqual(1, len(leases))
xml = """
<lease>
<key>vol_id</key>
<lockspace>dom_id</lockspace>
<target offset="0" path="path" />
</lease>
"""
self.assertXMLEqual(vmxml.format_xml(leases[0]), xml)
开发者ID:EdDev,项目名称:vdsm,代码行数:12,代码来源:vmstorage_test.py
示例14: test_block
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)
开发者ID:EdDev,项目名称:vdsm,代码行数:12,代码来源:vmstorage_test.py
示例15: check_leases
def check_leases(self, conf):
drive = Drive(self.log, diskType=DISK_TYPE.FILE, **conf)
leases = list(drive.getLeasesXML())
self.assertEqual(1, len(leases))
xml = """
<lease>
<key>vol_id</key>
<lockspace>dom_id</lockspace>
<target offset="0" path="path" />
</lease>
"""
self.assertXMLEqual(xmlutils.tostring(leases[0]), xml)
开发者ID:nirs,项目名称:vdsm,代码行数:12,代码来源:vmstorage_test.py
示例16: make_env
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
)
开发者ID:EdDev,项目名称:vdsm,代码行数:52,代码来源:vmstorage_test.py
示例17: test_block
def test_block(self):
drive = Drive(self.log, diskType=DISK_TYPE.BLOCK, **self.conf)
expected = """
<disk name='vda' snapshot='external' type='block'>
<source dev='/dev/dm-1' type='block'>
<seclabel model="dac" relabel="no" type="none" />
</source>
</disk>
"""
snap_info = {'path': '/dev/dm-1', 'device': 'disk'}
actual = drive.get_snapshot_xml(snap_info)
self.assertXMLEqual(xmlutils.tostring(actual), expected)
开发者ID:nirs,项目名称:vdsm,代码行数:13,代码来源:vmstorage_test.py
示例18: test_network
def test_network(self):
drive = Drive(self.log, diskType=DISK_TYPE.NETWORK,
protocol='gluster', **self.conf)
expected = """
<disk name='vda' snapshot='external' type='network'>
<source protocol='gluster'
name='volume/11111111-1111-1111-1111-111111111111'
type='network'>
<host name="brick1.example.com" port="49152"
transport="tcp"/>
<host name="brick2.example.com" port="49153"
transport="tcp"/>
</source>
</disk>
"""
snap_info = {
'protocol': 'gluster',
'path': 'volume/11111111-1111-1111-1111-111111111111',
'diskType': 'network',
'device': 'disk',
'hosts': [
{
'name': 'brick1.example.com',
'port': '49152',
'transport': 'tcp'
},
{
'name': 'brick2.example.com',
'port': '49153',
'transport': 'tcp'
}
]
}
actual = drive.get_snapshot_xml(snap_info)
self.assertXMLEqual(xmlutils.tostring(actual), expected)
开发者ID:nirs,项目名称:vdsm,代码行数:36,代码来源:vmstorage_test.py
示例19: test_volume_missing
def test_volume_missing(self):
drive = Drive(self.log, diskType=DISK_TYPE.NETWORK, **self.conf)
with self.assertRaises(storage.VolumeNotFound):
drive.volume_target(
"FFFFFFFF-FFFF-FFFF-FFFF-000000000000",
self.actual_chain)
开发者ID:nirs,项目名称:vdsm,代码行数:6,代码来源:vmstorage_test.py
示例20: test_top_volume
def test_top_volume(self):
drive = Drive(self.log, diskType=DISK_TYPE.NETWORK, **self.conf)
actual = drive.volume_target(
"00000000-0000-0000-0000-000000000000",
self.actual_chain)
self.assertEqual(actual, None)
开发者ID:nirs,项目名称:vdsm,代码行数:6,代码来源:vmstorage_test.py
注:本文中的vdsm.virt.vmdevices.storage.Drive类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论