Handle missing marker during online data migration
During upgrade the instance used by the request spec marker could be deleted and purged between sessions. This would cause the database online data migration to fail as the marker instance couldn't be found. Fix by handling the MarkerNotFound exception and re-trying without the marker. This will go through all the instances and reset the marker when done. Closes-Bug: #1793419 Change-Id: If96e3d038346f16cc93209bccf3db028bacfe59b Signed-off-by: Jack Ding <jack.ding@windriver.com> (cherry picked from commitff03b157b9) (cherry picked from commit57b46754ff)
This commit is contained in:
committed by
Matt Riedemann
parent
a48c1123cd
commit
164b1ba301
@@ -645,13 +645,17 @@ def migrate_instances_add_request_spec(context, max_count):
|
||||
# Prevent lazy-load of those fields for every instance later.
|
||||
attrs = ['system_metadata', 'flavor', 'pci_requests', 'numa_topology',
|
||||
'availability_zone']
|
||||
instances = objects.InstanceList.get_by_filters(context,
|
||||
filters={'deleted': False},
|
||||
sort_key='created_at',
|
||||
sort_dir='asc',
|
||||
limit=max_count,
|
||||
marker=marker,
|
||||
expected_attrs=attrs)
|
||||
try:
|
||||
instances = objects.InstanceList.get_by_filters(
|
||||
context, filters={'deleted': False}, sort_key='created_at',
|
||||
sort_dir='asc', limit=max_count, marker=marker,
|
||||
expected_attrs=attrs)
|
||||
except exception.MarkerNotFound:
|
||||
# Instance referenced by marker may have been purged.
|
||||
# Try again but get all instances.
|
||||
instances = objects.InstanceList.get_by_filters(
|
||||
context, filters={'deleted': False}, sort_key='created_at',
|
||||
sort_dir='asc', limit=max_count, expected_attrs=attrs)
|
||||
count_all = len(instances)
|
||||
count_hit = 0
|
||||
for instance in instances:
|
||||
|
||||
Reference in New Issue
Block a user