本文整理汇总了Python中nova.block_device.properties_root_device_name函数的典型用法代码示例。如果您正苦于以下问题:Python properties_root_device_name函数的具体用法?Python properties_root_device_name怎么用?Python properties_root_device_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了properties_root_device_name函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_properties_root_defice_name
def test_properties_root_defice_name(self):
mappings = [{"device": "/dev/sda1", "virtual": "root"}]
properties0 = {"mappings": mappings}
properties1 = {"root_device_name": "/dev/sdb", "mappings": mappings}
root_device_name = block_device.properties_root_device_name(properties0)
self.assertEqual(root_device_name, "/dev/sda1")
root_device_name = block_device.properties_root_device_name(properties1)
self.assertEqual(root_device_name, "/dev/sdb")
开发者ID:renuka-apte,项目名称:nova,代码行数:10,代码来源:test_api.py
示例2: test_properties
def test_properties(self):
root_device0 = "/dev/sda"
root_device1 = "/dev/sdb"
mappings = [{"virtual": "root", "device": root_device0}]
properties0 = {"mappings": mappings}
properties1 = {"mappings": mappings, "root_device_name": root_device1}
self.assertIsNone(block_device.properties_root_device_name({}))
self.assertEqual(block_device.properties_root_device_name(properties0), root_device0)
self.assertEqual(block_device.properties_root_device_name(properties1), root_device1)
开发者ID:rrader,项目名称:nova,代码行数:11,代码来源:test_block_device.py
示例3: test_properties_root_defice_name
def test_properties_root_defice_name(self):
mappings = [{"device": "/dev/sda1", "virtual": "root"}]
properties0 = {'mappings': mappings}
properties1 = {'root_device_name': '/dev/sdb', 'mappings': mappings}
root_device_name = block_device.properties_root_device_name(
properties0)
self.assertEqual(root_device_name, '/dev/sda1')
root_device_name = block_device.properties_root_device_name(
properties1)
self.assertEqual(root_device_name, '/dev/sdb')
开发者ID:derekhiggins,项目名称:nova,代码行数:12,代码来源:test_api.py
示例4: test_properties
def test_properties(self):
root_device0 = '/dev/sda'
root_device1 = '/dev/sdb'
mappings = [{'virtual': 'root',
'device': root_device0}]
properties0 = {'mappings': mappings}
properties1 = {'mappings': mappings,
'root_device_name': root_device1}
self.assertIsNone(block_device.properties_root_device_name({}))
self.assertEqual(root_device0,
block_device.properties_root_device_name(properties0))
self.assertEqual(root_device1,
block_device.properties_root_device_name(properties1))
开发者ID:akashgangil,项目名称:nova,代码行数:15,代码来源:test_block_device.py
示例5: apply
def apply(self, context, resource):
if not resource.metadata:
resource.metadata = {}
if not resource.security_group:
resource.security_group = 'default'
if not resource.instance_type:
resource.instance_type = instance_types.get_default_instance_type()
if not resource.min_count:
resource.min_count = 1
if not resource.max_count:
resource.max_count = resource.min_count
resource.block_device_mapping = resource.block_device_mapping or []
if resource.instance_type['disabled']:
raise exception.InstanceTypeNotFound(
instance_type_id=resource.instance_type['id'])
if resource.user_data:
l = len(resource.user_data)
if l > MAX_USERDATA_SIZE:
# NOTE(mikal): user_data is stored in a text column, and
# the database might silently truncate if its over length.
raise exception.InstanceUserDataTooLarge(
length=l, maxsize=MAX_USERDATA_SIZE)
try:
base64.decodestring(resource.user_data)
except base64.binascii.Error:
raise exception.InstanceUserDataMalformed()
# Reserve quotas
resource.num_instances, resource.quota_reservations = \
self._check_num_instances_quota(context,
resource.instance_type,
resource.min_count,
resource.max_count)
self._check_metadata_properties_quota(context, resource.metadata)
self._check_injected_file_quota(context, resource.injected_files)
self._check_requested_networks(context, resource.requested_networks)
# Handle config_drive
resource.config_drive_id = None
if resource.config_drive and not utils.is_valid_boolstr(
resource.config_drive):
# config_drive is volume id
resource.config_drive_id = resource.config_drive
resource.config_drive = None
# Ensure config_drive image exists
cd_image_service, config_drive_id = \
glance.get_remote_image_service(context,
resource.config_drive_id)
cd_image_service.show(context, resource.config_drive_id)
if resource.key_data is None and resource.key_name:
resource.key_pair = self.db.key_pair_get(context, context.user_id,
resource.key_name)
resource.key_data = resource.key_pair['public_key']
resource.root_device_name = block_device.properties_root_device_name(
resource.image.get('properties', {}))
resource.availability_zone, resource.forced_host = \
self._handle_availability_zone(resource.availability_zone)
resource.system_metadata = instance_types.save_instance_type_info(
dict(), resource.instance_type)
return orc_utils.DictableObject(details='request_validated',
resource=resource)
开发者ID:rohit-k,项目名称:NovaOrc,代码行数:73,代码来源:compute.py
注:本文中的nova.block_device.properties_root_device_name函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论