XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
XBT_PUBLIC(int) MSG_get_host_number(void);
+XBT_PUBLIC(void) MSG_host_get_params(msg_host_t ind_pm, ws_params_t params);
+XBT_PUBLIC(void) MSG_host_set_params(msg_host_t ind_pm, ws_params_t params);
+
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
xbt_main_func_t code,
} e_surf_vm_state_t;
+typedef struct ws_params {
+ int ncpus;
+ long ramsize;
+ int overcommit;
+} s_ws_params_t, *ws_params_t;
typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
#include "xbt/parmap.h"
#include "xbt/swag.h"
+#include "simgrid/platf.h" // ws_params_t
+
SG_BEGIN_DECL()
/**************************** Scalar Values **********************************/
XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution);
XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority);
XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution);
+XBT_PUBLIC(void) simcall_host_get_params(smx_host_t vm, ws_params_t param);
+XBT_PUBLIC(void) simcall_host_set_params(smx_host_t vm, ws_params_t param);
/******************************* VM simcalls ********************************/
// Create the vm_workstation at the SURF level
xbt_dict_t(*get_properties) (const void *resource);
void (*add_traces) (void);
+ void (*get_params) (void *ind_vm_ws, ws_params_t param);
+ void (*set_params) (void *ind_vm_ws, ws_params_t param);
+
} s_surf_model_extension_workstation_t;
typedef struct surf_vm_workstation_model_extension_public {
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
return (simcall_host_get_state(host));
}
+
+/** \ingroup m_host_management
+ * \brief Set the parameters of a given host
+ *
+ * \param host a host
+ * \param params a prameter object
+ */
+void MSG_host_set_params(msg_host_t ind_pm, ws_params_t params)
+{
+ simcall_host_set_params(ind_pm, params);
+}
+
+/** \ingroup m_host_management
+ * \brief Get the parameters of a given host
+ *
+ * \param host a host
+ * \param params a prameter object
+ */
+void MSG_host_get_params(msg_host_t ind_pm, ws_params_t params)
+{
+ simcall_host_get_params(ind_pm, params);
+}
*
*/
msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name,
- int core_nb, int mem_cap, int net_cap, char *disk_path, int disk_size)
+ int ncpus, int ramsize, int net_cap, char *disk_path, int disksize)
{
msg_vm_t vm = MSG_vm_create_core(ind_pm, name);
- MSG_vm_set_property_value(vm, "CORE_NB", bprintf("%d", core_nb), free);
- MSG_vm_set_property_value(vm, "MEM_CAP", bprintf("%d", mem_cap), free);
- MSG_vm_set_property_value(vm, "NET_CAP", bprintf("%d", net_cap), free);
+ {
+ s_ws_params_t params;
+ memset(¶ms, 0, sizeof(params));
+ params.ramsize = ramsize;
+ params.overcommit = 0;
+ simcall_host_set_params(vm, ¶ms);
+ }
/* TODO: We will revisit the disk support later. */
}
#endif
+
+/**
+ * \brief Function to get the parameters of the given the SIMIX host.
+ *
+ * \param host the host to get_phys_host (a smx_host_t)
+ * \param param the parameter object space to be overwritten (a ws_params_t)
+ */
+void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params)
+{
+ /* jump to ws_get_params(). */
+ surf_workstation_model->extension.workstation.get_params(ind_vm, params);
+}
+
+void SIMIX_pre_host_get_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params)
+{
+ SIMIX_host_get_params(ind_vm, params);
+ SIMIX_simcall_answer(simcall);
+}
+
+void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params)
+{
+ /* jump to ws_set_params(). */
+ surf_workstation_model->extension.workstation.set_params(ind_vm, params);
+}
+
+void SIMIX_pre_host_set_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params)
+{
+ SIMIX_host_set_params(ind_vm, params);
+ SIMIX_simcall_answer(simcall);
+}
void *SIMIX_vm_get_pm(smx_host_t ind_vm);
void *SIMIX_pre_vm_get_pm(smx_simcall_t simcall, smx_host_t ind_vm);
+void SIMIX_host_get_params(smx_host_t ind_vm, ws_params_t params);
+void SIMIX_pre_host_get_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params);
+
+void SIMIX_host_set_params(smx_host_t ind_vm, ws_params_t params);
+void SIMIX_pre_host_set_params(smx_simcall_t simcall, smx_host_t ind_vm, ws_params_t params);
+
#endif
ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \
ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \
+ACTION(SIMCALL_HOST_GET_PARAMS, host_get_params, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TSPEC(params, ws_params_t)) sep \
+ACTION(SIMCALL_HOST_SET_PARAMS, host_set_params, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TSPEC(params, ws_params_t)) sep \
ACTION(SIMCALL_VM_CREATE, vm_create, WITH_ANSWER, TPTR(result), TSTRING(name), TSPEC(ind_pm, smx_host_t)) sep \
ACTION(SIMCALL_VM_START, vm_start, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t)) sep \
ACTION(SIMCALL_VM_SET_STATE, vm_set_state, WITHOUT_ANSWER, TVOID(result), TSPEC(ind_vm, smx_host_t), TINT(state)) sep \
return simcall_BODY_vm_get_pm(vm);
}
+void simcall_host_get_params(smx_host_t vm, ws_params_t params)
+{
+ /* will jump to SIMIX_pre_host_get_params in src/simix/smx_smurf_private.h */
+ simcall_BODY_host_get_params(vm, params);
+}
+
+void simcall_host_set_params(smx_host_t vm, ws_params_t params)
+{
+ /* will jump to SIMIX_pre_host_set_params in src/simix/smx_smurf_private.h */
+ simcall_BODY_host_set_params(vm, params);
+}
+
/**
* \ingroup simix_vm_management
* \brief Migrate the given VM to the given physical host
model->extension.vm_workstation.set_state = vm_ws_set_state;
model->extension.vm_workstation.get_state = vm_ws_get_state;
model->extension.vm_workstation.migrate = vm_ws_migrate;
- model->extension.vm_workstation.get_pm = vm_ws_get_pm;
model->extension.vm_workstation.destroy = vm_ws_destroy;
model->extension.vm_workstation.suspend = vm_ws_suspend;
model->extension.vm_workstation.resume = vm_ws_resume;
model->extension.vm_workstation.save = vm_ws_save;
model->extension.vm_workstation.restore = vm_ws_restore;
+ model->extension.vm_workstation.get_pm = vm_ws_get_pm;
+
+ model->extension.workstation.set_params = ws_set_params;
+ model->extension.workstation.get_params = ws_get_params;
surf_vm_workstation_model = model;
}
return model->extension.storage.ls(st, path);
}
+void ws_get_params(void *ws, ws_params_t params)
+{
+ workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
+ memcpy(params, &ws_clm03->params, sizeof(s_ws_params_t));
+}
+
+void ws_set_params(void *ws, ws_params_t params)
+{
+ workstation_CLM03_t ws_clm03 = surf_workstation_resource_priv(ws);
+ /* may check something here. */
+ memcpy(&ws_clm03->params, params, sizeof(s_ws_params_t));
+}
+
static void surf_workstation_model_init_internal(void)
{
surf_model_t model = surf_model_init();
model->extension.workstation.unlink = ws_action_unlink;
model->extension.workstation.ls = ws_action_ls;
+ model->extension.workstation.get_params = ws_get_params;
+ model->extension.workstation.set_params = ws_set_params;
+
surf_workstation_model = model;
}
s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */
void *net_elm;
xbt_dynar_t storage;
+
+ /* common with vm */
+ s_ws_params_t params;
+
} s_workstation_CLM03_t, *workstation_CLM03_t;
int ws_action_unref(surf_action_t action);
void ws_action_suspend(surf_action_t action);
void ws_action_resume(surf_action_t action);
e_surf_resource_state_t ws_get_state(void *workstation);
+
+void ws_get_params(void *ws, ws_params_t params);
+void ws_set_params(void *ws, ws_params_t params);
#endif /* WS_PRIVATE_H_ */