/** * Check the compatibility of the action with a source and a destination configuration. The VM * must be initially running and not be a part of the destination configuration * * @param src the source configuration * @param dst the configuration to reach * @return true if the action is compatible with the configurations */ @Override public boolean isCompatibleWith(Configuration src, Configuration dst) { return (!src.isRunning(getVirtualMachine()) || dst.isRunning(getVirtualMachine()) || dst.isWaiting(getVirtualMachine()) || dst.isSleeping(getVirtualMachine())); }
/** * Check the compatibility of the action with a source configuration. The hosting node must be * online and running the virtual machine * * @param src the configuration to check * @return {@code true} if the action is compatible */ @Override public boolean isCompatibleWith(Configuration src) { return (src.isOnline(getHost()) && src.isRunning(getVirtualMachine()) && src.getLocation(getVirtualMachine()).equals(getHost())); }
/** * Apply the action by removing the virtual machine from a specified configuration. * * @param c the configuration */ @Override public boolean apply(Configuration c) { c.remove(this.getVirtualMachine()); return true; }