Class MigrateVM

java.lang.Object
org.btrplace.plan.event.Action
org.btrplace.plan.event.MigrateVM
All Implemented Interfaces:
Event, RunningVMPlacement, VMEvent

public class MigrateVM
extends Action
implements RunningVMPlacement
Migrate a running VM from one online node to another one. It is possible to parametrise the action with the amount of bandwidth to reserve to perform the operation.
Author:
Fabien Hermenier
  • Constructor Details

    • MigrateVM

      public MigrateVM​(VM v, Node from, Node to, int start, int end, int bandwidth)
      Make a new action.
      Parameters:
      v - the VM to migrate
      from - the node the VM is currently running on
      to - the node where to place the VM
      start - the moment the action will consume
      end - the moment the action will stop
      bandwidth - the reserved bandwidth in MB. Integer.MAX_VALUE for an unlimited bandwidth
    • MigrateVM

      public MigrateVM​(VM v, Node from, Node to, int start, int end)
      Make a new action with an unlimited bandwidth.
      Parameters:
      v - the VM to migrate
      from - the node the VM is currently running on
      to - the node where to place the VM
      start - the moment the action will consume
      end - the moment the action will stop
  • Method Details

    • getSourceNode

      public Node getSourceNode()
      Get the source node that is currently hosting the VM.
      Returns:
      the node identifier
    • getBandwidth

      public int getBandwidth()
      Get the bandwidth reserved for the migration
      Returns:
      an amount in megabytes. Integer.MAX_VALUE for an unlimited bandwidth
    • getDestinationNode

      public Node getDestinationNode()
      Description copied from interface: RunningVMPlacement
      Get the destination node for the VM.
      Specified by:
      getDestinationNode in interface RunningVMPlacement
      Returns:
      the node identifier
    • getVM

      public VM getVM()
      Description copied from interface: VMEvent
      Get the VM to involved in the action.
      Specified by:
      getVM in interface VMEvent
      Returns:
      the VM identifier
    • applyAction

      public boolean applyAction​(Model i)
      Make the VM running on the destination node in the given model.
      Specified by:
      applyAction in class Action
      Parameters:
      i - the model to alter with the action
      Returns:
      true iff the VM is running on the destination node
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Action
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Action
    • pretty

      public String pretty()
      Description copied from class: Action
      Pretty print of the action.
      Specified by:
      pretty in class Action
      Returns:
      a String
    • visit

      public Object visit​(ActionVisitor v)
      Description copied from interface: Event
      Notify a visitor to visit the action.
      Specified by:
      visit in interface Event
      Parameters:
      v - the visitor to notify
      Returns:
      the visit result
    • setBandwidth

      public boolean setBandwidth​(int bandwidth)
      Set the bandwidth to reserve for the operation. The value is in MB
      Parameters:
      bandwidth - a positive value. Integer.MAX_VALUE for an unlimited bandwidth
      Returns:
      true if the value was positive