You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed cross-cluster VM migration rollback leaks target cluster quota and decrements source cluster quota #8191
Description
In VirtualMachineAPI::migrate (src/rm/api/VirtualMachineAPI.cc), when migrating a VM across clusters (c_cluster_id != cluster_id), lines 1173-1183 authorize quota on the target cluster_id and then set quota_tmpl.replace("CLUSTER_ID", c_cluster_id) before calling quota_rollback on the source cluster.
If add_history (lines 1205-1210) or dm->migrate / dm->live_migrate (lines 1234-1239) subsequently fails, the rollback block executes:
Because quota_tmpl still has CLUSTER_ID set to c_cluster_id, Quotas::vm_add adds the usage back to c_cluster_id and Quotas::vm_del immediately subtracts it from c_cluster_id again instead of subtracting it from cluster_id.
To Reproduce
Initiate a cross-cluster VM migration (c_cluster_id != cluster_id) that fails at dm->migrate or dm->live_migrate.
Inspect the user/group cluster quota usage for both clusters: the source cluster loses the VM quota and the target cluster retains the leaked VM quota.
Expected behavior
Before calling Quotas::vm_del(vm_perms.uid, vm_perms.gid, "a_tmpl) in both rollback blocks, quota_tmpl.replace("CLUSTER_ID", cluster_id) should be called so the target cluster quota is released while the source cluster quota remains restored.
Activity
B #8191: Restore target CLUSTER_ID on failed migration quota rollback
B OpenNebula/one#8183, OpenNebula/one#8191, OpenNebula/one#8194, Open…