From 7831797444f50bb185f60149ad82c7fb75b70560 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Fri, 21 Aug 2015 17:34:03 +0200 Subject: [PATCH] Bug #3876: Fix erasing VMs in pending --- src/dm/DispatchManagerActions.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 9e65a30835..9945e3256b 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -772,14 +772,16 @@ int DispatchManager::finalize( ostringstream oss; VirtualMachine::VmState state; - bool is_public_host; + bool is_public_host = false; vm = vmpool->get(vid,true); - host = hpool->get(vm->get_hid(),true); - is_public_host = host->is_public_cloud(); - host->unlock(); - + if(vm->hasHistory()) + { + host = hpool->get(vm->get_hid(),true); + is_public_host = host->is_public_cloud(); + host->unlock(); + } if ( vm == 0 ) {