Skip to content

Commit 94d3743

Browse files
committed
Add functional recreate test for bug 1852610
It is possible to delete a source compute service which has pending migration-based allocations and servers in VERIFY_RESIZE status. Doing so deletes the compute service and compute node but orphans the source node resource provider along with its resource allocations held by the migration record while there is a pending resized server. This adds a simple cold migrate test which deletes the source compute service while the server is in VERIFY_RESIZE status and then tries to confirm the resize which fails. Change-Id: I644608b4e197ddea31c5f264adb492f2c8931f04 Related-Bug: #1852610
1 parent 8f341eb commit 94d3743

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

nova/tests/functional/wsgi/test_services.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,41 @@ def test_evacuate_then_delete_compute_service(self):
175175
self.assertIn('Error updating resources for node host1.', log_output)
176176
self.assertIn('Failed to create resource provider host1', log_output)
177177

178+
def test_migrate_confirm_after_deleted_source_compute(self):
179+
"""Tests a scenario where a server is cold migrated and while in
180+
VERIFY_RESIZE status the admin attempts to delete the source compute
181+
and then the user tries to confirm the resize.
182+
"""
183+
# Start a compute service and create a server there.
184+
self._start_compute('host1')
185+
host1_rp_uuid = self._get_provider_uuid_by_host('host1')
186+
flavor = self.api.get_flavors()[0]
187+
server = self._boot_and_check_allocations(flavor, 'host1')
188+
# Start a second compute service so we can cold migrate there.
189+
self._start_compute('host2')
190+
host2_rp_uuid = self._get_provider_uuid_by_host('host2')
191+
# Cold migrate the server to host2.
192+
self._migrate_and_check_allocations(
193+
server, flavor, host1_rp_uuid, host2_rp_uuid)
194+
# Delete the source compute service.
195+
service = self.admin_api.get_services(
196+
binary='nova-compute', host='host1')[0]
197+
self.admin_api.api_delete('/os-services/%s' % service['id'])
198+
# FIXME(mriedem): This is bug 1852610 where the compute service is
199+
# deleted but the resource provider is not because there are still
200+
# migration-based allocations against the source node provider.
201+
resp = self.placement_api.get('/resource_providers/%s' % host1_rp_uuid)
202+
self.assertEqual(200, resp.status)
203+
self.assertFlavorMatchesUsage(host1_rp_uuid, flavor)
204+
# Now try to confirm the migration.
205+
# FIXME(mriedem): This will fail until bug 1852610 is fixed and the
206+
# source compute service delete is blocked while there is an
207+
# in-progress migration involving the node.
208+
self.assertNotIn('ComputeHostNotFound', self.stdlog.logger.output)
209+
self.api.post_server_action(server['id'], {'confirmResize': None})
210+
self._wait_for_state_change(self.api, server, 'ERROR')
211+
self.assertIn('ComputeHostNotFound', self.stdlog.logger.output)
212+
178213

179214
class ComputeStatusFilterTest(integrated_helpers.ProviderUsageBaseTestCase):
180215
"""Tests the API, compute service and Placement interaction with the

0 commit comments

Comments
 (0)