/* This function should not be called directly, but rather from MSG_vm_start_from_template that does not exist yet*/
// TODO add VDI later
-XBT_PUBLIC(msg_vm_t) MSG_vm_create(msg_host_t location, const char *name,
- int core_nb, int mem_cap, int net_cap);
+XBT_PUBLIC(msg_vm_t) MSG_vm_create_core(msg_host_t location, const char *name);
+XBT_PUBLIC(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);
XBT_PUBLIC(void) MSG_vm_start(msg_vm_t);
}
}
-void TRACE_msg_vm_sleep_in(msg_vm_t vm)
+void TRACE_msg_vm_save(msg_vm_t vm)
{
if (TRACE_msg_vm_is_enabled()){
int len = INSTR_DEFAULT_STR_SIZE;
container_t vm_container = PJ_container_get (instr_vm_id(vm, str, len));
type_t type = PJ_type_get ("MSG_VM_STATE", vm_container->type);
- val_t value = PJ_value_get ("sleep", type);
+ val_t value = PJ_value_get ("save", type);
new_pajePushState (MSG_get_clock(), vm_container, type, value);
}
}
-void TRACE_msg_vm_sleep_out(msg_vm_t vm)
+void TRACE_msg_vm_restore(msg_vm_t vm)
{
if (TRACE_msg_vm_is_enabled()){
int len = INSTR_DEFAULT_STR_SIZE;
void TRACE_msg_process_end(msg_process_t process);
/* declaration of instrumentation functions from instr_msg_vm.c */
-char *instr_vm_id (msg_vm_t vm, char *str, int len);
-char *instr_vm_id_2 (const char *vm_name, char *str, int len);
+char *instr_vm_id(msg_vm_t vm, char *str, int len);
+char *instr_vm_id_2(const char *vm_name, char *str, int len);
void TRACE_msg_vm_change_host(msg_vm_t vm, msg_host_t old_host,
msg_host_t new_host);
-void TRACE_msg_vm_create (const char *vm_name, msg_host_t host);
+void TRACE_msg_vm_create(const char *vm_name, msg_host_t host);
void TRACE_msg_vm_kill(msg_vm_t process);
void TRACE_msg_vm_suspend(msg_vm_t vm);
void TRACE_msg_vm_resume(msg_vm_t vm);
-void TRACE_msg_vm_sleep_in(msg_vm_t vm);
-void TRACE_msg_vm_sleep_out(msg_vm_t vm);
+void TRACE_msg_vm_save(msg_vm_t vm);
+void TRACE_msg_vm_restore(msg_vm_t vm);
void TRACE_msg_vm_end(msg_vm_t vm);
SG_END_DECL()
static int get_host_property_as_integer(smx_host_t host, const char *name)
{
- xbt_dict_t dict = simix_host_get_properties(host);
+ xbt_dict_t dict = SIMIX_host_get_properties(host);
char *value = xbt_dict_get_or_null(dict, name);
return atoi(value);
{
// TODO add checking code related to overcommitment or not.
- int overcommit = get_host_property_as_integer("OverCommit");
- int core_nb = get_host_property_as_integer("CORE_NB");
- int mem_cap = get_host_property_as_integer("MEM_CAP");
- int net_cap = get_host_property_as_integer("NET_CAP");
+ int overcommit = get_host_property_as_integer(vm, "OverCommit");
+ int core_nb = get_host_property_as_integer(vm, "CORE_NB");
+ int mem_cap = get_host_property_as_integer(vm, "MEM_CAP");
+ int net_cap = get_host_property_as_integer(vm, "NET_CAP");
/* we need to get other VM objects on this physical host. */
xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
XBT_DEBUG("save %s", SIMIX_host_get_name(ind_vm));
/* FIXME: calling a simcall from the SIMIX layer is strange. */
- simcall_process_save(smx_process);
+ simcall_process_suspend(smx_process);
}
/* TODO: Using the variable of the MSG layer is not clean. */
xbt_swag_foreach_safe(smx_process, smx_process_safe, SIMIX_host_priv(ind_vm)->process_list) {
XBT_DEBUG("restore %s", SIMIX_host_get_name(ind_vm));
/* FIXME: calling a simcall from the SIMIX layer is strange. */
- simcall_process_restore(smx_process);
+ simcall_process_resume(smx_process);
}
/* TODO: Using the variable of the MSG layer is not clean. */
}
/* TODO: Using the variable of the MSG layer is not clean. */
- SIMIX_vm_set_state(ind_vm, msg_vm_state_sleeping);
+ SIMIX_vm_set_state(ind_vm, msg_vm_state_created);
}
void SIMIX_pre_vm_shutdown(smx_simcall_t simcall, smx_host_t ind_vm){