SURF_VM_STATE_CREATED, /**< created, but not yet started */
SURF_VM_STATE_RUNNING,
SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
+ SURF_VM_STATE_DESTROYED
} e_surf_vm_state_t;
namespace simgrid {
double getRamsize();
simgrid::s4u::Host* pm();
+ e_surf_vm_state_t getState();
+
/* FIXME: protect me */
simgrid::vm::VirtualMachineImpl* pimpl_vm_ = nullptr;
};
if (MSG_vm_is_running(vm))
MSG_vm_shutdown(vm);
- xbt_assert(MSG_vm_is_created(vm), "shutdown the given VM before destroying it");
+ xbt_assert(MSG_vm_is_created(vm) || __MSG_vm_is_state(vm, SURF_VM_STATE_DESTROYED),
+ "shutdown the given VM before destroying it");
/* Then, destroy the VM object */
simgrid::simix::kernelImmediate([vm]() {
SIMIX_process_kill(smx_process, issuer);
}
- setState(SURF_VM_STATE_CREATED);
+ setState(SURF_VM_STATE_DESTROYED);
/* FIXME: we may have to do something at the surf layer, e.g., vcpu action */
}
{
return pimpl_vm_->getPm();
}
+e_surf_vm_state_t VirtualMachine::getState()
+{
+ return pimpl_vm_->getState();
+}
/** @brief Retrieve a copy of the parameters of that VM/PM
* @details The ramsize and overcommit fields are used on the PM too */