Class ResourceProvisionerSimple

    • Method Detail

      • allocateResourceForVm

        public boolean allocateResourceForVm​(Vm vm,
                                             long newTotalVmResourceCapacity)
        Description copied from interface: ResourceProvisioner
        Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.
        Parameters:
        vm - the virtual machine for which the resource is being allocated
        newTotalVmResourceCapacity - the new total amount of resource to allocate to the VM, changing the allocate resource to this new amount. It doesn't increase the current allocated VM resource by the given amount, instead, it changes the VM allocated resource to that specific amount
        Returns:
        $true if the resource could be allocated; $false otherwise
      • allocateResourceForVm

        public boolean allocateResourceForVm​(Vm vm,
                                             double newTotalVmResource)
        Description copied from interface: ResourceProvisioner
        Allocates an amount of the physical resource for a VM, changing the current capacity of the virtual resource to the given amount.

        This method is just a shorthand to avoid explicitly converting a double to long.

        Parameters:
        vm - the virtual machine for which the resource is being allocated
        newTotalVmResource - the new total amount of resource to allocate to the VM, changing the allocate resource to this new amount. It doesn't increase the current allocated VM resource by the given amount, instead, it changes the VM allocated resource to that specific amount
        Returns:
        $true if the resource could be allocated; $false otherwise
        See Also:
        ResourceProvisioner.allocateResourceForVm(Vm, long)
      • deallocateResourceForVm

        public boolean deallocateResourceForVm​(Vm vm)
        Description copied from interface: ResourceProvisioner
        Releases all the allocated amount of the resource used by a VM.
        Parameters:
        vm - the vm
        Returns:
        true if the resource was deallocated; false if the related resource has never been allocated to the given VM.
      • deallocateResourceForVmAndSetAllocationMapEntryToZero

        protected long deallocateResourceForVmAndSetAllocationMapEntryToZero​(Vm vm)
        Description copied from class: ResourceProvisionerAbstract
        Deallocate the resource for the given VM, without removing the VM fro the allocation map. The resource usage of the VM entry on the allocation map is just set to 0.
        Specified by:
        deallocateResourceForVmAndSetAllocationMapEntryToZero in class ResourceProvisionerAbstract
        Parameters:
        vm - the VM to deallocate resource
        Returns:
        the amount of allocated VM resource or zero if VM is not found
      • isSuitableForVm

        public boolean isSuitableForVm​(Vm vm,
                                       long newVmTotalAllocatedResource)
        Description copied from interface: ResourceProvisioner
        Checks if it is possible to change the current allocated resource for a given VM to a new amount, depending on the available physical resource remaining.
        Parameters:
        vm - the vm to check if there is enough available resource on the host to change the allocated amount for the VM
        newVmTotalAllocatedResource - the new total amount of resource to allocate for the VM.
        Returns:
        true, if it is possible to allocate the new total VM resource; false otherwise