Fix test_volume_swap_with_multiattach
Nova change https://review.openstack.org/572790/ is fixing a bug such that the compute API would allow people to swap from a multiattach volume with multiple read/write attachments, which could lead to data loss if the secondary attachment is writing to the source volume while it's being copied to the target volume. As a result, test_volume_swap_with_multiattach needs to be changed such that the volume we're swapping from has only read-only attachments. Change-Id: Ida387c600016b451e01118bc2c76662b46670288 Related-Bug: #1775418
This commit is contained in:
parent
3639f91c36
commit
1bbfa121b3
@ -142,6 +142,12 @@ class TestMultiAttachVolumeSwap(TestVolumeSwapBase):
|
||||
if not CONF.compute_feature_enabled.volume_multiattach:
|
||||
raise cls.skipException('Volume multi-attach is not available.')
|
||||
|
||||
@classmethod
|
||||
def setup_clients(cls):
|
||||
super(TestMultiAttachVolumeSwap, cls).setup_clients()
|
||||
# Need this to set readonly volumes.
|
||||
cls.admin_volumes_client = cls.os_admin.volumes_client_latest
|
||||
|
||||
# NOTE(mriedem): This is an uncommon scenario to call the compute API
|
||||
# to swap volumes directly; swap volume is primarily only for volume
|
||||
# live migration and retype callbacks from the volume service, and is slow
|
||||
@ -162,6 +168,13 @@ class TestMultiAttachVolumeSwap(TestVolumeSwapBase):
|
||||
# volumes cleanup can happen successfully irrespective of which volume
|
||||
# is attached to server.
|
||||
volume1 = self.create_volume(multiattach=True)
|
||||
# Make volume1 read-only since you can't swap from a volume with
|
||||
# multiple read/write attachments, and you can't change the readonly
|
||||
# flag on an in-use volume so we have to do this before attaching
|
||||
# volume1 to anything. If the compute API ever supports per-attachment
|
||||
# attach modes, then we can handle this differently.
|
||||
self.admin_volumes_client.update_volume_readonly(
|
||||
volume1['id'], readonly=True)
|
||||
volume2 = self.create_volume(multiattach=True)
|
||||
|
||||
# Create two servers and wait for them to be ACTIVE.
|
||||
|
Loading…
x
Reference in New Issue
Block a user