From 56339a50f30f86ff36108a4d5dd6e17b0bfbe64c Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Wed, 18 Oct 2017 17:51:03 +0200 Subject: [PATCH] B #5465: Do not free VNC ports on STOP and do not reassgin them on resume --- src/lcm/LifeCycleStates.cc | 8 +++++--- src/rm/RequestManagerVirtualMachine.cc | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 58d83b3a17..7dd06df3b2 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -924,15 +924,17 @@ 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)) + //Do not free VNC ports for STOP as it is stored in checkpoint file + if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0) && + state != VirtualMachine::EPILOG_STOP ) { graphics->remove("PORT"); clpool->release_vnc_port(vm->get_cid(), port); } - + vmpool->update_history(vm); vmpool->update(vm); diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 157b06b70d..60ae79e238 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -682,6 +682,11 @@ int set_vnc_port(VirtualMachine *vm, int cluster_id, RequestAttributes& att) { return 0; } + else if (vm->hasPreviousHistory() && + vm->get_previous_action() == History::STOP_ACTION) + { + return 0; + } else if (graphics->vector_value("PORT", port) == 0) { rc = cpool->set_vnc_port(cluster_id, port);