public Vm createVm(final DatacenterBroker broker, final int id, final AwsEc2Template template) { final Vm vm = new VmSimple(id, VM_MIPS, template.getCpus()); vm .setRam(template.getMemoryInMB()).setBw(VM_BW).setSize(VM_SIZE) .setCloudletScheduler(new CloudletSchedulerTimeShared()) .setDescription(template.getName()); return vm; }
/** * Clones a VM by creating another one with the same configurations of a * given VM. * * @param vm the VM to be cloned * @return the cloned (new) VM. * * @see #createFaultInjectionForHosts(org.cloudbus.cloudsim.datacenters.Datacenter) */ private Vm cloneVm(Vm vm) { Vm clone = new VmSimple((long) vm.getMips(), (int) vm.getNumberOfPes()); /*It' not required to set an ID for the clone. It is being set here just to make it easy to relate the ID of the vm to its clone, since the clone ID will be 10 times the id of its source VM.*/ clone.setId(vm.getId() * 10); clone.setDescription("Clone of VM " + vm.getId()); clone .setSize(vm.getStorage().getCapacity()) .setBw(vm.getBw().getCapacity()) .setRam(vm.getBw().getCapacity()) .setCloudletScheduler(new CloudletSchedulerTimeShared()); System.out.printf("\n\n# Cloning %s - MIPS %.2f Number of Pes: %d\n", vm, clone.getMips(), clone.getNumberOfPes()); return clone; }
/** * Clones a VM by creating another one with the same configurations of a * given VM. * * @param vm the VM to be cloned * @return the cloned (new) VM. * @see #createFaultInjectionForHosts(org.cloudbus.cloudsim.datacenters.Datacenter) */ private Vm cloneVm(final Vm vm) { final Vm clone = new VmSimple((long) vm.getMips(), (int) vm.getNumberOfPes()); /* It' not required to set an ID for the clone. It is being set here just to make it easy to relate the ID of the vm to its clone, since the clone ID will be 10 times the id of its source VM. */ clone.setId(vm.getId() * 10); clone.setDescription("Clone of VM " + vm.getId()); clone .setSize(vm.getStorage().getCapacity()) .setBw(vm.getBw().getCapacity()) .setRam(vm.getBw().getCapacity()) .setCloudletScheduler(new CloudletSchedulerTimeShared()); System.out.printf("\n\n#Cloning VM %d from Host %d\n\tMips %.2f Number of Pes: %d\n", vm.getId(), vm.getHost().getId(), clone.getMips(), clone.getNumberOfPes()); return clone; }