From a924fc6f7328160d99348f7d3de23fc50930ea03 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 21 Nov 2016 01:55:16 +0100 Subject: [PATCH] VM: move things from MSG to the C++ plugin --- src/msg/msg_vm.cpp | 15 --------------- src/plugins/vm/s4u_VirtualMachine.cpp | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index c3c29d87f9..5eb5d1beeb 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -182,21 +182,6 @@ void MSG_vm_destroy(msg_vm_t vm) /* Then, destroy the VM object */ simgrid::simix::kernelImmediate([vm]() { - /* this code basically performs a similar thing like SIMIX_host_destroy() */ - XBT_DEBUG("destroy %s", vm->name().c_str()); - - /* FIXME: this is really strange that everything fails if the next line is removed. - * This is as if we shared these data with the PM, which definitely should not be the case... - * - * We need to test that suspending a VM does not suspends the processes running on its PM, for example. - * Or we need to simplify this code enough to make it actually readable (but this sounds harder than testing) - */ - vm->extension_set(nullptr); - - /* Don't free these things twice: they are the ones of my physical host */ - vm->pimpl_cpu = nullptr; - vm->pimpl_netcard = nullptr; - vm->destroy(); }); diff --git a/src/plugins/vm/s4u_VirtualMachine.cpp b/src/plugins/vm/s4u_VirtualMachine.cpp index ec4ee2fcb1..f46ee37c9a 100644 --- a/src/plugins/vm/s4u_VirtualMachine.cpp +++ b/src/plugins/vm/s4u_VirtualMachine.cpp @@ -34,6 +34,20 @@ VirtualMachine::VirtualMachine(const char* name, s4u::Host* pm) : Host(name) VirtualMachine::~VirtualMachine() { onDestruction(*this); + + XBT_DEBUG("destroy %s", name().c_str()); + + /* FIXME: this is really strange that everything fails if the next line is removed. + * This is as if we shared these data with the PM, which definitely should not be the case... + * + * We need to test that suspending a VM does not suspends the processes running on its PM, for example. + * Or we need to simplify this code enough to make it actually readable (but this sounds harder than testing) + */ + extension_set(nullptr); + + /* Don't free these things twice: they are the ones of my physical host */ + pimpl_cpu = nullptr; + pimpl_netcard = nullptr; } bool VirtualMachine::isMigrating() -- 2.20.1