All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cloudbus.cloudsim.selectionpolicies.VmSelectionPolicyMinimumMigrationTime Maven / Gradle / Ivy

Go to download

CloudSim Plus: A modern, highly extensible and easier-to-use Java 8+ Framework for Modeling and Simulation of Cloud Computing Infrastructures and Services

There is a newer version: 8.0.0
Show newest version
/*
 * 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;

import org.cloudbus.cloudsim.hosts.Host;
import org.cloudbus.cloudsim.vms.Vm;

import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;

import static java.util.Comparator.comparingLong;

/**
 * A VM selection policy that selects for migration the VM with Minimum Migration Time (MMT).
 *
 * 
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 class VmSelectionPolicyMinimumMigrationTime implements VmSelectionPolicy { @Override public Optional getVmToMigrate(final Host host) { final List migratableVms = host.getMigratableVms(); if (migratableVms.isEmpty()) { return Optional.empty(); } /* TODO It must compute the migration time based on the current RAM usage, not the capacity. * It should also consider the VM size.*/ final Comparator vmComparator = comparingLong(vm -> vm.getRam().getCapacity()); final Predicate vmPredicate = Vm::isInMigration; return migratableVms .stream() .filter(vmPredicate.negate()) .min(vmComparator); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy