Interface VmCloner

All Known Implementing Classes:
VmClonerSimple

public interface VmCloner
Enables cloning a Vm which was destroyed due to a Host Failure. It provides all the features to clone a Vm, simulating the creating of another Vm from an snapshot of the failed one. It also enables re-creating Cloudlets which were running inside the failed VM.
Since:
CloudSim Plus 1.2.3
Author:
raysaoliveira
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static VmCloner NULL  
  • Method Summary

    Modifier and Type Method Description
    java.util.Map.Entry<Vm,​java.util.List<Cloudlet>> clone​(Vm sourceVm)
    Clones a given Vm using the Vm Cloner Function and their Cloudlets using the Cloudlets Cloner Function, binding the cloned Cloudlets to the cloned Vm.
    int getClonedVmsNumber()
    Gets the number of VMs cloned so far.
    int getMaxClonesNumber()
    Gets the maximum number of Vm clones to create.
    boolean isMaxClonesNumberReached()
    Checks if the maximum number of Vm clones to be created was reached.
    VmCloner setCloudletsClonerFunction​(java.util.function.Function<Vm,​java.util.List<Cloudlet>> cloudletsClonerFunction)
    Gets the Function to be used to clone Vm's Cloudlets.
    VmCloner setMaxClonesNumber​(int maxClonesNumber)  
    VmCloner setVmClonerFunction​(java.util.function.UnaryOperator<Vm> vmClonerFunction)
    Sets the UnaryOperator to be used to clone Vms.
  • Field Details

  • Method Details

    • getClonedVmsNumber

      int getClonedVmsNumber()
      Gets the number of VMs cloned so far.
      Returns:
    • clone

      java.util.Map.Entry<Vm,​java.util.List<Cloudlet>> clone​(Vm sourceVm)
      Clones a given Vm using the Vm Cloner Function and their Cloudlets using the Cloudlets Cloner Function, binding the cloned Cloudlets to the cloned Vm.
      Parameters:
      sourceVm - the Vm to be cloned
      Returns:
      a Map.Entry where the key is the cloned Vm and the value is the List of cloned Cloudlets.
      See Also:
      setVmClonerFunction(UnaryOperator), setCloudletsClonerFunction(Function)
    • setVmClonerFunction

      VmCloner setVmClonerFunction​(java.util.function.UnaryOperator<Vm> vmClonerFunction)
      Sets the UnaryOperator to be used to clone Vms. It is a Function which, when called, creates a clone of a specific Vm.
      Parameters:
      vmClonerFunction - the Vm cloner Function to set
      Returns:
    • setCloudletsClonerFunction

      VmCloner setCloudletsClonerFunction​(java.util.function.Function<Vm,​java.util.List<Cloudlet>> cloudletsClonerFunction)
      Gets the Function to be used to clone Vm's Cloudlets. When the given Function is called, creates a clone of cloudlets which were running inside a specific Vm.

      Such a Function is used to recreate those Cloudlets inside a clone of the failed VM. In this case, all the Cloudlets are recreated from scratch into the cloned VM. This way, when they are submitted to a broker, they re-start execution from the beginning.

      Parameters:
      cloudletsClonerFunction - the Cloudlets cloner Function to set
      Returns:
    • getMaxClonesNumber

      int getMaxClonesNumber()
      Gets the maximum number of Vm clones to create. For instance, if this value is equal to 2, it means if all VMs from a given broker are destroyed multiple times, a clone will be created only 2 times. If all VMs are destroyed again for the 3rd time, no clone will be created. The default value is 1.
      Returns:
    • isMaxClonesNumberReached

      boolean isMaxClonesNumberReached()
      Checks if the maximum number of Vm clones to be created was reached.
      Returns:
      true if the maximum number of clones was reached, false otherwise
    • setMaxClonesNumber

      VmCloner setMaxClonesNumber​(int maxClonesNumber)