X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a17b0ff0037fd6627fff5de9e6a1b6628e3094eb..c66deda6497d36e70e2485fff5431151be1713c6:/src/msg/msg_vm.cpp diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 26e46b822a..8d59a21358 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -99,11 +99,12 @@ int MSG_vm_is_suspended(msg_vm_t vm) * @ingroup msg_VMs* * @param pm Physical machine that will host the VM * @param name Must be unique + * @param coreAmount Must be >= 1 * @param ramsize [TODO] * @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 pm, const char* name, int ramsize, int mig_netspeed, int dp_intensity) +msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int coreAmount, int ramsize, int mig_netspeed, int dp_intensity) { simgrid::vm::VmHostExt::ensureVmExtInstalled(); @@ -111,7 +112,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int ramsize, int mig_net double host_speed = MSG_host_get_speed(pm); double update_speed = (static_cast(dp_intensity)/100) * mig_netspeed; - msg_vm_t vm = MSG_vm_create_core(pm, name); + msg_vm_t vm = MSG_vm_create_multicore(pm, name, coreAmount); s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = static_cast(ramsize) * 1024 * 1024; @@ -129,7 +130,7 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int ramsize, int mig_net return vm; } -/** @brief Create a new VM object. The VM is not yet started. The resource of the VM is allocated upon MSG_vm_start(). +/** @brief Create a new VM object with the default parameters * @ingroup msg_VMs* * * A VM is treated as a host. The name of the VM must be unique among all hosts. @@ -139,7 +140,19 @@ msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name) 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); - return new simgrid::s4u::VirtualMachine(name, pm); + return new simgrid::s4u::VirtualMachine(name, pm, 1); +} +/** @brief Create a new VM object with the default parameters, but with a specified amount of cores + * @ingroup msg_VMs* + * + * A VM is treated as a host. The name of the VM must be unique among all hosts. + */ +msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount) +{ + 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); + + return new simgrid::s4u::VirtualMachine(name, pm, coreAmount); } /** @brief Destroy a VM. Destroy the VM object from the simulation.