本文整理汇总了Python中nova.db.ec2_volume_create函数的典型用法代码示例。如果您正苦于以下问题:Python ec2_volume_create函数的具体用法?Python ec2_volume_create怎么用?Python ec2_volume_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ec2_volume_create函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ec2_uuid_mapping
def test_ec2_uuid_mapping(self):
ec2_vol = db.ec2_volume_create(context.get_admin_context(), "aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa", 5)
self.assertEqual(5, ec2_vol["id"])
self.assertEqual(
"aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa", db.get_volume_uuid_by_ec2_id(context.get_admin_context(), 5)
)
ec2_vol = db.ec2_volume_create(context.get_admin_context(), "aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa", 1)
self.assertEqual(1, ec2_vol["id"])
ec2_vol = db.ec2_volume_create(context.get_admin_context(), "aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaazzz")
self.assertEqual(6, ec2_vol["id"])
示例2: test_ec2_uuid_mapping
def test_ec2_uuid_mapping(self):
ec2_vol = db.ec2_volume_create(context.get_admin_context(),
'aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa', 5)
self.assertEqual(5, ec2_vol['id'])
self.assertEqual('aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa',
db.get_volume_uuid_by_ec2_id(context.get_admin_context(), 5))
ec2_vol = db.ec2_volume_create(context.get_admin_context(),
'aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaaaaa', 1)
self.assertEqual(1, ec2_vol['id'])
ec2_vol = db.ec2_volume_create(context.get_admin_context(),
'aaaaaaaa-bbbb-bbbb-bbbb-aaaaaaaaazzz')
self.assertEqual(6, ec2_vol['id'])
示例3: get_int_id_from_volume_uuid
def get_int_id_from_volume_uuid(context, volume_uuid):
if volume_uuid is None:
return
try:
return db.get_ec2_volume_id_by_uuid(context, volume_uuid)
except exception.NotFound:
return db.ec2_volume_create(context, volume_uuid)['id']
示例4: create
def create(self, context):
if self.obj_attr_is_set('id'):
raise exception.ObjectActionError(action='create',
reason='already created')
db_vmap = db.ec2_volume_create(context, self.uuid)
self._from_db_object(context, self, db_vmap)
示例5: test_get_vol_mapping_non_admin
def test_get_vol_mapping_non_admin(self):
ref = db.ec2_volume_create(self.context, 'fake-uuid')
ec2_id = db.get_ec2_volume_id_by_uuid(self.context, 'fake-uuid')
self.assertEqual(ref['id'], ec2_id)