*/
void MSG_vm_destroy(msg_vm_t vm)
{
- /* First, terminate all processes on the VM */
- simcall_vm_shutdown(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);
xbt_swag_new(xbt_swag_offset(proc, host_proc_hookup));
/* Update global variables */
- xbt_lib_set(host_lib,name,SIMIX_HOST_LEVEL,smx_host);
+ xbt_lib_set(host_lib, name, SIMIX_HOST_LEVEL, smx_host);
/* Create surf associated resource */
// TODO change phys_host into the right workstation surf model
void SIMIX_pre_vm_start(smx_simcall_t simcall, smx_host_t ind_vm)
{
SIMIX_vm_start(ind_vm);
+ SIMIX_simcall_answer(simcall);
}
/* ***** set/get state of a VM ***** */
void SIMIX_vm_set_state(smx_host_t ind_vm, int state)
{
+ /* jump to vm_ws_set_state */
surf_vm_workstation_model->extension.vm_workstation.set_state(ind_vm, state);
}
void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm)
{
SIMIX_vm_migrate(ind_vm, ind_dst_pm);
+ SIMIX_simcall_answer(simcall);
}
surf_vm_workstation_model->extension.vm_workstation.destroy(ind_vm);
}
-void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t ind_vm){
- SIMIX_vm_destroy(ind_vm);
+void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t ind_vm)
+{
+ SIMIX_vm_destroy(ind_vm);
+ SIMIX_simcall_answer(simcall);
}
model->name = "Virtual Workstation";
model->type = SURF_MODEL_TYPE_VM_WORKSTATION;
- // model->action_unref = ws_action_unref;
+ model->action_unref = ws_action_unref;
model->action_cancel = vm_ws_action_cancel;
// model->action_state_set = ws_action_state_set;