@Override public final Vm setCloudletScheduler(final CloudletScheduler cloudletScheduler) { requireNonNull(cloudletScheduler); if(isCreated()){ throw new UnsupportedOperationException("CloudletScheduler can just be changed when the Vm was not created inside a Host yet."); } this.cloudletScheduler = cloudletScheduler; this.cloudletScheduler.setVm(this); return this; }
@Override public final Vm setSize(final long size) { if(this.isCreated()){ throw new UnsupportedOperationException("Storage size can just be changed when the Vm was not created inside a Host yet."); } setStorage(new Storage(size)); return this; }
@Override public final Vm setRam(final long ramCapacity) { if(this.isCreated()){ throw new UnsupportedOperationException("RAM capacity can just be changed when the Vm was not created inside a Host yet."); } setRam(new Ram(ramCapacity)); return this; }
@Override public final Vm setBw(final long bwCapacity) { if(this.isCreated()){ throw new UnsupportedOperationException("Bandwidth capacity can just be changed when the Vm was not created inside a Host yet."); } setBw(new Bandwidth(bwCapacity)); return this; }
@Override public long getCurrentRequestedBw() { if (!isCreated()) { return bw.getCapacity(); } return (long) (cloudletScheduler.getCurrentRequestedBwPercentUtilization() * bw.getCapacity()); }
@Override public long getCurrentRequestedRam() { if (!isCreated()) { return ram.getCapacity(); } return (long) (cloudletScheduler.getCurrentRequestedRamPercentUtilization() * ram.getCapacity()); }
@Override public List<Double> getCurrentRequestedMips() { if (isCreated()) { return host.getVmScheduler().getRequestedMips(this); } return LongStream.range(0, getNumberOfPes()) .mapToObj(i -> getMips()) .collect(toList()); }