// No need to declare a new bind variable: we use the one inherited from the super class Host
private Host currentHost;
+ private int coreAmount = 1;
/** 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,1024, 0, 0);
+ this(host,name, /*coreAmount*/1, 1024, 0, 0);
+ }
+
+ public VM(Host host, String name, int coreAmount) {
+ this(host,name, coreAmount, 1024, 0, 0);
+ }
+ public VM(Host host, String name, int ramSize, int migNetSpeed, int dpIntensity){
+ this(host, name, /*coreAmount*/1, ramSize, migNetSpeed, dpIntensity);
}
/**
* @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 ramSize, int migNetSpeed, int dpIntensity){
+ public VM(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity){
super();
super.name = name;
this.currentHost = host;
- create(host, name, ramSize, migNetSpeed, dpIntensity);
+ this.coreAmount = coreAmount;
+ create(host, name, coreAmount, ramSize, migNetSpeed, dpIntensity);
}
/** Retrieve the list of all existing VMs */
- public native static VM[] all();
+ public static native VM[] all();
/** Retrieve a VM from its name */
- public native static VM getVMByName(String name);
+ public static native VM getVMByName(String name);
/** Shutdown and unref the VM.
*
/** Returns whether the given VM is currently suspended */
public native int isSuspended();
+ /** Returns the amount of virtual CPUs provided */
+ public int getCoreAmount() {
+ return coreAmount;
+ }
+
/**
* Natively implemented method create the VM.
* @param ramSize size of the RAM that should be allocated (in MB)
* @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 ramSize, int migNetSpeed, int dpIntensity);
+ private native void create(Host host, String name, int coreAmount, int ramSize, int migNetSpeed, int dpIntensity);
/**
// If the migration correcly returned, then we should change the currentHost value.
this.currentHost = destination;
}
- private native void nativeMigration(Host destination) throws Exception;
+ private native void nativeMigration(Host destination) throws MsgException;
/** Immediately suspend the execution of all processes within the given VM
*