+/** @brief Destroy a VM. Destroy the VM object from the simulation.
+ * @ingroup msg_VMs
+ */
+void MSG_vm_destroy(msg_vm_t vm)
+{
+ /* First, terminate all processes on the VM if necessary */
+ if (MSG_vm_is_running(vm))
+ simcall_vm_shutdown(vm);
+
+ if (!MSG_vm_is_created(vm)) {
+ XBT_CRITICAL("shutdown the given VM before destroying it");
+ DIE_IMPOSSIBLE;
+ }
+
+ /* Then, destroy the VM object */
+ simcall_vm_destroy(vm);
+
+ __MSG_host_destroy(vm);
+
+ #ifdef HAVE_TRACING
+ TRACE_msg_vm_end(vm);
+ #endif
+}
+