* 2. use parallel tasks to simulate CPU overhead and remove the experimental code generating micro computation tasks
*/
+#include <xbt/ex.hpp>
+
+#include "src/plugins/vm/VirtualMachineImpl.hpp"
+#include "src/plugins/vm/VmHostExt.hpp"
+#include <simgrid/s4u/VirtualMachine.hpp>
+#include <simgrid/s4u/host.hpp>
+
#include "msg_private.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
#include "simgrid/host.h"
+#include "src/simix/smx_host_private.h" /* don't ask me why the VM functions are in there (FIXME:KILLME) */
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API");
/* **** ******** GENERAL ********* **** */
-/** \ingroup m_vm_management
- * \brief Returns the value of a given vm property
- *
- * \param vm a vm
- * \param name a property name
- * \return value of a property (or NULL if property not set)
- */
-const char *MSG_vm_get_property_value(msg_vm_t vm, const char *name)
-{
- return MSG_host_get_property_value(vm, name);
-}
/** \ingroup m_vm_management
- * \brief Returns a xbt_dict_t consisting of the list of properties assigned to this host
- *
- * \param vm a vm
- * \return a dict containing the properties
- */
-xbt_dict_t MSG_vm_get_properties(msg_vm_t vm)
-{
- xbt_assert((vm != NULL), "Invalid parameters (vm is NULL)");
- return vm->properties();
-}
-
-/** \ingroup m_host_management
- * \brief Change the value of a given host property
+ * \brief Set the parameters of a given host
*
* \param vm a vm
- * \param name a property name
- * \param value what to change the property to
- * \param free_ctn the freeing function to use to kill the value on need
- */
-void MSG_vm_set_property_value(msg_vm_t vm, const char *name, void *value, void_f_pvoid_t free_ctn)
-{
- xbt_dict_set(MSG_host_get_properties(vm), name, value, free_ctn);
-}
-
-/** \ingroup msg_vm_management
- * \brief Finds a msg_vm_t using its name.
- *
- * This is a name directory service
- * \param name the name of a vm.
- * \return the corresponding vm
- *
- * Please note that a VM is a specific host. Hence, you should give a different name for each VM/PM.
+ * \param params a parameter object
*/
-msg_vm_t MSG_vm_get_by_name(const char *name)
+void MSG_vm_set_params(msg_vm_t vm, vm_params_t params)
{
- return MSG_host_by_name(name);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->setParameters(params);
}
/** \ingroup m_vm_management
+ * \brief Get the parameters of a given host
*
- * \brief Return the name of the #msg_host_t.
- *
- * This functions checks whether \a host is a valid pointer or not and return its name.
+ * \param host a host
+ * \param params a prameter object
*/
-const char *MSG_vm_get_name(msg_vm_t vm)
+void MSG_vm_get_params(msg_vm_t vm, vm_params_t params)
{
- return MSG_host_get_name(vm);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->parameters(params);
}
/* **** Check state of a VM **** */
static inline int __MSG_vm_is_state(msg_vm_t vm, e_surf_vm_state_t state)
{
- return simcall_vm_get_state(vm) == state;
+ return static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getState() == state;
}
/** @brief Returns whether the given VM has just created, not running.
*/
int MSG_vm_is_migrating(msg_vm_t vm)
{
- msg_host_priv_t priv = sg_host_msg(vm);
- return priv->is_migrating;
+ return static_cast<simgrid::s4u::VirtualMachine*>(vm)->isMigrating();
}
/** @brief Returns whether the given VM is currently suspended, not running.
msg_vm_t MSG_vm_create(msg_host_t pm, const char *name, int ncpus, int ramsize, int net_cap, char *disk_path,
int disksize, int mig_netspeed, int dp_intensity)
{
- /* For the moment, intensity_rate is the percentage against the migration
- * bandwidth */
+ simgrid::vm::VmHostExt::ensureVmExtInstalled();
+
+ /* For the moment, intensity_rate is the percentage against the migration bandwidth */
double host_speed = MSG_host_get_speed(pm);
double update_speed = ((double)dp_intensity/100) * mig_netspeed;
//XBT_INFO("dp rate %f migspeed : %f intensity mem : %d, updatespeed %f, hostspeed %f",params.dp_rate,
// params.mig_speed, dp_intensity, update_speed, host_speed);
- vm->setParameters(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->setParameters(¶ms);
return vm;
}
*
* A VM is treated as a host. The name of the VM must be unique among all hosts.
*/
-msg_vm_t MSG_vm_create_core(msg_host_t ind_pm, const char *name)
+msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name)
{
- /* make sure the VM of the same name does not exit */
- {
- simgrid::s4u::Host* ind_host_tmp = (simgrid::s4u::Host*) xbt_dict_get_or_null(host_list, name);
- if (ind_host_tmp != nullptr && sg_host_simix(ind_host_tmp) != nullptr) {
- XBT_ERROR("host %s already exits", name);
- return nullptr;
- }
- }
-
- /* Note: ind_vm and vm_workstation point to the same elm object. */
- /* Ask the SIMIX layer to create the surf vm resource */
- sg_host_t ind_vm_workstation = (sg_host_t) simcall_vm_create(name, ind_pm);
-
- msg_vm_t ind_vm = (msg_vm_t) __MSG_host_create(ind_vm_workstation);
+ xbt_assert(sg_host_by_name(name) == nullptr,
+ "Cannot create a VM named %s: this name is already used by an host or a VM", name);
- XBT_DEBUG("A new VM (%s) has been created", name);
-
- TRACE_msg_vm_create(name, ind_pm);
-
- return ind_vm;
+ return new simgrid::s4u::VirtualMachine(name, pm);
}
/** @brief Destroy a VM. Destroy the VM object from the simulation.
void MSG_vm_destroy(msg_vm_t vm)
{
if (MSG_vm_is_migrating(vm))
- THROWF(vm_error, 0, "VM(%s) is migrating", sg_host_get_name(vm));
+ THROWF(vm_error, 0, "VM(%s) is migrating", vm->name().c_str());
/* First, terminate all processes on the VM if necessary */
if (MSG_vm_is_running(vm))
- simcall_vm_shutdown(vm);
+ MSG_vm_shutdown(vm);
- if (!MSG_vm_is_created(vm)) {
- XBT_CRITICAL("shutdown the given VM before destroying it");
- DIE_IMPOSSIBLE;
- }
+ xbt_assert(MSG_vm_is_created(vm), "shutdown the given VM before destroying it");
/* Then, destroy the VM object */
- simcall_vm_destroy(vm);
-
- TRACE_msg_vm_end(vm);
+ simgrid::simix::kernelImmediate([vm]() {
+ vm->destroy();
+ });
+
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t container = PJ_container_get(vm->name().c_str());
+ PJ_container_remove_from_parent(container);
+ PJ_container_free(container);
+ }
}
/** @brief Start a vm (i.e., boot the guest operating system)
{
simcall_vm_start(vm);
- TRACE_msg_vm_start(vm);
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t vm_container = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
+ val_t value = PJ_value_get_or_new("start", "0 0 1", type); // start is blue
+ new_pajePushState(MSG_get_clock(), vm_container, type, value);
+ }
}
/** @brief Immediately kills all processes within the given VM. Any memory that they allocated will be leaked.
*/
void MSG_vm_shutdown(msg_vm_t vm)
{
- /* msg_vm_t equals to msg_host_t */
simcall_vm_shutdown(vm);
-
- // TRACE_msg_vm_(vm);
+ MSG_process_sleep(0.); // Make sure that the processes in the VM are killed in this scheduling round before processing
+ // (eg with the VM destroy)
}
/* We have two mailboxes. mbox is used to transfer migration data between source and destination PMs. mbox_ctl is used
struct migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self());
s_vm_params_t params;
- ms->vm->parameters(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->parameters(¶ms);
int need_exit = 0;
int ret = 0;
for (;;) {
- msg_task_t task = NULL;
+ msg_task_t task = nullptr;
ret = MSG_task_recv(&task, ms->mbox);
{
if (ret != MSG_OK) {
// Copy the reference to the vm (if SRC crashes now, do_migration will free ms)
// This is clearly ugly but I (Adrien) need more time to do something cleaner (actually we should copy the whole ms
// structure at the beginning and free it at the end of each function)
- msg_vm_t vm = ms->vm;
- msg_host_t src_pm = ms->src_pm;
- msg_host_t dst_pm = ms-> dst_pm;
- msg_host_priv_t priv = sg_host_msg(vm);
-
-// TODO: we have an issue, if the DST node is turning off during the three next calls, then the VM is in an inconsistent
-// state. I should check with Takahiro in order to make this portion of code atomic
-// /* deinstall the current affinity setting for the CPU */
-// simcall_vm_set_affinity(vm, src_pm, 0);
-//
-// /* Update the vm location */
-// simcall_vm_migrate(vm, dst_pm);
-//
-// /* Resume the VM */
-// simcall_vm_resume(vm);
-//
- simcall_vm_migratefrom_resumeto(vm, src_pm, dst_pm);
-
- /* install the affinity setting of the VM on the destination pm */
- {
+ simgrid::s4u::VirtualMachine* vm = static_cast<simgrid::s4u::VirtualMachine*>(ms->vm);
+ msg_host_t src_pm = ms->src_pm;
+ msg_host_t dst_pm = ms->dst_pm;
- unsigned long affinity_mask =
- (unsigned long)(uintptr_t) xbt_dict_get_or_null_ext(priv->affinity_mask_db, (char *)dst_pm, sizeof(msg_host_t));
- simcall_vm_set_affinity(vm, dst_pm, affinity_mask);
- XBT_DEBUG("set affinity(0x%04lx@%s) for %s", affinity_mask, MSG_host_get_name(dst_pm), MSG_host_get_name(vm));
- }
+ // Make sure that we cannot get interrupted between the migrate and the resume to not end in an inconsistent state
+ simgrid::simix::kernelImmediate([vm, src_pm, dst_pm]() {
+ /* Update the vm location */
+ /* precopy migration makes the VM temporally paused */
+ xbt_assert(static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->getState() == SURF_VM_STATE_SUSPENDED);
+
+ /* jump to vm_ws_xigrate(). this will update the vm location. */
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->migrate(dst_pm);
+
+ /* Resume the VM */
+ SIMIX_vm_resume(vm);
+ });
{
// Now the VM is running on the new host (the migration is completed) (even if the SRC crash)
- msg_host_priv_t priv = sg_host_msg(vm);
- priv->is_migrating = 0;
+ vm->pimpl_vm_->isMigrating = false;
XBT_DEBUG("VM(%s) moved from PM(%s) to PM(%s)", sg_host_get_name(ms->vm), sg_host_get_name(ms->src_pm),
sg_host_get_name(ms->dst_pm));
- TRACE_msg_vm_change_host(ms->vm, ms->src_pm, ms->dst_pm);
+
+ if (TRACE_msg_vm_is_enabled()) {
+ static long long int counter = 0;
+ char key[INSTR_DEFAULT_STR_SIZE];
+ snprintf(key, INSTR_DEFAULT_STR_SIZE, "%lld", counter++);
+
+ // start link
+ container_t msg = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
+ new_pajeStartLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+
+ // destroy existing container of this vm
+ container_t existing_container = PJ_container_get(vm->name().c_str());
+ PJ_container_remove_from_parent(existing_container);
+ PJ_container_free(existing_container);
+
+ // create new container on the new_host location
+ PJ_container_new(vm->name().c_str(), INSTR_MSG_VM, PJ_container_get(sg_host_get_name(ms->dst_pm)));
+
+ // end link
+ msg = PJ_container_get(vm->name().c_str());
+ type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
+ new_pajeEndLink(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+ }
}
// Inform the SRC that the migration has been correctly performed
{
char *task_name = get_mig_task_name(ms->vm, ms->src_pm, ms->dst_pm, 4);
- msg_task_t task = MSG_task_create(task_name, 0, 0, NULL);
+ msg_task_t task = MSG_task_create(task_name, 0, 0, nullptr);
msg_error_t ret = MSG_task_send(task, ms->mbox_ctl);
// xbt_assert(ret == MSG_OK);
if(ret == MSG_HOST_FAILURE){
static void reset_dirty_pages(msg_vm_t vm)
{
- msg_host_priv_t priv = sg_host_msg(vm);
-
- char *key = NULL;
- xbt_dict_cursor_t cursor = NULL;
- dirty_page_t dp = NULL;
- xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
+ simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::surf::VirtualMachineImpl*>(vm->pimpl_);
+
+ char *key = nullptr;
+ xbt_dict_cursor_t cursor = nullptr;
+ dirty_page_t dp = nullptr;
+ if (!pimpl->dp_objs)
+ return;
+ xbt_dict_foreach (pimpl->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
dp->prev_clock = MSG_get_clock();
dp->prev_remaining = remaining;
static void start_dirty_page_tracking(msg_vm_t vm)
{
- msg_host_priv_t priv = sg_host_msg(vm);
- priv->dp_enabled = 1;
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->dp_enabled = 1;
reset_dirty_pages(vm);
}
static void stop_dirty_page_tracking(msg_vm_t vm)
{
- msg_host_priv_t priv = sg_host_msg(vm);
- priv->dp_enabled = 0;
+ static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_->dp_enabled = 0;
}
static double get_computed(char *key, msg_vm_t vm, dirty_page_t dp, double remaining, double clock)
static double lookup_computed_flop_counts(msg_vm_t vm, int stage_for_fancy_debug, int stage2_round_for_fancy_debug)
{
- msg_host_priv_t priv = sg_host_msg(vm);
+ simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::s4u::VirtualMachine*>(vm)->pimpl_vm_;
double total = 0;
- char *key = NULL;
- xbt_dict_cursor_t cursor = NULL;
- dirty_page_t dp = NULL;
- xbt_dict_foreach(priv->dp_objs, cursor, key, dp) {
+ char *key = nullptr;
+ xbt_dict_cursor_t cursor = nullptr;
+ dirty_page_t dp = nullptr;
+ xbt_dict_foreach (pimpl->dp_objs, cursor, key, dp) {
double remaining = MSG_task_get_flops_amount(dp->task);
double clock = MSG_get_clock();
dp->prev_clock = clock;
}
- total += priv->dp_updated_by_deleted_tasks;
+ total += pimpl->dp_updated_by_deleted_tasks;
- XBT_DEBUG("mig-stage%d.%d: computed %f flop_counts (including %f by deleted tasks)",
- stage_for_fancy_debug, stage2_round_for_fancy_debug, total, priv->dp_updated_by_deleted_tasks);
+ XBT_DEBUG("mig-stage%d.%d: computed %f flop_counts (including %f by deleted tasks)", stage_for_fancy_debug,
+ stage2_round_for_fancy_debug, total, pimpl->dp_updated_by_deleted_tasks);
- priv->dp_updated_by_deleted_tasks = 0;
+ pimpl->dp_updated_by_deleted_tasks = 0;
return total;
}
// TODO Is this code redundant with the information provided by
// msg_process_t MSG_process_create(const char *name, xbt_main_func_t code, void *data, msg_host_t host)
+/** @brief take care of the dirty page tracking, in case we're adding a task to a migrating VM */
void MSG_host_add_task(msg_host_t host, msg_task_t task)
{
- msg_host_priv_t priv = sg_host_msg(host);
+ simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+ if (vm == nullptr)
+ return;
+ simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::surf::VirtualMachineImpl*>(vm->pimpl_);
+
double remaining = MSG_task_get_flops_amount(task);
char *key = bprintf("%s-%p", task->name, task);
dirty_page_t dp = xbt_new0(s_dirty_page, 1);
dp->task = task;
-
- /* It should be okay that we add a task onto a migrating VM. */
- if (priv->dp_enabled) {
+ if (pimpl->dp_enabled) {
dp->prev_clock = MSG_get_clock();
dp->prev_remaining = remaining;
}
-
- xbt_assert(xbt_dict_get_or_null(priv->dp_objs, key) == NULL);
- xbt_dict_set(priv->dp_objs, key, dp, NULL);
- XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, sg_host_get_name(host), remaining, priv->dp_enabled);
+ if (!pimpl->dp_objs)
+ pimpl->dp_objs = xbt_dict_new();
+ xbt_assert(xbt_dict_get_or_null(pimpl->dp_objs, key) == nullptr);
+ xbt_dict_set(pimpl->dp_objs, key, dp, nullptr);
+ XBT_DEBUG("add %s on %s (remaining %f, dp_enabled %d)", key, sg_host_get_name(host), remaining, pimpl->dp_enabled);
xbt_free(key);
}
void MSG_host_del_task(msg_host_t host, msg_task_t task)
{
- msg_host_priv_t priv = sg_host_msg(host);
+ simgrid::s4u::VirtualMachine* vm = dynamic_cast<simgrid::s4u::VirtualMachine*>(host);
+ if (vm == nullptr)
+ return;
+ simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::surf::VirtualMachineImpl*>(vm->pimpl_);
char *key = bprintf("%s-%p", task->name, task);
-
- dirty_page_t dp = (dirty_page_t) xbt_dict_get_or_null(priv->dp_objs, key);
+ dirty_page_t dp = (dirty_page_t)(pimpl->dp_objs ? xbt_dict_get_or_null(pimpl->dp_objs, key) : NULL);
xbt_assert(dp->task == task);
/* If we are in the middle of dirty page tracking, we record how much computation has been done until now, and keep
* the information for the lookup_() function that will called soon. */
- if (priv->dp_enabled) {
+ if (pimpl->dp_enabled) {
double remaining = MSG_task_get_flops_amount(task);
double clock = MSG_get_clock();
// double updated = calc_updated_pages(key, host, dp, remaining, clock);
double updated = get_computed(key, host, dp, remaining, clock);
- priv->dp_updated_by_deleted_tasks += updated;
+ pimpl->dp_updated_by_deleted_tasks += updated;
}
-
- xbt_dict_remove(priv->dp_objs, key);
+ if (pimpl->dp_objs)
+ xbt_dict_remove(pimpl->dp_objs, key);
xbt_free(dp);
XBT_DEBUG("del %s on %s", key, sg_host_get_name(host));
-
xbt_free(key);
}
{
sg_size_t sent = 0;
char *task_name = get_mig_task_name(vm, src_pm, dst_pm, stage);
- msg_task_t task = MSG_task_create(task_name, 0, (double)size, NULL);
+ msg_task_t task = MSG_task_create(task_name, 0, (double)size, nullptr);
/* TODO: clean up */
migration_session *ms = (migration_session *) MSG_process_get_data(MSG_process_self());
s_vm_params_t params;
- ms->vm->parameters(¶ms);
+ static_cast<simgrid::s4u::VirtualMachine*>(ms->vm)->parameters(¶ms);
const sg_size_t ramsize = params.ramsize;
const sg_size_t devsize = params.devsize;
const int skip_stage1 = params.skip_stage1;
if (ramsize == 0)
XBT_WARN("migrate a VM, but ramsize is zero");
- if (max_downtime == 0) {
+ if (max_downtime <= 0) {
XBT_WARN("use the default max_downtime value 30ms");
max_downtime = 0.03;
}
if (!skip_stage1) {
double clock_prev_send = MSG_get_clock();
- TRY {
+ try {
/* At stage 1, we do not need timeout. We have to send all the memory pages even though the duration of this
* transfer exceeds the timeout value. */
XBT_VERB("Stage 1: Gonna send %llu", ramsize);
} else if (sent > ramsize)
XBT_CRITICAL("bug");
- } CATCH_ANONYMOUS {
+ }
+ catch (xbt_ex& e) {
//hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
// Stop the dirty page tracking an return (there is no memory space to release)
stop_dirty_page_tracking(ms->vm);
sg_size_t sent = 0;
double clock_prev_send = MSG_get_clock();
- TRY {
+ try {
XBT_DEBUG("Stage 2, gonna send %llu", updated_size);
sent = send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, updated_size, ms->mbox, 2, stage2_round, mig_speed,
mig_timeout);
- } CATCH_ANONYMOUS {
+ }
+ catch (xbt_ex& e) {
//hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
// Stop the dirty page tracking an return (there is no memory space to release)
stop_dirty_page_tracking(ms->vm);
simcall_vm_suspend(ms->vm);
stop_dirty_page_tracking(ms->vm);
- TRY {
+ try {
XBT_DEBUG("Stage 3: Gonna send %f", remaining_size);
send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, (sg_size_t)remaining_size, ms->mbox, 3, 0, mig_speed, -1);
- } CATCH_ANONYMOUS {
+ }
+ catch(xbt_ex& e) {
//hostfailure (if you want to know whether this is the SRC or the DST check directly in send_migration_data code)
// Stop the dirty page tracking an return (there is no memory space to release)
simcall_vm_resume(ms->vm);
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_rx_name;
- argv[1] = NULL;
+ argv[1] = nullptr;
/*rx_process = */ MSG_process_create_with_arguments(pr_rx_name, migration_rx_fun, ms, dst_pm, 1, argv);
}
{
char **argv = xbt_new(char *, 2);
argv[0] = pr_tx_name;
- argv[1] = NULL;
+ argv[1] = nullptr;
/* tx_process = */MSG_process_create_with_arguments(pr_tx_name, migration_tx_fun, ms, src_pm, 1, argv);
}
#endif
/* wait until the migration have finished or on error has occurred */
{
XBT_DEBUG("wait for reception of the final ACK (i.e. migration has been correctly performed");
- msg_task_t task = NULL;
+ msg_task_t task = nullptr;
msg_error_t ret = MSG_TIMEOUT;
while (ret == MSG_TIMEOUT && MSG_host_is_on(dst_pm)) //Wait while you receive the message o
ret = MSG_task_receive_with_timeout(&task, ms->mbox_ctl, 4);
if (MSG_vm_is_migrating(vm))
THROWF(vm_error, 0, "VM(%s) is already migrating", sg_host_get_name(vm));
- msg_host_priv_t priv = sg_host_msg(vm);
- priv->is_migrating = 1;
+ simgrid::surf::VirtualMachineImpl* pimpl = static_cast<simgrid::surf::VirtualMachineImpl*>(vm->pimpl_);
+ pimpl->isMigrating = 1;
{
int ret = do_migration(vm, old_pm, new_pm);
if (ret == -1){
- priv->is_migrating = 0;
- THROWF(host_error, 0, "SRC host failed during migration");
+ pimpl->isMigrating = 0;
+ THROWF(host_error, 0, "SRC host failed during migration");
}
else if(ret == -2){
- priv->is_migrating = 0;
- THROWF(host_error, 0, "DST host failed during migration");
+ pimpl->isMigrating = 0;
+ THROWF(host_error, 0, "DST host failed during migration");
}
}
XBT_DEBUG("vm_suspend done");
- TRACE_msg_vm_suspend(vm);
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t vm_container = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
+ val_t value = PJ_value_get_or_new("suspend", "1 0 0", type); // suspend is red
+ new_pajePushState(MSG_get_clock(), vm_container, type, value);
+ }
}
/** @brief Resume the execution of the VM. All processes on the VM run again.
{
simcall_vm_resume(vm);
- TRACE_msg_vm_resume(vm);
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t vm_container = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
+ new_pajePopState(MSG_get_clock(), vm_container, type);
+ }
}
THROWF(vm_error, 0, "VM(%s) is migrating", sg_host_get_name(vm));
simcall_vm_save(vm);
- TRACE_msg_vm_save(vm);
+
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t vm_container = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
+ val_t value = PJ_value_get_or_new("save", "0 1 0", type); // save is green
+ new_pajePushState(MSG_get_clock(), vm_container, type, value);
+ }
}
/** @brief Restore the execution of the VM. All processes on the VM run again.
{
simcall_vm_restore(vm);
- TRACE_msg_vm_restore(vm);
+ if (TRACE_msg_vm_is_enabled()) {
+ container_t vm_container = PJ_container_get(vm->name().c_str());
+ type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
+ new_pajePopState(MSG_get_clock(), vm_container, type);
+ }
}
/** @brief Get the physical host of a given VM.
{
simcall_vm_set_bound(vm, bound);
}
-
-/** @brief Set the CPU affinity of a given VM.
- * @ingroup msg_VMs
- *
- * This function changes the CPU affinity of a given VM. Usage is the same as
- * MSG_task_set_affinity(). See the MSG_task_set_affinity() for details.
- */
-void MSG_vm_set_affinity(msg_vm_t vm, msg_host_t pm, unsigned long mask)
-{
- msg_host_priv_t priv = sg_host_msg(vm);
-
- if (mask == 0)
- xbt_dict_remove_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm));
- else
- xbt_dict_set_ext(priv->affinity_mask_db, (char *) pm, sizeof(pm), (void *)(uintptr_t) mask, NULL);
-
- msg_host_t pm_now = MSG_vm_get_pm(vm);
- if (pm_now == pm) {
- XBT_DEBUG("set affinity(0x%04lx@%s) for %s", mask, MSG_host_get_name(pm), MSG_host_get_name(vm));
- simcall_vm_set_affinity(vm, pm, mask);
- } else
- XBT_DEBUG("set affinity(0x%04lx@%s) for %s (not active now)", mask, MSG_host_get_name(pm), MSG_host_get_name(vm));
-}