1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00
B #5263 Removed 'PORT' from VM when undeploy the VM
This commit is contained in:
juanmont 2017-09-05 13:37:24 +02:00 committed by Ruben S. Montero
parent 6faed83d43
commit 1bd3d61354
2 changed files with 17 additions and 7 deletions

View File

@ -497,6 +497,7 @@ void LifeCycleManager::shutdown_action(const LCMAction& la, bool hard)
void LifeCycleManager::undeploy_action(const LCMAction& la, bool hard)
{
int vid = la.vm_id();
unsigned int port;
VirtualMachine * vm = vmpool->get(vid,true);
if ( vm == 0 )
@ -531,6 +532,14 @@ void LifeCycleManager::undeploy_action(const LCMAction& la, bool hard)
vmm->trigger(VMMAction::SHUTDOWN,vid);
}
VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS");
if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0))
{
graphics->remove("PORT");
clpool->release_vnc_port(vm->get_cid(), port);
}
vmpool->update_history(vm);
vmpool->update(vm);

View File

@ -924,7 +924,15 @@ void LifeCycleManager::epilog_success_action(int vid)
vm->set_etime(the_time);
vm->set_vm_info();
VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS");
if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0))
{
graphics->remove("PORT");
clpool->release_vnc_port(vm->get_cid(), port);
}
vmpool->update_history(vm);
vmpool->update(vm);
@ -933,13 +941,6 @@ void LifeCycleManager::epilog_success_action(int vid)
hpool->del_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk, pci);
const VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS");
if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0))
{
clpool->release_vnc_port(vm->get_cid(), port);
}
//----------------------------------------------------
dm->trigger(action,vid);