From: Martin Quinson Date: Mon, 29 May 2017 12:59:15 +0000 (+0200) Subject: allow to destroy VMs that are not started yet (fix #172) X-Git-Tag: v3.16~191 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5a1c4c690d9181a576844f90b6a50c75caf5f3c1?hp=-c allow to destroy VMs that are not started yet (fix #172) --- 5a1c4c690d9181a576844f90b6a50c75caf5f3c1 diff --git a/src/plugins/vm/VirtualMachineImpl.cpp b/src/plugins/vm/VirtualMachineImpl.cpp index 6b27d8ce5d..a678568321 100644 --- a/src/plugins/vm/VirtualMachineImpl.cpp +++ b/src/plugins/vm/VirtualMachineImpl.cpp @@ -207,8 +207,24 @@ void VirtualMachineImpl::resume() */ void VirtualMachineImpl::shutdown(smx_actor_t issuer) { - if (getState() != SURF_VM_STATE_RUNNING) - THROWF(vm_error, 0, "Cannot shutdown VM %s: it is not running", piface_->cname()); + if (getState() != SURF_VM_STATE_RUNNING) { + const char* stateName = "(unknown state)"; + switch (getState()) { + case SURF_VM_STATE_CREATED: + stateName = "created, but not yet started"; + break; + case SURF_VM_STATE_SUSPENDED: + stateName = "suspended"; + break; + case SURF_VM_STATE_DESTROYED: + stateName = "destroyed"; + break; + case SURF_VM_STATE_RUNNING: + THROW_IMPOSSIBLE; + break; + } + XBT_VERB("Shuting down the VM %s even if it's not running but %s", piface_->cname(), stateName); + } xbt_swag_t process_list = piface_->extension()->process_list; XBT_DEBUG("shutdown VM %s, that contains %d processes", piface_->cname(), xbt_swag_size(process_list));