本文整理汇总了Python中cinder.tests.api.fakes.get_fake_uuid函数的典型用法代码示例。如果您正苦于以下问题:Python get_fake_uuid函数的具体用法?Python get_fake_uuid怎么用?Python get_fake_uuid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_fake_uuid函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_attach_in_used_volume_by_instance
def test_attach_in_used_volume_by_instance(self):
"""Test that attaching to an in-use volume fails."""
# admin context
ctx = context.RequestContext('admin', 'fake', True)
# current status is available
volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
'provider_location': '', 'size': 1})
connector = {'initiator': 'iqn.2012-07.org.fake:01'}
# start service to handle rpc messages for attach requests
svc = self.start_service('volume', host='test')
self.volume_api.reserve_volume(ctx, volume)
mountpoint = '/dev/vbd'
self.volume_api.attach(ctx, volume, stubs.FAKE_UUID, None,
mountpoint, 'rw')
conn_info = self.volume_api.initialize_connection(ctx,
volume, connector)
self.assertEqual(conn_info['data']['access_mode'], 'rw')
self.assertRaises(exception.InvalidVolume,
self.volume_api.attach,
ctx,
volume,
fakes.get_fake_uuid(),
None,
mountpoint,
'rw')
self.assertRaises(exception.InvalidVolume,
self.volume_api.attach,
ctx,
volume,
fakes.get_fake_uuid(),
None,
mountpoint,
'ro')
# cleanup
svc.stop()
示例2: test_attach_attaching_volume_with_different_mode
def test_attach_attaching_volume_with_different_mode(self):
"""Test that attaching volume reserved for another mode fails."""
# admin context
ctx = context.RequestContext('admin', 'fake', True)
# current status is available
volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
'provider_location': '', 'size': 1})
# start service to handle rpc messages for attach requests
svc = self.start_service('volume', host='test')
values = {'status': 'attaching',
'instance_uuid': fakes.get_fake_uuid()}
db.volume_update(ctx, volume['id'], values)
db.volume_admin_metadata_update(ctx, volume['id'],
{"attached_mode": 'rw'}, False)
mountpoint = '/dev/vbd'
self.assertRaises(exception.InvalidVolume,
self.volume_api.attach,
ctx,
volume,
values['instance_uuid'],
None,
mountpoint,
'ro')
# cleanup
svc.stop()
示例3: test_attach_in_used_volume_by_instance
def test_attach_in_used_volume_by_instance(self):
"""Test that attaching to an in-use volume fails."""
# admin context
ctx = context.RequestContext("admin", "fake", True)
# current status is available
volume = db.volume_create(ctx, {"status": "available", "host": "test", "provider_location": "", "size": 1})
connector = {"initiator": "iqn.2012-07.org.fake:01"}
# start service to handle rpc messages for attach requests
svc = self.start_service("volume", host="test")
self.volume_api.reserve_volume(ctx, volume)
mountpoint = "/dev/vbd"
self.volume_api.attach(ctx, volume, stubs.FAKE_UUID, None, mountpoint, "rw")
conn_info = self.volume_api.initialize_connection(ctx, volume, connector)
self.assertEqual(conn_info["data"]["access_mode"], "rw")
self.assertRaises(
exception.InvalidVolume, self.volume_api.attach, ctx, volume, fakes.get_fake_uuid(), None, mountpoint, "rw"
)
self.assertRaises(
exception.InvalidVolume, self.volume_api.attach, ctx, volume, fakes.get_fake_uuid(), None, mountpoint, "ro"
)
# cleanup
svc.stop()
示例4: test_attach_attaching_volume_with_different_instance
def test_attach_attaching_volume_with_different_instance(self):
"""Test that attaching volume reserved for another instance fails."""
ctx = context.RequestContext("admin", "fake", True)
# current status is available
volume = db.volume_create(ctx, {"status": "available", "host": "test", "provider_location": "", "size": 1})
# start service to handle rpc messages for attach requests
svc = self.start_service("volume", host="test")
values = {"status": "attaching", "instance_uuid": fakes.get_fake_uuid()}
db.volume_update(ctx, volume["id"], values)
mountpoint = "/dev/vbd"
self.assertRaises(
exception.InvalidVolume, self.volume_api.attach, ctx, volume, stubs.FAKE_UUID, None, mountpoint, "rw"
)
# cleanup
svc.stop()
示例5: test_attach_in_use_volume
def test_attach_in_use_volume(self):
"""Test that attaching to an in-use volume fails."""
# admin context
ctx = context.RequestContext('admin', 'fake', True)
# current status is available
volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
'provider_location': ''})
# start service to handle rpc messages for attach requests
self.start_service('volume', host='test')
self.volume_api.reserve_volume(ctx, volume)
self.volume_api.initialize_connection(ctx, volume, {})
mountpoint = '/dev/vbd'
self.volume_api.attach(ctx, volume, stubs.FAKE_UUID, mountpoint)
self.assertRaises(exception.InvalidVolume,
self.volume_api.attach,
ctx,
volume,
fakes.get_fake_uuid(),
mountpoint)
示例6: test_attach_attaching_volume_with_different_instance
def test_attach_attaching_volume_with_different_instance(self):
"""Test that attaching volume reserved for another instance fails."""
# admin context
ctx = context.RequestContext('admin', 'fake', True)
# current status is available
volume = db.volume_create(ctx, {'status': 'available', 'host': 'test',
'provider_location': ''})
# start service to handle rpc messages for attach requests
self.start_service('volume', host='test')
self.volume_api.initialize_connection(ctx, volume, {})
values = {'status': 'attaching',
'instance_uuid': fakes.get_fake_uuid()}
db.volume_update(ctx, volume['id'], values)
mountpoint = '/dev/vbd'
self.assertRaises(exception.InvalidVolume,
self.volume_api.attach,
ctx,
volume,
stubs.FAKE_UUID,
mountpoint)