Add volume-attached resize revert server test
We have a test to confirm a volume-backed server but there
are subtle differences in how nova handles volume-backed servers
vs attached non-root volumes during a resize, and we regressed
that functionality recently because we don't have CI coverage
for it.
Trove CI jobs have a test for a non-root volume attached resize
confirm scenario but the resize revert scenario is not tested
in integration CI so a test is added for that here.
Depends-On: Ifc80d07d94311534fd9e7824ede9d09223a011c2
Change-Id: I9b8433bcbd45c2a0c5b38e17e3a86d3b0ac68d08
Related-Bug: #1737599
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 5c3e9f0..c5bd8cc 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -369,6 +369,41 @@
server = self.client.show_server(self.server_id)['server']
self.assertEqual(self.flavor_ref, server['flavor']['id'])
+ @decorators.idempotent_id('fbbf075f-a812-4022-bc5c-ccb8047eef12')
+ @testtools.skipUnless(CONF.compute_feature_enabled.resize,
+ 'Resize not available.')
+ @utils.services('volume')
+ def test_resize_server_revert_with_volume_attached(self):
+ # Tests attaching a volume to a server instance and then resizing
+ # the instance. Once the instance is resized, revert the resize which
+ # should move the instance and volume attachment back to the original
+ # compute host.
+
+ # Create a blank volume and attach it to the server created in setUp.
+ volume = self.create_volume()
+ server = self.client.show_server(self.server_id)['server']
+ self.attach_volume(server, volume)
+ # Now resize the server with the blank volume attached.
+ self.client.resize_server(self.server_id, self.flavor_ref_alt)
+ # Explicitly delete the server to get a new one for later
+ # tests. Avoids resize down race issues.
+ self.addCleanup(self.delete_server, self.server_id)
+ waiters.wait_for_server_status(
+ self.client, self.server_id, 'VERIFY_RESIZE')
+ # Now revert the resize which should move the instance and it's volume
+ # attachment back to the original source compute host.
+ self.client.revert_resize_server(self.server_id)
+ waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ # Make sure everything still looks OK.
+ server = self.client.show_server(self.server_id)['server']
+ # The flavor id is not returned in the server response after
+ # microversion 2.46 so handle that gracefully.
+ if server['flavor'].get('id'):
+ self.assertEqual(self.flavor_ref, server['flavor']['id'])
+ attached_volumes = server['os-extended-volumes:volumes_attached']
+ self.assertEqual(1, len(attached_volumes))
+ self.assertEqual(volume['id'], attached_volumes[0]['id'])
+
@decorators.idempotent_id('b963d4f1-94b3-4c40-9e97-7b583f46e470')
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting not available, backup not possible.')