From a64f9bb7306061da60882141573e40d32fed4964 Mon Sep 17 00:00:00 2001 From: Takahiro Hirofuchi Date: Fri, 15 Feb 2013 13:48:01 +0100 Subject: [PATCH] add the definition of VM state to the surf layer FIXME: Where should the VM state be defined? Only in the surf layer, or also in the msg layer? --- include/msg/datatypes.h | 1 + src/surf/vm_workstation.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index b4ea9458bc..8fca546a1a 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -84,6 +84,7 @@ typedef struct msg_task *msg_task_t; 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, diff --git a/src/surf/vm_workstation.c b/src/surf/vm_workstation.c index f4049bc722..012f96e563 100644 --- a/src/surf/vm_workstation.c +++ b/src/surf/vm_workstation.c @@ -13,6 +13,29 @@ #include "workstation_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 */ + 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; + + + + /* NOTE: * The workstation_VM2013 struct includes the workstation_CLM03 struct in * its first member. The workstation_VM2013_t struct inherites all @@ -24,7 +47,8 @@ typedef struct workstation_VM2013 { /* The workstation object of the lower layer */ workstation_CLM03_t sub_ws; // Pointer to the ''host'' OS - e_msg_vm_state_t current_state; // See include/msg/datatypes.h + + e_surf_vm_state_t current_state; } s_workstation_VM2013_t, *workstation_VM2013_t; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm_workstation, surf, @@ -64,7 +88,7 @@ static void vm_ws_create(const char *name, void *ind_phys_workstation) // ind means ''indirect'' that this is a reference on the whole dict_elm structure (i.e not on the surf_resource_private infos) vm_ws->sub_ws = surf_workstation_resource_priv(ind_phys_workstation); - vm_ws->current_state=msg_vm_state_created, + vm_ws->current_state = surf_vm_state_created; /* If you want to get a workstation_VM2013 object from host_lib, see -- 2.20.1