-/* Copyright (c) 2012-2014. The SimGrid Team.
+/* Copyright (c) 2012-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/** @brief Create a new VM with specified parameters.
* @ingroup msg_VMs*
- * All parameters are in MBytes
+ * @param pm Physical machine that will host the VM
+ * @param net_cap Maximal bandwidth that the VM can consume (in MByte/s)
+ * @param disk_path (unused) Path to the image that boots
+ * @param disksize (unused) will represent the size of the VM (will be used during migrations)
+ * @param mig_netspeed Amount of Mbyte/s allocated to the migration (cannot be larger than net_cap). Use 0 if unsure.
+ * @param dp_intensity Dirty page percentage according to migNetSpeed, [0-100]. Use 0 if unsure.
*
*/
-msg_vm_t MSG_vm_create(msg_host_t ind_pm, const char *name,
+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 */
- double host_speed = MSG_get_host_speed(ind_pm);
+ double host_speed = MSG_get_host_speed(pm);
double update_speed = ((double)dp_intensity/100) * mig_netspeed;
- msg_vm_t vm = MSG_vm_create_core(ind_pm, name);
+ msg_vm_t vm = MSG_vm_create_core(pm, name);
s_vm_params_t params;
memset(¶ms, 0, sizeof(params));
params.ramsize = (sg_size_t)ramsize * 1024 * 1024;
/* install the affinity setting of the VM on the destination pm */
{
- unsigned long affinity_mask = (unsigned long) xbt_dict_get_or_null_ext(priv->affinity_mask_db, (char *)dst_pm, sizeof(msg_host_t));
+ 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));
}
{
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, size, NULL);
+ msg_task_t task = MSG_task_create(task_name, 0, (double)size, NULL);
/* TODO: clean up */
if (ret == MSG_OK) {
sent = size;
} else if (ret == MSG_TIMEOUT) {
- sg_size_t remaining = MSG_task_get_remaining_communication(task);
+ sg_size_t remaining = (sg_size_t)MSG_task_get_remaining_communication(task);
sent = size - remaining;
XBT_INFO("timeout (%lf s) in sending_migration_data, remaining %llu bytes of %llu",
timeout, remaining, size);
#define MIGRATION_TIMEOUT_DO_NOT_HARDCODE_ME 10000000.0
double mig_timeout = MIGRATION_TIMEOUT_DO_NOT_HARDCODE_ME;
- double remaining_size = ramsize + devsize;
+ double remaining_size = (double) (ramsize + devsize);
double threshold = 0.0;
/* check parameters */
TRY {
XBT_DEBUG("Stage 3: Gonna send %f", remaining_size);
- send_migration_data(ms->vm, ms->src_pm, ms->dst_pm, remaining_size, ms->mbox, 3, 0, mig_speed, -1);
+ 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 {
//hostfailure (if you want to know whether this is the SRC or the DST please check directly in send_migration_data code)
// Stop the dirty page tracking an return (there is no memory space to release)
*/
void MSG_vm_set_bound(msg_vm_t vm, double bound)
{
- return simcall_vm_set_bound(vm, bound);
+ simcall_vm_set_bound(vm, bound);
}
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 *) mask, NULL);
+ 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) {