[SRU] Error in confirm_migration leaves stale allocations and 'confirming' migration state
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Matt Riedemann | ||
Pike |
Triaged
|
Medium
|
Unassigned | ||
Queens |
Fix Committed
|
Medium
|
Tony Breeds | ||
Rocky |
Fix Committed
|
Medium
|
Matt Riedemann | ||
Stein |
Fix Released
|
Medium
|
Matt Riedemann | ||
Ubuntu Cloud Archive |
Fix Released
|
Medium
|
Unassigned | ||
Queens |
Fix Released
|
Medium
|
Unassigned | ||
Rocky |
Fix Released
|
Medium
|
Unassigned | ||
Stein |
Fix Released
|
Medium
|
Unassigned | ||
Train |
Fix Released
|
Undecided
|
Unassigned | ||
nova (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Medium
|
Unassigned | ||
Cosmic |
Fix Released
|
Medium
|
Unassigned | ||
Disco |
Fix Released
|
Medium
|
Unassigned | ||
Eoan |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Description:
When performing a cold migration, if an exception is raised by the driver during confirm_migration (this runs in the source node), the migration record is stuck in "confirming" state and the allocations against the source node are not removed.
The instance is fine at the destination in this stage, but the source host has allocations that is not possible to clean without going to the database or invoking the Placement API via curl. After several migration attempts that fail in the same spot, the source node is filled with these allocations that prevent new instances from being created or instances migrated to this node.
When confirm_migration fails in this stage, the migrating instance can be saved through a hard reboot or a reset state to active.
Steps to reproduce:
Unfortunately, I don't have logs of the real root cause of the problem inside driver.
Expected results:
Discussed this issue with efried and mriedem over #openstack-nova on March 25th, 2019. They confirmed that allocations not being cleared up is a bug.
Actual results:
Instance is fine at the destination after a reset-state. Source node has stale allocations that prevent new instances from being created/migrated to the source node. Migration record is stuck in "confirming" state.
Environment:
I verified this bug on on pike, queens and stein branches. Running libvirt KVM driver.
=======
[Impact]
If users attempting to perform cold migrations face any issues when
the virt driver is running the "Confirm Migration" step, the failure leaves stale allocation records in the database, in migration records in "confirming" state. The stale allocations are not cleaned up by nova, consuming the user's quota indefinitely.
This bug was confirmed from pike to stein release, and a fix was implemented for queens, rocky and stein. It should be backported to those releases to prevent the issue from reoccurring.
This fix prevents new stale allocations being left over, by cleaning them up immediately when the failures occur. At the moment, the users affected by this bug have to clean their previous stale allocations manually.
[Test Case]
1. Reproducing the bug
1a. Inject failure
The root cause for this problem may vary for each driver and environment, so to reproduce the bug, it is necessary first to inject a failure in the driver's confirm_migration method to cause an exception to be raised.
An example when using libvirt is to add a line:
raise Exception("TEST")
1b. Restart nova-compute service: systemctl restart nova-compute
1c. Create a VM
1d. Then, invoke a cold migration: "openstack server migrate {id}"
1e. Wait for instance status: VERIFY_RESIZE
1f. Invoke "openstack server resize {id} --confirm"
1g. Wait for instance status: ERROR
1h. Check migration stuck in "confirming" status: nova migration-list
1i. Check allocations, you should see 2 allocations, one with the VM ID, the other with the migration uuid
export ENDPOINT=
export TOKEN=`openstack token issue| grep ' id '| awk '{print $4}'`
for id in $(curl -k -s -X GET $ENDPOINT/
2. Cleanup
2a. Delete the VM
2b. Delete the stale allocation:
export ID=<migration_uuid>
curl -k -s -X DELETE $ENDPOINT/
3. Install package that contains the fixed code
4. Confirm bug is fixed
4a. Repeat steps 1a through 1g
4b. Check migration with "error" status: nova migration-list
4c. Check allocations, you should see only 1 allocation with the VM ID
for id in $(curl -k -s -X GET $ENDPOINT/
5. Cleanup
5a. Delete the VM
[Regression Potential]
New functional test https:/
[Other Info]
None
Changed in nova: | |
assignee: | nobody → Matt Riedemann (mriedem) |
Changed in nova: | |
assignee: | Matt Riedemann (mriedem) → Eric Fried (efried) |
Changed in nova: | |
assignee: | Eric Fried (efried) → Matt Riedemann (mriedem) |
description: | updated |
description: | updated |
tags: | added: sts |
tags: | added: sts-sru-needed |
description: | updated |
summary: |
- Error in confirm_migration leaves stale allocations and 'confirming' - migration state + [SRU] Error in confirm_migration leaves stale allocations and + 'confirming' migration state |
Changed in nova (Ubuntu Eoan): | |
status: | New → Fix Committed |
tags: |
added: verification-done-cosmic removed: verification-needed-cosmic |
tags: |
added: verification-rocky-done removed: verification-rocky-needed |
tags: |
added: verification-done removed: verification-needed |
Changed in nova (Ubuntu Disco): | |
status: | Fix Committed → Fix Released |
tags: |
added: sts-sru-done removed: sts-sru-needed |
IRC discussion here:
http:// eavesdrop. openstack. org/irclogs/ %23openstack- nova/%23opensta ck-nova. 2019-03- 25.log. html#t2019- 03-25T13: 07:57
Setting the migration record status to error is easy, so I'll start with that. Refactoring the code to handle errors but still cleanup allocations is a bit more complicated, so that can be split into a separate change to close the bug.
Also note related bug 1793569 with some scripts for cleaning up orphaned allocations.