From: Martin Quinson Date: Thu, 9 Oct 2014 21:07:29 +0000 (+0200) Subject: Allow to recreate VMs in a better way (I guess) X-Git-Tag: v3_12~760^2~68 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/ed6ec7765a2763f0e1c383ed4ec2e4b3d434ee19 Allow to recreate VMs in a better way (I guess) Instead of removing the VM from the host_lib (and potentially create issues at the routing level), test whether it exists in the VM layer before whining that we cannot redo it. --- diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index b626e431ed..0f078bd637 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -204,8 +204,8 @@ msg_vm_t MSG_vm_create_core(msg_host_t ind_pm, const char *name) { /* make sure the VM of the same name does not exit */ { - void *ind_host_tmp = xbt_lib_get_elm_or_null(host_lib, name); - if (ind_host_tmp) { + xbt_dictelm_t ind_host_tmp = xbt_lib_get_elm_or_null(host_lib, name); + if (ind_host_tmp && xbt_lib_get_level(ind_host_tmp, SIMIX_HOST_LEVEL) != NULL) { XBT_ERROR("host %s already exits", name); return NULL; } @@ -253,7 +253,6 @@ void MSG_vm_destroy(msg_vm_t vm) #ifdef HAVE_TRACING TRACE_msg_vm_end(vm); #endif - xbt_lib_remove(host_lib, sg_host_name(vm)); }