16
16
17
17
from nova import context
18
18
from nova import objects
19
- from nova .tests .functional .api import client
20
19
from nova .tests .functional import integrated_helpers
21
20
from nova .tests .functional .libvirt import base
22
21
from nova .virt import block_device as driver_block_device
@@ -28,9 +27,9 @@ class TestLibvirtROMultiattachMigrate(
28
27
):
29
28
"""Regression test for bug 1939545
30
29
31
- This regression test asserts the current broken behaviour of Nova during
30
+ This regression test asserts the now fixed behaviour of Nova during
32
31
a Cinder orchestrated volume migration that leaves the stashed
33
- connection_info of the attachment pointing at a now deleted temporary
32
+ connection_info of the attachment pointing at the original
34
33
volume UUID used during the migration.
35
34
36
35
This is slightly different to the Nova orchestrated pure swap_volume
@@ -83,6 +82,10 @@ def test_ro_multiattach_swap_volume(self):
83
82
self .assertEqual (
84
83
self .cinder .MULTIATTACH_RO_SWAP_NEW_VOL ,
85
84
connection_info ['data' ]['volume_id' ])
85
+ self .assertIn ('volume_id' , connection_info )
86
+ self .assertEqual (
87
+ self .cinder .MULTIATTACH_RO_SWAP_NEW_VOL ,
88
+ connection_info ['volume_id' ])
86
89
self .assertIn ('serial' , connection_info )
87
90
self .assertEqual (
88
91
self .cinder .MULTIATTACH_RO_SWAP_NEW_VOL ,
@@ -123,39 +126,26 @@ def test_ro_multiattach_migrate_volume(self):
123
126
server_id )
124
127
connection_info = jsonutils .loads (bdm .connection_info )
125
128
126
- # FIXME(lyarwood): This is bug #1943431 where only the serial within
127
- # the connection_info of the temporary volume has been updated to point
128
- # to the old volume UUID with the stashed volume_id provided by the
129
- # backend still pointing to the temporary volume UUID that has now been
130
- # deleted by cinder.
129
+ # Assert that only the old volume UUID is referenced within the stashed
130
+ # connection_info and returned by driver_block_device.get_volume_id
131
131
self .assertIn ('serial' , connection_info )
132
132
self .assertEqual (
133
133
self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL ,
134
134
connection_info .get ('serial' ))
135
+ self .assertIn ('volume_id' , connection_info )
136
+ self .assertEqual (
137
+ self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL ,
138
+ connection_info ['volume_id' ])
135
139
self .assertIn ('volume_id' , connection_info .get ('data' ))
136
140
self .assertEqual (
137
- self .cinder .MULTIATTACH_RO_MIGRATE_NEW_VOL ,
141
+ self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL ,
138
142
connection_info ['data' ]['volume_id' ])
139
143
self .assertEqual (
140
- self .cinder .MULTIATTACH_RO_MIGRATE_NEW_VOL ,
144
+ self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL ,
141
145
driver_block_device .get_volume_id (connection_info ))
142
146
143
- # FIXME(lyarwood): As a result of the above any request to detach the
144
- # migrated multiattach volume from the instance or any action that
145
- # would cause the _disconnect_volume and _should_disconnect_target
146
- # logic to trigger in the libvirt driver will fail as
147
- # driver_block_device.get_volume_id points to the now deleted temporary
148
- # volume used during the migration.
149
- #
150
- # Replace this with the following once fixed:
151
- #
152
- # self.api.delete_server_volume(
153
- # server_id, self.cinder.MULTIATTACH_RO_MIGRATE_OLD_VOL)
154
- # self._wait_for_volume_detach(
155
- # server_id, self.cinder.MULTIATTACH_RO_MIGRATE_OLD_VOL)
156
- ex = self .assertRaises (
157
- client .OpenStackApiException ,
158
- self .api .delete_server_volume ,
159
- server_id ,
160
- self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL )
161
- self .assertEqual (500 , ex .response .status_code )
147
+ # Assert that the old volume can be detached from the instance
148
+ self .api .delete_server_volume (
149
+ server_id , self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL )
150
+ self ._wait_for_volume_detach (
151
+ server_id , self .cinder .MULTIATTACH_RO_MIGRATE_OLD_VOL )
0 commit comments