typedef msg_host_t msg_vm_t;
typedef msg_host_priv_t msg_vm_priv_t;
-/* must be synchronized with e_surf_vm_state_t */
-typedef enum {
- /* created, but not yet started */
- msg_vm_state_created,
-
- msg_vm_state_running,
- msg_vm_state_migrating,
-
- /* Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
- msg_vm_state_suspended,
-
- /* Save/restore involves disk I/O, so there should be transition states. */
- msg_vm_state_saving,
- msg_vm_state_saved,
- msg_vm_state_restoring,
-
-} e_msg_vm_state_t;
-
static inline msg_vm_priv_t MSG_vm_priv(msg_vm_t vm){
return xbt_lib_get_level(vm, MSG_HOST_LEVEL);
}
} e_surf_process_on_failure_t;
+/* FIXME: Where should the VM state be defined? */
+typedef enum {
+ /* created, but not yet started */
+ SURF_VM_STATE_CREATED,
+
+ SURF_VM_STATE_RUNNING,
+ SURF_VM_STATE_MIGRATING,
+
+ /* Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
+ SURF_VM_STATE_SUSPENDED,
+
+ /* Save/restore involves disk I/O, so there should be transition states. */
+ SURF_VM_STATE_SAVING,
+ SURF_VM_STATE_SAVED,
+ SURF_VM_STATE_RESTORING,
+
+} e_surf_vm_state_t;
+
+
typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
/** opaque structure defining a event generator for availability based on a probability distribution */
/* **** Check state of a VM **** */
-static inline int __MSG_vm_is_state(msg_vm_t vm, e_msg_vm_state_t state) {
+static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state) {
return simcall_vm_get_state(vm) == state;
}
*/
int MSG_vm_is_created(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_created);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_CREATED);
}
/** @brief Returns whether the given VM is currently running
*/
int MSG_vm_is_running(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_running);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_RUNNING);
}
/** @brief Returns whether the given VM is currently migrating
*/
int MSG_vm_is_migrating(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_migrating);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_MIGRATING);
}
/** @brief Returns whether the given VM is currently suspended, not running.
*/
int MSG_vm_is_suspended(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_suspended);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_SUSPENDED);
}
/** @brief Returns whether the given VM is being saved (FIXME: live saving or not?).
*/
int MSG_vm_is_saving(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_saving);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVING);
}
/** @brief Returns whether the given VM has been saved, not running.
*/
int MSG_vm_is_saved(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_saved);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_SAVED);
}
/** @brief Returns whether the given VM is being restored, not running.
*/
int MSG_vm_is_restoring(msg_vm_t vm)
{
- return __MSG_vm_is_state(vm, vm_state_restoring);
+ return __MSG_vm_is_state(vm, SURF_VM_STATE_RESTORING);
}
{
//TODO only start the VM if you can
if (__can_be_started(ind_vm))
- SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_RUNNING);
else
THROWF(vm_error, 0, "The VM %s cannot be started", SIMIX_host_get_name(ind_vm));
}
/* TODO: check state */
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_migrating);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_MIGRATING);
/* 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_vm_set_state(ind_vm, msg_vm_state_running);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_RUNNING);
}
void SIMIX_pre_vm_migrate(smx_simcall_t simcall, smx_host_t ind_vm, smx_host_t ind_dst_pm){
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_suspended);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_SUSPENDED);
}
void SIMIX_pre_vm_suspend(smx_simcall_t simcall, smx_host_t ind_vm){
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_RUNNING);
}
void SIMIX_pre_vm_resume(smx_simcall_t simcall, smx_host_t ind_vm){
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_saved);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_SAVED);
}
void SIMIX_pre_vm_save(smx_simcall_t simcall, smx_host_t ind_vm){
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_running);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_RUNNING);
}
void SIMIX_pre_vm_restore(smx_simcall_t simcall, smx_host_t ind_vm){
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_created);
+ SIMIX_vm_set_state(ind_vm, SURF_VM_STATE_CREATED);
}
void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm){
#include "surf/maxmin_private.h"
-/* FIXME: Where should the VM state be defined?
- * At now, this must be synchronized with e_msg_vm_state_t */
-typedef enum {
- /* created, but not yet started */
- vm_state_created,
-
- vm_state_running,
- vm_state_migrating,
-
- /* Suspend/resume does not involve disk I/O, so we assume there is no transition states. */
- vm_state_suspended,
-
- /* Save/restore involves disk I/O, so there should be transition states. */
- vm_state_saving,
- vm_state_saved,
- vm_state_restoring,
-
-} e_surf_vm_state_t;
-
/* NOTE:
* The workstation_VM2013 struct includes the workstation_CLM03 struct in
* its first member. The workstation_VM2013_t struct inherites all
workstation_VM2013_t vm_ws = xbt_new0(s_workstation_VM2013_t, 1);
vm_ws->sub_ws = surf_workstation_resource_priv(ind_phys_workstation);
- vm_ws->current_state = vm_state_created;
+ vm_ws->current_state = SURF_VM_STATE_CREATED;
// //// WORKSTATION RELATED STUFF ////