From a5e1331aecfd216edffbea0f836a66eeb9dac648 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Mon, 15 Oct 2018 15:34:40 +0200 Subject: [PATCH] =?UTF-8?q?F=20#1246=20Add=20recover=20--delete-db=20optio?= =?UTF-8?q?n=20co-authored-by:=20Christian=20Gonz=C3=A1lez=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 1dd6cab6af088324d7aaf7d5d67775d33d7f950f) --- include/DispatchManager.h | 11 ++++- include/VirtualMachine.h | 3 +- src/cli/onevm | 13 ++++- src/dm/DispatchManagerActions.cc | 55 +++++++++++++++++++--- src/dm/DispatchManagerStates.cc | 2 +- src/oca/ruby/opennebula/virtual_machine.rb | 2 +- src/rm/RequestManagerVirtualMachine.cc | 4 ++ src/vm/VirtualMachine.cc | 20 ++++++-- 8 files changed, 94 insertions(+), 16 deletions(-) diff --git a/include/DispatchManager.h b/include/DispatchManager.h index 194e4484b8..a1c4759d51 100644 --- a/include/DispatchManager.h +++ b/include/DispatchManager.h @@ -296,6 +296,15 @@ public: int delete_recreate(VirtualMachine * vm, const RequestAttributes& ra, string& error_str); + /** + * Ends a VM life cycle inside ONE but let the VM running at the Hipervisor. + * @param vm VirtualMachine object + * @param ra information about the API call request + * @return 0 on success, the VM mutex is unlocked + */ + int delete_vm_db(VirtualMachine * vm, const RequestAttributes& ra, + string& error_str); + /** * Recover the last operation on the VM * @param vm VirtualMachine object @@ -541,7 +550,7 @@ private: /** * Frees the resources associated to a VM: disks, ip addresses and Quotas */ - void free_vm_resources(VirtualMachine * vm); + void free_vm_resources(VirtualMachine * vm, bool check_images); //-------------------------------------------------------------------------- // DM Actions associated with a VM state transition diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index c99f0e3679..ffbd85f3d3 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -1045,8 +1045,9 @@ public: /** * Releases all disk images taken by this Virtual Machine * @param quotas disk space to free from image datastores + * @param check_state to update image state based on VM state */ - void release_disk_images(vector