| 47 | /// @author Manoel Campos da Silva Filho |
| 48 | /// @since CloudSim Plus 4.6.0 |
| 49 | public class VmGroup extends VmSimple { |
| 50 | /** |
| 51 | * The List of VMs belonging to this group. |
| 52 | */ |
| 53 | @Getter |
| 54 | private final List<Vm> vmList; |
| 55 | |
| 56 | /** |
| 57 | * Creates a VmGroup for a List of VMs. |
| 58 | * @param vmList the List of VMs to create the group |
| 59 | */ |
| 60 | public VmGroup(@NonNull final List<Vm> vmList) { |
| 61 | super(getMaxMips(vmList), getTotalPes(vmList)); |
| 62 | |
| 63 | this.vmList = vmList; |
| 64 | this.vmList.forEach(vm -> ((VmSimple)vm).setGroup(this)); |
| 65 | |
| 66 | if(vmList.isEmpty()){ |
| 67 | throw new IllegalStateException("The List of VMs belonging to a " + VmGroup.class.getSimpleName() + " cannot be empty."); |
| 68 | } |
| 69 | |
| 70 | setBroker(vmList.get(0).getBroker()); |
| 71 | setCloudletScheduler(CloudletScheduler.NULL); |
| 72 | setVmm("None"); |
| 73 | setTotalRam(); |
| 74 | setTotalBw(); |
| 75 | setTotalStorage(); |
| 76 | setTimeZone(Double.MIN_VALUE); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Creates a VmGroup for a List of VMs to be placed |
| 81 | * at the datacenter closest to a given timezone. |
| 82 | * All VMs will be changed to the given time zone. |
| 83 | * @param vmList the List of VMs to create the group |
| 84 | * @param timeZone the timezone of the Datacenter where it's expected the VMs to be placed |
| 85 | * as close as possible |
| 86 | * @see DatacenterBroker#setSelectClosestDatacenter(boolean) |
| 87 | */ |
| 88 | public VmGroup(final List<Vm> vmList, final double timeZone) { |
| 89 | this(vmList); |
| 90 | setTimeZone(timeZone); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Creates a VmGroup for a List of VMs to be placed |
| 95 | * at the datacenter closest to a given timezone. |
| 96 | * All VMs will be changed to the given time zone. |
| 97 | * @param id the VmGroup ID |
| 98 | * @param vmList the List of VMs to create the group |
| 99 | * @param timeZone the time zone of the Datacenter where it's expected the VMs to be placed |
| 100 | * as close as possible |
| 101 | * @see DatacenterBroker#setSelectClosestDatacenter(boolean) |
| 102 | */ |
| 103 | public VmGroup(final long id, final List<Vm> vmList, final double timeZone) { |
| 104 | this(vmList, timeZone); |
| 105 | setId(id); |
| 106 | } |
nothing calls this directly
no outgoing calls
no test coverage detected