mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #4597: Remove VM id from VR when VM is not active
(cherry picked from commit 68b6a1cb58c5aa7eccca76dd5414940780715fb7)
This commit is contained in:
parent
1d6e8e5be2
commit
a7fe7e5468
@ -230,6 +230,8 @@ void DispatchManager::free_vm_resources(VirtualMachine * vm)
|
||||
|
||||
int uid;
|
||||
int gid;
|
||||
int vrid = -1;
|
||||
int vmid;
|
||||
|
||||
vm->release_network_leases();
|
||||
vm->release_disk_images();
|
||||
@ -240,15 +242,35 @@ void DispatchManager::free_vm_resources(VirtualMachine * vm)
|
||||
vm->set_state(VirtualMachine::DONE);
|
||||
vmpool->update(vm);
|
||||
|
||||
vmid = vm->get_oid();
|
||||
uid = vm->get_uid();
|
||||
gid = vm->get_gid();
|
||||
tmpl = vm->clone_template();
|
||||
|
||||
if (vm->is_vrouter())
|
||||
{
|
||||
vrid = vm->get_vrouter_id();
|
||||
}
|
||||
|
||||
vm->unlock();
|
||||
|
||||
Quotas::vm_del(uid, gid, tmpl);
|
||||
|
||||
delete tmpl;
|
||||
|
||||
if (vrid != -1)
|
||||
{
|
||||
VirtualRouter* vr = vrouterpool->get(vrid, true);
|
||||
|
||||
if (vr != 0)
|
||||
{
|
||||
vr->del_vmid(vmid);
|
||||
|
||||
vrouterpool->update(vr);
|
||||
|
||||
vr->unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
Loading…
x
Reference in New Issue
Block a user