Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
VM: don't take ignored parameter that may fool the users
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Dec 2016 16:53:22 +0000 (17:53 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 19 Dec 2016 23:11:07 +0000 (00:11 +0100)
12 files changed:
ChangeLog
examples/java/cloud/migration/Test.java
examples/java/cloud/migration/TestHostOnOff.java
examples/java/cloud/migration/XVM.java
examples/java/energy/vm/EnergyVMRunner.java
examples/msg/energy-vm/energy-vm.c
include/simgrid/msg.h
src/bindings/java/jmsg_vm.cpp
src/bindings/java/jmsg_vm.h
src/bindings/java/org/simgrid/msg/VM.java
src/msg/msg_vm.cpp
teshsuite/msg/host_on_off_processes/host_on_off_processes.c

index 36ded83..e7cf51f 100644 (file)
--- 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
index d3d6a09..5d63841 100644 (file)
@@ -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
           );
index 68d17ef..07b5f22 100644 (file)
@@ -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
         );
index eb3994a..756b753 100644 (file)
@@ -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);
   }
index 09e0a73..0e636f6 100644 (file)
@@ -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");
index 8201ecb..752822a 100644 (file)
@@ -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");
index 8b9ca1d..fde4ce4 100644 (file)
@@ -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);
 
index 063819d..eb1880d 100644 (file)
@@ -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)
index f3c0a50..31e33d9 100644 (file)
@@ -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
index e59f88f..d3893a4 100644 (file)
@@ -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);
 
 
        /**
index 341b4ac..7586e84 100644 (file)
@@ -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(&params, 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;
index 79bf033..83071fb 100644 (file)
@@ -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);