} s_surf_model_extension_workstation_t;
-
-
+typedef struct surf_vm_workstation_model_extension_public {
+ s_surf_model_extension_workstation_t basic;
+ void* (*create) (const char *name, void *ind_phys_workstation); // First operation of the VM model
+ // start does not appear here as it corresponds to turn the state from created to running (see smx_vm.c)
+ int (*get_state) (void *ind_phys_workstation);
+ void (*set_state) (void *ind_phys_workstation, int state);
+ void (*destroy) (void *ind_phys_workstation); // will be vm_ws_destroy(), which destroies the vm-specific data
+} s_surf_model_extension_vm_workstation_t;
/** \ingroup SURF_models
* \brief Model datatype
s_surf_model_extension_network_t network;
s_surf_model_extension_storage_t storage;
s_surf_model_extension_workstation_t workstation;
+ // TODO Implement the corresponding model
+ s_surf_model_extension_vm_workstation_t vm_workstation;
/*******************************************/
/* TUTORIAL: New model */
s_surf_model_extension_new_model_t new_model;
surf_model_t surf_model_init(void);
void surf_model_exit(surf_model_t model);
+static inline void *surf_cpu_resource_priv(const void *host) {
+ return xbt_lib_get_level((void *)host, SURF_CPU_LEVEL);
+}
+static inline void *surf_workstation_resource_priv(const void *host){
+ return xbt_lib_get_level((void *)host, SURF_WKS_LEVEL);
+}
+static inline void *surf_storage_resource_priv(const void *host){
+ return xbt_lib_get_level((void *)host, SURF_STORAGE_LEVEL);
+}
+
static inline void *surf_cpu_resource_by_name(const char *name) {
- return xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL);
+ return xbt_lib_get_elm_or_null(host_lib, name);
}
static inline void *surf_workstation_resource_by_name(const char *name){
- return xbt_lib_get_or_null(host_lib, name, SURF_WKS_LEVEL);
+ return xbt_lib_get_elm_or_null(host_lib, name);
}
static inline void *surf_storage_resource_by_name(const char *name){
- return xbt_lib_get_or_null(storage_lib, name, SURF_STORAGE_LEVEL);
+ return xbt_lib_get_elm_or_null(storage_lib, name);
}
typedef struct surf_resource {
*/
XBT_PUBLIC_DATA(surf_model_t) surf_workstation_model;
+/** \ingroup SURF_models
+ * \brief The vm_workstation model
+ *
+ * Note that when you create an API on top of SURF,
+ * the vm_workstation model should be the only one you use
+ * because depending on the platform model, the network model and the CPU model
+ * may not exist.
+ */
+XBT_PUBLIC_DATA(surf_model_t) surf_vm_workstation_model;
+
/** \ingroup SURF_models
* \brief Initializes the platform with a compound workstation model
*