Commit d308a91
committed
CA-422282 Fix race condition about xenops cache
There is race condition about vm cache between pool_migrate_complete
and VM event.
In the cross-pool migration case, it is designed to create vm with
power_state Halted in XAPI db. In pool_migrate_complete, add_caches
create an empty xenops_chae for the VM, then refresh_vm compares the
cache powerstate None with its real state Running to update the
right powerstate to XAPI db.
In the fail case, it is found that:
-> VM event 1 update_vm
-> pool_migrate_complete add_caches (cache power_state None)
-> pool_migrate_complete refresh_vm
-> VM event 1 update cache (cache power_state Running)
-> VM event 2 update_vm (Running <-> Running, XAPI DB not update)
When pool_migrate_complete add_caches, the cache update of previous
VM event 1 breaks the design intention.
This commit add a wait in pool_migrate_complete to ensure all
in-flight events complete before add_caches. Then there will be no
race condition.
Signed-off-by: Changlei Li <changlei.li@cloud.com>1 parent 1878ccc commit d308a91
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
495 | 496 | | |
496 | 497 | | |
497 | 498 | | |
| |||
0 commit comments