From 11214a6758fc736c5c7940bd2cbb6fffbe639d6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 27 Jul 2011 12:12:40 +0200 Subject: [PATCH] Bug #298: VM::save_disk now doesn't work for VMs in DONE or FAILED states. Remove duplicated log entry. --- src/vm/VirtualMachine.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 9cd0b5951c..bc07b80299 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -982,6 +982,10 @@ int VirtualMachine::save_disk(int disk_id, int img_id, string& error_str) ostringstream oss; istringstream iss; + if ( state == DONE || state == FAILED ) + { + goto error_state; + } num_disks = obj_template->get("DISK",disks); @@ -1022,6 +1026,10 @@ int VirtualMachine::save_disk(int disk_id, int img_id, string& error_str) goto error_not_found; +error_state: + oss << "VM cannot be in DONE or FAILED state."; + goto error_common; + error_persistent: oss << "Source image for DISK " << disk_id << " is persistent."; goto error_common; @@ -1034,7 +1042,6 @@ error_not_found: oss << "The DISK " << disk_id << " does not exist for VM " << oid << "."; error_common: - NebulaLog::log("VM",Log::ERROR, oss); error_str = oss.str(); return -1;