From 757928736ffded6b7473cdf281953be17226b00d Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Thu, 3 Mar 2016 15:56:07 +0100 Subject: [PATCH] bug #4237: When a driver return an empty deploy_id the VM is moved to failed state --- src/vmm/VirtualMachineManagerDriver.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/vmm/VirtualMachineManagerDriver.cc b/src/vmm/VirtualMachineManagerDriver.cc index 5cb75d652f..c1fefdd637 100644 --- a/src/vmm/VirtualMachineManagerDriver.cc +++ b/src/vmm/VirtualMachineManagerDriver.cc @@ -331,25 +331,33 @@ void VirtualMachineManagerDriver::protocol(const string& message) const if ( action == "DEPLOY" ) { + LifeCycleManager::Actions action = LifeCycleManager::DEPLOY_SUCCESS; + if (result == "SUCCESS") { string deploy_id; is >> deploy_id; - vm->set_deploy_id(deploy_id); - - vmpool->update(vm); - - lcm->trigger(LifeCycleManager::DEPLOY_SUCCESS, id); + if ( !deploy_id.empty() ) + { + vm->set_deploy_id(deploy_id); + } + else + { + action = LifeCycleManager::DEPLOY_FAILURE; + log_error(vm,os,is,"Empty deploy ID for virtual machine"); + } } else { + action = LifeCycleManager::DEPLOY_FAILURE; log_error(vm,os,is,"Error deploying virtual machine"); - vmpool->update(vm); - - lcm->trigger(LifeCycleManager::DEPLOY_FAILURE, id); } + + vmpool->update(vm); + + lcm->trigger(action, id); } else if (action == "SHUTDOWN" ) {