NetworkVmAllocationPolicy (cloudsim 3.1-SNAPSHOT API)

org.cloudbus.cloudsim.network.datacenter

## Class NetworkVmAllocationPolicy

- java.lang.Object
- - org.cloudbus.cloudsim.VmAllocationPolicy
  - - org.cloudbus.cloudsim.network.datacenter.NetworkVmAllocationPolicy

-     public class NetworkVmAllocationPolicy
      extends VmAllocationPolicy

  NetworkVmAllocationPolicy is an VmAllocationPolicy that chooses, as the host for a VM, the host with less PEs in use.
  Since:
    CloudSim Toolkit 1.0
  Author:
    Rodrigo N. Calheiros, Anton Beloglazov, Saurabh Kumar Garg

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NetworkVmAllocationPolicy(List<? extends Host> list)` Creates the new VmAllocationPolicySimple object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allocateHostForVm(Vm vm)` Allocates a host for a given VM.
    `boolean` | `allocateHostForVm(Vm vm, Host host)` Allocates a specified host for a given VM.
    `void` | `deallocateHostForVm(Vm vm)` Releases the host used by a VM.
    `protected List<Integer>` | `getFreePes()` Gets the free pes.
    `Host` | `getHost(int vmId, int userId)` Gets the host that is executing the given VM belonging to the given user.
    `Host` | `getHost(Vm vm)` Gets the host that is executing the given VM belonging to the given user.
    `protected double` | `getMaxUtilizationAfterAllocation(NetworkHost host, Vm vm)`
    `protected Map<String,Integer>` | `getUsedPes()` Gets the used pes.
    `Map<String,Host>` | `getVmTable()` Gets the vm table.
    `List<Map<String,Object>>` | `optimizeAllocation(List<? extends Vm> vmList)` Optimize allocation of the VMs according to current utilization.
    `protected void` | `setFreePes(List<Integer> freePes)` Sets the free pes.
    `protected void` | `setUsedPes(Map<String,Integer> usedPes)` Sets the used pes.
    `protected void` | `setVmTable(Map<String,Host> vmTable)` Sets the vm table.

    - ### Methods inherited from class org.cloudbus.cloudsim.VmAllocationPolicy

      `getHostList, setHostList`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NetworkVmAllocationPolicy

          public NetworkVmAllocationPolicy(List<? extends Host> list)

      Creates the new VmAllocationPolicySimple object.
      Parameters:
        `list` - the list

  - ### Method Detail

    - #### allocateHostForVm

          public boolean allocateHostForVm(Vm vm)

      Allocates a host for a given VM.
      Specified by:
        `allocateHostForVm` in class `VmAllocationPolicy`
      Parameters:
        `vm` - VM specification
      Returns:
        $true if the host could be allocated; $false otherwise

    - #### getMaxUtilizationAfterAllocation

          protected double getMaxUtilizationAfterAllocation(NetworkHost host,
                                                Vm vm)

    - #### deallocateHostForVm

          public void deallocateHostForVm(Vm vm)

      Releases the host used by a VM.
      Specified by:
        `deallocateHostForVm` in class `VmAllocationPolicy`
      Parameters:
        `vm` - the vm

    - #### getHost

          public Host getHost(Vm vm)

      Gets the host that is executing the given VM belonging to the given user.
      Specified by:
        `getHost` in class `VmAllocationPolicy`
      Parameters:
        `vm` - the vm
      Returns:
        the Host with the given vmID and userID; $null if not found

    - #### getHost

          public Host getHost(int vmId,
                     int userId)

      Gets the host that is executing the given VM belonging to the given user.
      Specified by:
        `getHost` in class `VmAllocationPolicy`
      Parameters:
        `vmId` - the vm id
        `userId` - the user id
      Returns:
        the Host with the given vmID and userID; $null if not found

    - #### getVmTable

          public Map<String,Host> getVmTable()

      Gets the vm table.
      Returns:
        the vm table

    - #### setVmTable

          protected void setVmTable(Map<String,Host> vmTable)

      Sets the vm table.
      Parameters:
        `vmTable` - the vm table

    - #### getUsedPes

          protected Map<String,Integer> getUsedPes()

      Gets the used pes.
      Returns:
        the used pes

    - #### setUsedPes

          protected void setUsedPes(Map<String,Integer> usedPes)

      Sets the used pes.
      Parameters:
        `usedPes` - the used pes

    - #### getFreePes

          protected List<Integer> getFreePes()

      Gets the free pes.
      Returns:
        the free pes

    - #### setFreePes

          protected void setFreePes(List<Integer> freePes)

      Sets the free pes.
      Parameters:
        `freePes` - the new free pes

    - #### optimizeAllocation

          public List<Map<String,Object>> optimizeAllocation(List<? extends Vm> vmList)

      Description copied from class: `VmAllocationPolicy`
      Optimize allocation of the VMs according to current utilization.
      Specified by:
        `optimizeAllocation` in class `VmAllocationPolicy`
      Parameters:
        `vmList` - the vm list
      Returns:
        the array list< hash map< string, object>>

    - #### allocateHostForVm

          public boolean allocateHostForVm(Vm vm,
                                  Host host)

      Description copied from class: `VmAllocationPolicy`
      Allocates a specified host for a given VM.
      Specified by:
        `allocateHostForVm` in class `VmAllocationPolicy`
      Parameters:
        `vm` - virtual machine which the host is reserved to
      Returns:
        $true if the host could be allocated; $false otherwise

Copyright © 2013 The Cloud Computing and Distributed Systems (CLOUDS) Laboratory, The University of Melbourne. All Rights Reserved.