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
test_set_capacity does not restore Host capacity or VM template on failed VM resize #8185
Description
In test_set_capacity() (src/dm/DispatchManagerActions.cc, lines 2763-2805), when resizing a VM that is already assigned to a host (POWEROFF, SUSPENDED, or ACTIVE/RUNNING), host->del_capacity(sr) is called on the cached Host object in HostPool before vm->resize(cpu, mem, vcpu, error) and host->test_capacity(sr, error, enforce).
If vm->resize() returns -1 or host->test_capacity() returns false, test_set_capacity() returns -1 without calling host->add_capacity(old_sr) and without reverting vm->resize(). Because host and vm are cached entries in HostPool / VirtualMachinePool, the host's in-memory cpu_usage, mem_usage, running_vms and vm_collection stay decremented (and dropping a RUNNING VM from host->vm_collection causes the next host monitor poll to report it as a zombie VM), while the cached VirtualMachine template keeps the new CPU/MEMORY/VCPU values in memory.
Also, host->test_capacity(sr, error, enforce) checks both sr.cpu and sr.mem unconditionally (HostShare::test_capacity), so increasing only CPU/VCPU (with unchanged or reduced MEMORY) on a host where mem_usage > max_mem fails with Not enough memory.
To Reproduce
Have a VM in POWEROFF or RUNNING on a host.
Run onevm resize <vid> --memory <larger_than_host_free_mem> --enforce so host->test_capacity() fails.
onehost show <hid> shows the VM's capacity and <VMS><ID> entry removed from the host, and onevm show <vid> shows the new MEMORY in the cached template.
Expected behavior
Failed vm->resize() or host->test_capacity() in test_set_capacity() should restore host->add_capacity(old_sr) and revert the in-memory VM template attributes, and host->test_capacity() should only check resources (cpu / mem) that increase during the resize.
Details
Affected Component: Core (DM)
Hypervisor: Any
Version: 6.10, 7.0, master
Progress Status
Code committed
Testing - QA
Documentation (Release notes - resolved issues, compatibility, known issues)
Activity
B OpenNebula#8185: Validate topology before mutating VM template and …
B OpenNebula#8185: Roll back host capacity on failed VM resize and ch…
B OpenNebula#8185: Roll back host capacity on failed VM resize and ch…
B OpenNebula#8185: Roll back host capacity on failed VM resize and ch…