int (*get_state) (void *ind_vm_workstation);
void (*set_state) (void *ind_vms_workstation, int state);
void (*migrate) (void *ind_vm_workstation, void *ind_dest_phys_workstation); // will be vm_ws_migrate()
+ const char * (*get_phys_host) (void *ind_vm_workstation); // will be vm_ws_get_phys_host()
void (*destroy) (void *ind_vm_workstation); // will be vm_ws_destroy(), which destroies the vm-workstation-specific data
} s_surf_model_extension_vm_workstation_t;
simcall_vm_migrate(vm, destination);
#ifdef HAVE_TRACING
- TRACE_msg_vm_change_host(vm,vm->location,destination);
+ // TRACE_msg_vm_change_host(vm, vm->location, destination);
#endif
#if 0
ACTION(SIMCALL_VM_SET_STATE, vm_set_state, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TINT(state)) sep \
ACTION(SIMCALL_VM_GET_STATE, vm_get_state, WITH_ANSWER, TINT(result), TSPEC(ind_vm, smx_host_t)) sep \
ACTION(SIMCALL_VM_MIGRATE, vm_migrate, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TSPEC(ind_dst_pm, smx_host_t)) sep \
+ACTION(SIMCALL_VM_GET_PHYS_HOST, vm_get_phys_host, WITH_ANSWER, TSTRING(result), TSPEC(ind_vm, smx_host_t)) sep \
ACTION(SIMCALL_VM_DESTROY, vm_destroy, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t)) sep \
ACTION(SIMCALL_VM_SUSPEND, vm_suspend, WITHOUT_ANSWER, TVOID(result), TSPEC(vm, smx_host_t)) sep \
ACTION(SIMCALL_VM_RESUME, vm_resume, WITHOUT_ANSWER, TVOID(result), TSPEC(vm, smx_host_t)) sep \
simcall_BODY_set_vm_state(vm, msg_vm_state_running);
}
-void simcall_vm_migrate(smx_host_t vm)
+void simcall_vm_migrate(smx_host_t vm, smx_host_t dst_phys)
{
/* will jump to SIMIX_pre_vm_migrate */
- simcall_BODY_vm_migrate(vm);
+ simcall_BODY_vm_migrate(vm, dst_phys);
}
void simcall_vm_suspend(smx_host_t vm)
/* TODO: Using the variable of the MSG layer is not clean. */
SIMIX_set_vm_state(ind_vm, msg_vm_state_migrating);
- /* jump to vm_ws_destroy(). this will update the vm location. */
- surf_vm_workstation_model->extension.vm_workstation.migrate(ind_vm, ind_dst);
+ /* jump to vm_ws_migrate(). this will update the vm location. */
+ surf_vm_workstation_model->extension.vm_workstation.migrate(ind_vm, ind_dst_pm);
SIMIX_set_vm_state(ind_vm, msg_vm_state_running);
}
SIMIX_vm_migrate(ind_vm, ind_dst_pm);
}
+/**
+ * \brief Function to get the physical host of the given the SIMIX VM host.
+ *
+ * \param host the vm host to get_phys_host (a smx_host_t)
+ */
+const char *SIMIX_vm_get_phys_host(smx_host_t ind_vm)
+{
+ /* jump to vm_ws_get_phys_host(). this will update the vm location. */
+ return surf_vm_workstation_model->extension.vm_workstation.get_phys_host(ind_vm);
+}
+
+const char *SIMIX_pre_vm_get_phys_host(smx_simcall_t simcall, smx_host_t ind_vm){
+ return SIMIX_vm_get_phys_host(ind_vm);
+}
+
/**
* \brief Function to suspend a SIMIX VM host. This function stops the exection of the
* VM. All the processes on this VM will pause. The state of the VM is
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_set_vm_state(ind_vm, msg_vm_state_resumeed);
+ SIMIX_set_vm_state(ind_vm, msg_vm_state_running);
}
void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm){
xbt_assert(vm_ws);
/* do something */
-
+
vm_ws->physical_workstation = surf_workstation_resource_priv(ind_dest_phys_workstation);
}
static void vm_ws_set_state(void *ind_vm_ws, int state){
((workstation_VM2013_t) surf_workstation_resource_priv(ind_vm_ws))->current_state=state;
}
+
+/*
+ * A surf level object will be useless in the upper layer. Returing the name
+ * will be simple and suffcient.
+ **/
+static const char *vm_ws_get_phys_host(void *ind_vm_ws)
+{
+ workstation_VM2013_t vm_ws = surf_workstation_resource_priv(ind_vm_ws);
+ return vm_ws->physical_workstation->name;
+}
+
static void surf_vm_workstation_model_init_internal(void)
{
surf_vm_workstation_model = surf_model_init();
surf_vm_workstation_model->extension.vm_workstation.set_state = vm_ws_set_state;
surf_vm_workstation_model->extension.vm_workstation.get_state = vm_ws_get_state;
surf_vm_workstation_model->extension.vm_workstation.migrate = vm_ws_migrate;
+ surf_vm_workstation_model->extension.vm_workstation.get_phys_host = vm_ws_get_phys_host;
surf_vm_workstation_model->extension.vm_workstation.destroy = vm_ws_destroy;
}