本文整理汇总了Python中nova.block_device.mappings_prepend_dev函数的典型用法代码示例。如果您正苦于以下问题:Python mappings_prepend_dev函数的具体用法?Python mappings_prepend_dev怎么用?Python mappings_prepend_dev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mappings_prepend_dev函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_mapping_prepend_dev
def test_mapping_prepend_dev(self):
mappings = [
{'virtual': 'ami',
'device': 'sda1'},
{'virtual': 'root',
'device': '/dev/sda1'},
{'virtual': 'swap',
'device': 'sdb1'},
{'virtual': 'swap',
'device': '/dev/sdb2'},
{'virtual': 'ephemeral0',
'device': 'sdc1'},
{'virtual': 'ephemeral1',
'device': '/dev/sdc1'}]
expected_result = [
{'virtual': 'ami',
'device': 'sda1'},
{'virtual': 'root',
'device': '/dev/sda1'},
{'virtual': 'swap',
'device': '/dev/sdb1'},
{'virtual': 'swap',
'device': '/dev/sdb2'},
{'virtual': 'ephemeral0',
'device': '/dev/sdc1'},
{'virtual': 'ephemeral1',
'device': '/dev/sdc1'}]
self.assertDictListMatch(block_device.mappings_prepend_dev(mappings),
expected_result)
开发者ID:derekhiggins,项目名称:nova,代码行数:33,代码来源:test_api.py
示例2: _update_image_block_device_mapping
def _update_image_block_device_mapping(self, elevated_context,
instance_type, instance_uuid,
mappings):
"""tell vm driver to create ephemeral/swap device at boot time by
updating BlockDeviceMapping
"""
for bdm in block_device.mappings_prepend_dev(mappings):
LOG.debug(_("bdm %s"), bdm, instance_uuid=instance_uuid)
virtual_name = bdm['virtual']
if virtual_name == 'ami' or virtual_name == 'root':
continue
if not block_device.is_swap_or_ephemeral(virtual_name):
continue
size = self._volume_size(instance_type, virtual_name)
if size == 0:
continue
values = {
'instance_uuid': instance_uuid,
'device_name': bdm['device'],
'virtual_name': virtual_name,
'volume_size': size}
self.db.block_device_mapping_update_or_create(elevated_context,
values)
开发者ID:rohit-k,项目名称:NovaOrc,代码行数:27,代码来源:reserve_volumes.py
示例3: test_mapping_prepend_dev
def test_mapping_prepend_dev(self):
mappings = [
{"virtual": "ami", "device": "sda1"},
{"virtual": "root", "device": "/dev/sda1"},
{"virtual": "swap", "device": "sdb1"},
{"virtual": "swap", "device": "/dev/sdb2"},
{"virtual": "ephemeral0", "device": "sdc1"},
{"virtual": "ephemeral1", "device": "/dev/sdc1"},
]
expected_result = [
{"virtual": "ami", "device": "sda1"},
{"virtual": "root", "device": "/dev/sda1"},
{"virtual": "swap", "device": "/dev/sdb1"},
{"virtual": "swap", "device": "/dev/sdb2"},
{"virtual": "ephemeral0", "device": "/dev/sdc1"},
{"virtual": "ephemeral1", "device": "/dev/sdc1"},
]
self.assertDictListMatch(block_device.mappings_prepend_dev(mappings), expected_result)
开发者ID:renuka-apte,项目名称:nova,代码行数:18,代码来源:test_api.py
示例4: test_mappings_prepend_dev
def test_mappings_prepend_dev(self):
mapping = [
{'virtual': 'ami', 'device': '/dev/sda'},
{'virtual': 'root', 'device': 'sda'},
{'virtual': 'ephemeral0', 'device': 'sdb'},
{'virtual': 'swap', 'device': 'sdc'},
{'virtual': 'ephemeral1', 'device': 'sdd'},
{'virtual': 'ephemeral2', 'device': 'sde'}]
expected = [
{'virtual': 'ami', 'device': '/dev/sda'},
{'virtual': 'root', 'device': 'sda'},
{'virtual': 'ephemeral0', 'device': '/dev/sdb'},
{'virtual': 'swap', 'device': '/dev/sdc'},
{'virtual': 'ephemeral1', 'device': '/dev/sdd'},
{'virtual': 'ephemeral2', 'device': '/dev/sde'}]
prepended = block_device.mappings_prepend_dev(mapping)
self.assertEqual(prepended.sort(), expected.sort())
开发者ID:aaaaatoz,项目名称:nova,代码行数:19,代码来源:test_block_device.py
示例5: test_mappings_prepend_dev
def test_mappings_prepend_dev(self):
mapping = [
{"virtual": "ami", "device": "/dev/sda"},
{"virtual": "root", "device": "sda"},
{"virtual": "ephemeral0", "device": "sdb"},
{"virtual": "swap", "device": "sdc"},
{"virtual": "ephemeral1", "device": "sdd"},
{"virtual": "ephemeral2", "device": "sde"},
]
expected = [
{"virtual": "ami", "device": "/dev/sda"},
{"virtual": "root", "device": "sda"},
{"virtual": "ephemeral0", "device": "/dev/sdb"},
{"virtual": "swap", "device": "/dev/sdc"},
{"virtual": "ephemeral1", "device": "/dev/sdd"},
{"virtual": "ephemeral2", "device": "/dev/sde"},
]
prepended = block_device.mappings_prepend_dev(mapping)
self.assertEqual(prepended.sort(), expected.sort())
开发者ID:rrader,项目名称:nova,代码行数:21,代码来源:test_block_device.py
注:本文中的nova.block_device.mappings_prepend_dev函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论