# attach admin context to request
req.environ['cinder.context'] = ctx
# start service to handle rpc.cast for 'delete snapshot'
- self.start_service('volume', host='test')
+ svc = self.start_service('volume', host='test')
# make request
resp = req.get_response(app())
# request is accepted
# snapshot is deleted
self.assertRaises(exception.NotFound, db.snapshot_get, ctx,
snapshot['id'])
+ # cleanup
+ svc.stop()
def test_force_detach_volume(self):
# admin context
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')
+ svc = self.start_service('volume', host='test')
self.volume_api.reserve_volume(ctx, volume)
self.volume_api.initialize_connection(ctx, volume, {})
mountpoint = '/dev/vbd'
self.assertEquals(volume['instance_uuid'], None)
self.assertEquals(volume['mountpoint'], None)
self.assertEquals(volume['attach_status'], 'detached')
+ # cleanup
+ svc.stop()
def test_attach_in_use_volume(self):
"""Test that attaching to an in-use volume fails."""
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')
+ svc = self.start_service('volume', host='test')
self.volume_api.reserve_volume(ctx, volume)
self.volume_api.initialize_connection(ctx, volume, {})
mountpoint = '/dev/vbd'
volume,
fakes.get_fake_uuid(),
mountpoint)
+ # cleanup
+ svc.stop()
def test_attach_attaching_volume_with_different_instance(self):
"""Test that attaching volume reserved for another instance fails."""
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')
+ svc = self.start_service('volume', host='test')
self.volume_api.initialize_connection(ctx, volume, {})
values = {'status': 'attaching',
'instance_uuid': fakes.get_fake_uuid()}
volume,
stubs.FAKE_UUID,
mountpoint)
+ # cleanup
+ svc.stop()