M #-: Fix host capacity accounting for datastore-only migrations

Only add or remove host capacity during migrations when the VM changes
hosts. Datastore-only migrations keep the existing host allocation, to
prevent removing the VM from the host VM collection.

(cherry picked from commit 23aba3ee81)
This commit is contained in:
Ruben S. Montero committed 2026-07-23 23:34:16 +02:00
1 parent df32c83bb8
commit ee9d5e3c68
3 files changed
+24 -8

No files matched your search

+2 -1
View File
@@ -1009,7 +1009,8 @@ Request::ErrorCode VirtualMachineAPI::migrate(int vid,
}
// Check the host has enough capacity
if (check_host(hid, enforce, vm.get(), att.resp_msg) == false)
if (c_hid != hid &&
check_host(hid, enforce, vm.get(), att.resp_msg) == false)
{
return Request::ACTION;
}