org.cloudbus.cloudsim.selectionpolicies.power.PowerVmSelectionPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudsim-plus Show documentation
Show all versions of cloudsim-plus Show documentation
CloudSim Plus: A modern, highly extensible and easier-to-use Java 8 Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services
/*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009-2012, The University of Melbourne, Australia
*/
package org.cloudbus.cloudsim.selectionpolicies.power;
import java.util.List;
import java.util.stream.Collectors;
import org.cloudbus.cloudsim.hosts.Host;
import org.cloudbus.cloudsim.vms.Vm;
/**
* An abstract VM selection policy used to select VMs from a list of migratable VMs.
* The selection is defined by sub classes.
*
*
If you are using any algorithms, policies or workload included in the power package please cite
* the following paper:
*
*
*
* @author Anton Beloglazov
* @since CloudSim Toolkit 3.0
*/
public abstract class PowerVmSelectionPolicy {
/**
* Gets a VM to migrate from a given host.
*
* @param host the host to get a Vm to migrate from
* @return the vm to migrate or {@link Vm#NULL} if there is not Vm to migrate
*/
public abstract Vm getVmToMigrate(Host host);
/**
* Gets the list of migratable VMs from a given host.
*
* @param host the host to get VMs to migrate from
* @return the list of migratable VMs
*/
protected List getMigratableVms(Host host) {
return host.getVmList().stream()
.filter(vm -> !vm.isInMigration())
.collect(Collectors.toList());
}
}