- private static void addVM(VM vm){
- VM[] vmsN=null;
- int i=0;
- if(VM.vms == null)
- vmsN = new VM[1];
- else
- vmsN = new VM[vms.length+1];
-
- for (i=0; i<vmsN.length-1 ; i ++){
- vmsN[i]=vms[i];
- }
- vmsN[i]=vm;
- vms=vmsN;
- }
- public static VM[] all(){
- return vms;
- }
- public static VM getVMByName(String name){
- for (int i=0 ; i < vms.length ; i++){
- if (vms[i].getName().equals(name))
- return vms[i];
- }
- return null;
- }
- protected void finalize() {
- destroy();
+ /**
+ * Create a VM
+ * @param host Host node
+ * @param name name of the machine
+ * @param coreAmount the amount of cores of the VM
+ * @param ramSize size of the RAM that should be allocated (in MBytes)
+ * @param migNetSpeed (network bandwidth 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 coreAmount, int ramSize, int migNetSpeed, int dpIntensity){
+ super();
+ super.name = name;
+ this.currentHost = host;
+ this.coreAmount = coreAmount;
+ create(host, name, coreAmount, ramSize, migNetSpeed, dpIntensity);