cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus/src/main/java/org/cloudbus/cloudsim/allocationpolicies/VmAllocationPolicyAbstract.java
private boolean upScaleVmNonCpuResource(VerticalVmScaling scaling) {
        final Class<? extends ResourceManageable> resourceClass = scaling.getResourceClass();
        final ResourceManageable hostResource = scaling.getVm().getHost().getResource(resourceClass);
        final ResourceManageable vmResource = scaling.getVm().getResource(resourceClass);
        final double extraAmountToAllocate = scaling.getResourceAmountToScale();
        if(!hostResource.isResourceAmountAvailable(extraAmountToAllocate)) {
            return false;
        }

        final ResourceProvisioner provisioner = scaling.getVm().getHost().getProvisioner(resourceClass);
        final double newTotalVmResource = (double) vmResource.getCapacity() + extraAmountToAllocate;
        if(!provisioner.allocateResourceForVm(scaling.getVm(), newTotalVmResource)){
            showResourceIsUnavailable(scaling);
            return false;
        }

        Log.printFormattedLine(
            "%.2f: %s: %.0f more %s allocated to Vm %d: new capacity is %d. Current resource usage is %.2f%%",
            scaling.getVm().getSimulation().clock(),
            scaling.getClass().getSimpleName(),
            extraAmountToAllocate, resourceClass.getSimpleName(),
            scaling.getVm().getId(), vmResource.getCapacity(),
            vmResource.getPercentUtilization()*100);
        return true;
    }
/**
     * Performs the up scaling of a Vm resource that is anything other than CPU.
     *
     * @param scaling the Vm's scaling object
     * @return true if the up scaling was performed, false otherwise
     * @see #scaleVmPesUpOrDown(VerticalVmScaling)
     * @see #upScaleVmVertically(VerticalVmScaling)
     */
Performs the up scaling of a Vm resource that is anything other than CPU.
@param scaling the Vm's scaling object
@return true if the up scaling was performed, false otherwise
@see #scaleVmPesUpOrDown(VerticalVmScaling)
@see #upScaleVmVertically(VerticalVmScaling)
Performs the up scaling of a Vm resource that is anything other than CPU . @param scaling the Vm ' s scaling object @return true if the up scaling was performed false otherwise @see #scaleVmPesUpOrDown ( VerticalVmScaling ) @see #upScaleVmVertically ( VerticalVmScaling )
private boolean upScaleVmNonCpuResource(VerticalVmScaling scaling) {
        final Class<? extends ResourceManageable> resourceClass = scaling.getResourceClass();
        final ResourceManageable hostResource = scaling.getVm().getHost().getResource(resourceClass);
        final ResourceManageable vmResource = scaling.getVm().getResource(resourceClass);
        final double extraAmountToAllocate = scaling.getResourceAmountToScale();
        if(!hostResource.isResourceAmountAvailable(extraAmountToAllocate)) {
            return false;
        }
        final ResourceProvisioner provisioner = scaling.getVm().getHost().getProvisioner(resourceClass);
        final double newTotalVmResource = (double) vmResource.getCapacity() + extraAmountToAllocate;
        if(!provisioner.allocateResourceForVm(scaling.getVm(), newTotalVmResource)){
            showResourceIsUnavailable(scaling);
            return false;
        }
        Log.printFormattedLine(
            "%.2f: %s: %.0f more %s allocated to Vm %d: new capacity is %d. Current resource usage is %.2f%%",
            scaling.getVm().getSimulation().clock(),
            scaling.getClass().getSimpleName(),
            extraAmountToAllocate, resourceClass.getSimpleName(),
            scaling.getVm().getId(), vmResource.getCapacity(),
            vmResource.getPercentUtilization()*100);
        return true;
    }
private boolean upScaleVmNonCpuResource ( VerticalVmScaling scaling ) { final Class < ? extends ResourceManageable > resourceClass = scaling . getResourceClass ( ) ; final ResourceManageable hostResource = scaling . getVm ( ) . getHost ( ) . getResource ( resourceClass ) ; final ResourceManageable vmResource = scaling . getVm ( ) . getResource ( resourceClass ) ; final double extraAmountToAllocate = scaling . getResourceAmountToScale ( ) ; if ( ! hostResource . isResourceAmountAvailable ( extraAmountToAllocate ) ) { return false ; } final ResourceProvisioner provisioner = scaling . getVm ( ) . getHost ( ) . getProvisioner ( resourceClass ) ; final double newTotalVmResource = ( double ) vmResource . getCapacity ( ) + extraAmountToAllocate ; if ( ! provisioner . allocateResourceForVm ( scaling . getVm ( ) , newTotalVmResource ) ) { showResourceIsUnavailable ( scaling ) ; return false ; } Log . printFormattedLine ( "%.2f: %s: %.0f more %s allocated to Vm %d: new capacity is %d. Current resource usage is %.2f%%" , scaling . getVm ( ) . getSimulation ( ) . clock ( ) , scaling . getClass ( ) . getSimpleName ( ) , extraAmountToAllocate , resourceClass . getSimpleName ( ) , scaling . getVm ( ) . getId ( ) , vmResource . getCapacity ( ) , vmResource . getPercentUtilization ( ) * 100 ) ; return true ; }
Performs the up scaling of a Vm resource that is anything other than CPU.
Performs the up scaling of a Vm resource that is anything other than CPU .