From 6a552f32feef1bb907866616cfb3a1053124dd15 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Sat, 23 Nov 2013 17:45:45 +0100 Subject: [PATCH] bug #2487: Always use the current system ds when resuming (cherry picked from commit bc98a3fa0237193e4854a4315bc349c3f9db3f1f) Conflicts: src/rm/RequestManagerVirtualMachine.cc --- include/VirtualMachine.h | 10 ++++++++++ src/rm/RequestManagerVirtualMachine.cc | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index df5645804d..c5954fa367 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -644,6 +644,16 @@ public: return previous_history->reason; }; + /** + * Returns the action that closed the current history record. The hasHisto + * function MUST be called before this one. + * @return the action that closed the current history record + */ + const History::VMAction get_action() const + { + return history->action; + }; + /** * Returns the action that closed the history record in the previous host * @return the action that closed the history record in the previous host diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 92f6ebfe29..e46b48a877 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -665,6 +665,32 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList, return; } + // ------------------------------------------------------------------------ + // Authorize request + // ------------------------------------------------------------------------ + + auth = vm_authorization(id, 0, 0, att, &host_perms, 0, auth_op); + + if (auth == false) + { + return; + } + + if ((vm = get_vm(id, att)) == 0) + { + return; + } + + if (vm->hasHistory() && + (vm->get_action() == History::STOP_ACTION || + vm->get_action() == History::UNDEPLOY_ACTION || + vm->get_action() == History::UNDEPLOY_HARD_ACTION)) + { + ds_id = vm->get_ds_id(); + } + + vm->unlock(); + // ------------------------------------------------------------------------ // Get information about the system DS to use (tm_mad) // ------------------------------------------------------------------------