Merge "Don't persist RequestSpec.retry" into stable/pike

This commit is contained in:
Zuul 2018-04-20 05:24:08 +00:00 committed by Gerrit Code Review
commit c566b91cf7
3 changed files with 13 additions and 13 deletions

View File

@ -506,6 +506,9 @@ class RequestSpec(base.NovaObject):
if 'instance_group' in spec and spec.instance_group:
spec.instance_group.members = None
spec.instance_group.hosts = None
# NOTE(mriedem): Don't persist retries since those are per-request
if 'retry' in spec and spec.retry:
spec.retry = None
db_updates = {'spec': jsonutils.dumps(spec.obj_to_primitive())}
if 'instance_uuid' in updates:

View File

@ -143,17 +143,13 @@ class TestRequestSpecRetryReschedule(test.TestCase,
data = {'os-migrateLive': {'host': 'host2', 'block_migration': 'auto'}}
self.admin_api.post_server_action(server['id'], data)
server = self._wait_for_state_change(self.admin_api, server, 'ACTIVE')
# FIXME(mriedem): This is bug 1718512 where the failed resize left
# host2 in the RequestSpec.retry field and it affects the live migrate
# to host2 because the scheduler RetryFilter kicks it out.
self.assertEqual('host3', server['OS-EXT-SRV-ATTR:host'])
migrations = self.admin_api.api_get(
'os-migrations?instance_uuid=%s&migration_type=live-migration' %
server['id']).body['migrations']
self.assertEqual(1, len(migrations))
self.assertEqual('error', migrations[0]['status'])
self.assertEqual('host2', server['OS-EXT-SRV-ATTR:host'])
# NOTE(mriedem): The instance status effectively goes to ACTIVE before
# the migration status is changed to "completed" since
# post_live_migration_at_destination changes the instance status
# and _post_live_migration changes the migration status later. So we
# need to poll the migration record until it's complete or we timeout.
self._wait_for_migration_status(server, 'completed')
reqspec = objects.RequestSpec.get_by_instance_uuid(
nova_context.get_admin_context(), server['id'])
self.assertIsNotNone(reqspec.retry)
self.assertEqual(1, reqspec.retry.num_attempts)
self.assertEqual('host2', reqspec.retry.hosts[0].host)
self.assertIsNone(reqspec.retry)

View File

@ -535,13 +535,14 @@ class _TestRequestSpecObject(object):
# object fields
for field in ['image', 'numa_topology', 'pci_requests', 'flavor',
'retry', 'limits']:
'limits']:
self.assertEqual(
getattr(req_obj, field).obj_to_primitive(),
getattr(serialized_obj, field).obj_to_primitive())
self.assertIsNone(serialized_obj.instance_group.members)
self.assertIsNone(serialized_obj.instance_group.hosts)
self.assertIsNone(serialized_obj.retry)
def test_create(self):
req_obj = fake_request_spec.fake_spec_obj(remove_id=True)