From 35ae873aa3a5bab42f9c14d8d032d87abc5ea82b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 19 Dec 2016 17:53:22 +0100 Subject: [PATCH] VM: don't take ignored parameter that may fool the users --- ChangeLog | 2 ++ examples/java/cloud/migration/Test.java | 12 ----------- .../java/cloud/migration/TestHostOnOff.java | 12 ----------- examples/java/cloud/migration/XVM.java | 7 +++---- examples/java/energy/vm/EnergyVMRunner.java | 4 ++-- examples/msg/energy-vm/energy-vm.c | 4 ++-- include/simgrid/msg.h | 4 ++-- src/bindings/java/jmsg_vm.cpp | 13 +++++------- src/bindings/java/jmsg_vm.h | 5 ++--- src/bindings/java/org/simgrid/msg/VM.java | 20 +++++-------------- src/msg/msg_vm.cpp | 10 ++-------- .../host_on_off_processes.c | 2 +- 12 files changed, 26 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 36ded83179..e7cf51f97c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,8 @@ SimGrid (3.14) UNRELEASED; urgency=low - MSG_storage_set_property_value() * VM properties. Since msg_vm_t are msg_host_t, just use MSG_host_get_property_value() and friends + * MSG_vm_create had ignored parameters, that are now dropped: + core_nb, disk_path and disk_size. * MSG_as_router_get_property_value() was redundent with MSG_environment_as_get_property_value(). - Removed MSG_as_router_*propert*() functions diff --git a/examples/java/cloud/migration/Test.java b/examples/java/cloud/migration/Test.java index d3d6a09aa1..5d6384192e 100644 --- a/examples/java/cloud/migration/Test.java +++ b/examples/java/cloud/migration/Test.java @@ -52,11 +52,7 @@ public class Test extends Process{ Msg.info("Load of collocated VMs fluctuate between 0 and 90% in order to create a starvation issue and see " + "whether it impacts or not the migration time"); XVM vm1 = new XVM(host0, "vm0", - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); @@ -77,11 +73,7 @@ public class Test extends Process{ XVM tmp; for (int i=1 ; i<= collocatedSrc ; i++){ tmp = new XVM(host0, "vm"+i, - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); @@ -102,11 +94,7 @@ public class Test extends Process{ for (int i=1 ; i <= collocatedDst ; i++){ tmp = new XVM(host1, "vm"+(i+collocatedSrc), - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); diff --git a/examples/java/cloud/migration/TestHostOnOff.java b/examples/java/cloud/migration/TestHostOnOff.java index 68d17ef166..07b5f22e8d 100644 --- a/examples/java/cloud/migration/TestHostOnOff.java +++ b/examples/java/cloud/migration/TestHostOnOff.java @@ -58,11 +58,7 @@ public class TestHostOnOff extends Process{ int dpRate = 70; XVM vm0 = null; vm0 = new XVM(host1, "vm0", - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); @@ -117,11 +113,7 @@ public class TestHostOnOff extends Process{ // Create VM0 int dpRate = 70; XVM vm0 = new XVM(host1, "vm0", - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); @@ -137,11 +129,7 @@ public class TestHostOnOff extends Process{ Msg.info("Restart VM0"); vm0 = new XVM(host1, "vm0", - 1, // Nb of vcpu 2048, // Ramsize, - 125, // Net Bandwidth - null, //VM disk image - -1, //size of disk image, 125, // Net bandwidth, dpRate // Memory intensity ); diff --git a/examples/java/cloud/migration/XVM.java b/examples/java/cloud/migration/XVM.java index eb3994aef0..756b7535a2 100644 --- a/examples/java/cloud/migration/XVM.java +++ b/examples/java/cloud/migration/XVM.java @@ -19,11 +19,10 @@ public class XVM extends VM { private Daemon daemon; - public XVM(Host host, String name, - int nbCores, int ramsize, int netBW, String diskPath, int diskSize, int migNetBW, int dpIntensity){ - super(host, name, nbCores, ramsize, netBW, diskPath, diskSize, (int)(migNetBW*0.9), dpIntensity); + public XVM(Host host, String name, int ramsize, int migNetBW, int dpIntensity){ + super(host, name, ramsize, (int)(migNetBW*0.9), dpIntensity); this.currentLoad = 0; - this. dpIntensity = dpIntensity ; + this.dpIntensity = dpIntensity ; this.ramsize= ramsize; this.daemon = new Daemon(this, 100); } diff --git a/examples/java/energy/vm/EnergyVMRunner.java b/examples/java/energy/vm/EnergyVMRunner.java index 09e0a735b1..0e636f65e3 100644 --- a/examples/java/energy/vm/EnergyVMRunner.java +++ b/examples/java/energy/vm/EnergyVMRunner.java @@ -48,10 +48,10 @@ public class EnergyVMRunner extends Process { Host host3 = Host.getByName("MyHost3"); Msg.info("Creating and starting two VMs"); - VM vmHost1 = new VM(host1, "vmHost1", 4, 2048, 100, null, 1024 * 20, 10,50); + VM vmHost1 = new VM(host1, "vmHost1", 2048, 10, 50); vmHost1.start(); - VM vmHost3 = new VM(host3, "vmHost3", 4, 2048, 100, null, 1024 * 20, 10,50); + VM vmHost3 = new VM(host3, "vmHost3", 2048, 10, 50); vmHost3.start(); Msg.info("Create two tasks on Host1: one inside a VM, the other directly on the host"); diff --git a/examples/msg/energy-vm/energy-vm.c b/examples/msg/energy-vm/energy-vm.c index 8201ecb57e..752822ac2b 100644 --- a/examples/msg/energy-vm/energy-vm.c +++ b/examples/msg/energy-vm/energy-vm.c @@ -25,9 +25,9 @@ static int dvfs(int argc, char *argv[]) /* Host 1 */ XBT_INFO("Creating and starting two VMs"); - msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 4, 2048, 100, NULL, 1024 * 20, 10,50); + msg_vm_t vm_host1 = MSG_vm_create(host1, "vm_host1", 2048, 10, 50); MSG_vm_start(vm_host1); - msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 4, 2048, 100, NULL, 1024 * 20, 10,50); + msg_vm_t vm_host3 = MSG_vm_create(host3, "vm_host3", 2048, 10, 50); MSG_vm_start(vm_host3); XBT_INFO("Create two tasks on Host1: one inside a VM, the other directly on the host"); diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 8b9ca1d594..fde4ce41b1 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -482,8 +482,8 @@ XBT_PUBLIC(void) MSG_vm_set_params(msg_vm_t vm, vm_params_t params); // TODO add VDI later 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, int mig_netspeed, int dp_intensity); +XBT_PUBLIC(msg_vm_t) +MSG_vm_create(msg_host_t ind_pm, const char* name, int ramsize, int mig_netspeed, int dp_intensity); XBT_PUBLIC(void) MSG_vm_destroy(msg_vm_t vm); diff --git a/src/bindings/java/jmsg_vm.cpp b/src/bindings/java/jmsg_vm.cpp index 063819d0af..eb1880d0d9 100644 --- a/src/bindings/java/jmsg_vm.cpp +++ b/src/bindings/java/jmsg_vm.cpp @@ -87,14 +87,12 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm MSG_vm_set_bound(vm, bound); } -JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname, - jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, - jint jdisksize, jint jmig_netspeed, jint jdp_intensity) +JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv* env, jobject jvm, jobject jhost, jstring jname, + jint jramsize, jint jmig_netspeed, jint jdp_intensity) { msg_host_t host = jhost_get_native(env, jhost); - const char *name; - name = env->GetStringUTFChars(jname, 0); + const char* name = env->GetStringUTFChars(jname, 0); name = xbt_strdup(name); // TODO disk concerns are not taken into account yet @@ -102,10 +100,9 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, // disk_path = (*env)->GetStringUTFChars(env, jdiskpath, 0); // disk_path = xbt_strdup(disk_path); - msg_vm_t vm = MSG_vm_create(host, name, (int) jncore, (int) jramsize, (int) jnetcap, nullptr, (int) jdisksize, - (int) jmig_netspeed, (int) jdp_intensity); + msg_vm_t vm = MSG_vm_create(host, name, (int)jramsize, (int)jmig_netspeed, (int)jdp_intensity); - jvm_bind(env,jvm,vm); + jvm_bind(env, jvm, vm); } JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_nativeFinalize(JNIEnv *env, jobject jvm) diff --git a/src/bindings/java/jmsg_vm.h b/src/bindings/java/jmsg_vm.h index f3c0a507a6..31e33d9823 100644 --- a/src/bindings/java/jmsg_vm.h +++ b/src/bindings/java/jmsg_vm.h @@ -92,9 +92,8 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_setBound(JNIEnv *env, jobject jvm * Method create * Signature ()V */ -JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv *env, jobject jvm, jobject jhost, jstring jname, - jint jncore, jint jramsize, jint jnetcap, jstring jdiskpath, - jint jdisksize, jint dprate, jint mig_netspeed); +JNIEXPORT void JNICALL Java_org_simgrid_msg_VM_create(JNIEnv* env, jobject jvm, jobject jhost, jstring jname, + jint jramsize, jint dprate, jint mig_netspeed); /** * Class org_simgrid_msg_VM diff --git a/src/bindings/java/org/simgrid/msg/VM.java b/src/bindings/java/org/simgrid/msg/VM.java index e59f88fb17..d3893a49fd 100644 --- a/src/bindings/java/org/simgrid/msg/VM.java +++ b/src/bindings/java/org/simgrid/msg/VM.java @@ -22,30 +22,25 @@ public class VM extends Host{ /* Constructors / destructors */ /** - * Create a `basic' VM (i.e. 1 core, 1GB of RAM, other values are not taken into account). + * Create a `basic' VM (i.e. 1GB of RAM, other values are not taken into account). */ public VM(Host host, String name) { - this(host,name,1,1024, -1, null, -1,0 , 0); + this(host,name,1024, 0, 0); } /** * Create a VM * @param host Host node * @param name name of the machine - * @param nCore number of core * @param ramSize size of the RAM that should be allocated (in MBytes) - * @param netCap (not used for the moment) - * @param diskPath (not used for the moment) - * @param diskSize (not used for the moment) * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;)) * @param dpIntensity (dirty page percentage according to migNetSpeed, [0-100], if you don't know put zero ;)) */ - public VM(Host host, String name, int nCore, int ramSize, - int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity){ + public VM(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity){ super(); super.name = name; this.currentHost = host; - create(host, name, nCore, ramSize, netCap, diskPath, diskSize, migNetSpeed, dpIntensity); + create(host, name, ramSize, migNetSpeed, dpIntensity); vms.add(this); } @@ -103,16 +98,11 @@ public class VM extends Host{ /** * Natively implemented method create the VM. - * @param nCore number of core * @param ramSize size of the RAM that should be allocated (in MB) - * @param netCap (not used for the moment) - * @param diskPath (not used for the moment) - * @param diskSize (not used for the moment) * @param migNetSpeed (network bandwith allocated for migrations in MB/s, if you don't know put zero ;)) * @param dpIntensity (dirty page intensity, a percentage of migNetSpeed [0-100], if you don't know put zero ;)) */ - private native void create(Host host, String name, int nCore, int ramSize, - int netCap, String diskPath, int diskSize, int migNetSpeed, int dpIntensity); + private native void create(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity); /** diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 341b4ac3df..7586e84fc4 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -117,17 +117,12 @@ int MSG_vm_is_restoring(msg_vm_t vm) /** @brief Create a new VM with specified parameters. * @ingroup msg_VMs* * @param pm Physical machine that will host the VM - * @param name [TODO] - * @param ncpus [TODO] + * @param name Must be unique * @param ramsize [TODO] - * @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 pm, const char* name, int ncpus, int ramsize, int net_cap, char* disk_path, - int disksize, int mig_netspeed, int dp_intensity) +msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int ramsize, int mig_netspeed, int dp_intensity) { simgrid::vm::VmHostExt::ensureVmExtInstalled(); @@ -139,7 +134,6 @@ msg_vm_t MSG_vm_create(msg_host_t pm, const char* name, int ncpus, int ramsize, s_vm_params_t params; memset(¶ms, 0, sizeof(params)); params.ramsize = (sg_size_t)ramsize * 1024 * 1024; - //params.overcommit = 0; params.devsize = 0; params.skip_stage2 = 0; params.max_downtime = 0.03; diff --git a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c index 79bf033f69..83071fbd5f 100644 --- a/teshsuite/msg/host_on_off_processes/host_on_off_processes.c +++ b/teshsuite/msg/host_on_off_processes/host_on_off_processes.c @@ -176,7 +176,7 @@ static int test_launcher(int argc, char *argv[]) msg_vm_t vm0; msg_process_t daemon; - vm0 = MSG_vm_create (jupiter, "vm0", 1, 2048, 125, NULL, -1, 125, dpRate); + vm0 = MSG_vm_create(jupiter, "vm0", 2048, 125, dpRate); MSG_vm_start(vm0); argvF = xbt_new(char*, 2); -- 2.20.1