Actually attach a volume to an instance before taking snapshot
In the test test_snapshot_create_with_volume_in_use, the test calls Cinder "os-attach" for attaching a volume. The "os-attach" to tell Cinder the volume is attached, but the API doesn't actually attach the volume to an instance.(Only update volume status in DB) This is not right test case for taking a snapshot with in-use volume. In this test, Nova "os-volume_attachment" should be called for volume attachment. Also, some Cinder drivers fails assisted snapshot due to this problem. In order to perform the snapshot properly, this fix is needed. Closes-Bug #1401110 Change-Id: Ib31e351fe7c3d27824241cf142c213eae287483f
This commit is contained in:
parent
16b6826b94
commit
ab667960ef
|
@ -70,11 +70,14 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest):
|
|||
self.addCleanup(self.servers_client.delete_server, server['id'])
|
||||
self.servers_client.wait_for_server_status(server['id'], 'ACTIVE')
|
||||
mountpoint = '/dev/%s' % CONF.compute.volume_device_name
|
||||
_, body = self.volumes_client.attach_volume(
|
||||
self.volume_origin['id'], server['id'], mountpoint)
|
||||
_, body = self.servers_client.attach_volume(
|
||||
server['id'], self.volume_origin['id'], mountpoint)
|
||||
self.volumes_client.wait_for_volume_status(self.volume_origin['id'],
|
||||
'in-use')
|
||||
self.addCleanup(self._detach, self.volume_origin['id'])
|
||||
self.addCleanup(self.volumes_client.wait_for_volume_status,
|
||||
self.volume_origin['id'], 'available')
|
||||
self.addCleanup(self.servers_client.detach_volume, server['id'],
|
||||
self.volume_origin['id'])
|
||||
# Snapshot a volume even if it's attached to an instance
|
||||
snapshot = self.create_snapshot(self.volume_origin['id'],
|
||||
force=True)
|
||||
|
|
Loading…
Reference in New Issue