hu.mta.sztaki.lpds.cloud.simulator.iaas
Class IaaSService

java.lang.Object
  extended by hu.mta.sztaki.lpds.cloud.simulator.iaas.IaaSService
All Implemented Interfaces:
PhysicalMachine.StateChangeListener, VMManager<IaaSService,PhysicalMachine>

public class IaaSService
extends Object
implements VMManager<IaaSService,PhysicalMachine>, PhysicalMachine.StateChangeListener

This class represents a single IaaS service. It's tasks are the maintenance and management of the physical machines and the scheduling of the VM requests among the PMs.

Author:
"Gabor Kecskemeti, Distributed and Parallel Systems Group, University of Innsbruck (c) 2013"

Nested Class Summary
static class IaaSService.IaaSHandlingException
          This class represents a generic error that occurred during the operation of the IaaS service.
 
Nested classes/interfaces inherited from interface hu.mta.sztaki.lpds.cloud.simulator.iaas.VMManager
VMManager.CapacityChangeEvent<F>, VMManager.NoSuchVMException, VMManager.VMManagementException
 
Field Summary
private  StateDependentEventHandler<VMManager.CapacityChangeEvent<PhysicalMachine>,List<PhysicalMachine>> capacityListenerManager
           
private  ArrayList<PhysicalMachine> internalMachines
          The order of internal machines is not guaranteed
private  ArrayList<Repository> internalRepositories
          The order of internal repositories is not guaranteed
private  ArrayList<PhysicalMachine> internalRunningMachines
           
 List<PhysicalMachine> machines
           
 PhysicalMachineController pmcontroller
           
private  ResourceConstraints publicRCap
           
private  ResourceConstraints publicTCap
           
 List<Repository> repositories
           
private  AlterableResourceConstraints runningCapacity
           
 List<PhysicalMachine> runningMachines
           
 Scheduler sched
           
private  AlterableResourceConstraints totalCapacity
           
 
Constructor Summary
IaaSService(Class<? extends Scheduler> s, Class<? extends PhysicalMachineController> c)
           
 
Method Summary
 void bulkHostRegistration(List<PhysicalMachine> newPMs)
           
private  PhysicalMachine checkVMHost(VirtualMachine vm)
           
 void deregisterHost(PhysicalMachine pm)
          This function allows the IaaS to reduce in size.
 void deregisterRepository(Repository r)
          This function allows the IaaS to reduce its storage capacities.
 ResourceConstraints getCapacities()
           
 ResourceConstraints getRunningCapacities()
           
 boolean isRegisteredHost(PhysicalMachine pm)
           
 Collection<VirtualMachine> listVMs()
          Provides an overview on the VMs currently in the system
 void migrateVM(VirtualMachine vm, IaaSService target)
          Migrates a VM from the current system to another.
private  void realDeregistration(PhysicalMachine pm)
           
 void reallocateResources(VirtualMachine vm, ResourceConstraints newresources)
          Allows fine-grained resource utilization setup of the particular VM after it was allocated on the system.
 void registerHost(PhysicalMachine pm)
          This function allows the IaaS to grow in size
 void registerRepository(Repository r)
          This function allows the IaaS to grow its storage capacities
 VirtualMachine[] requestVM(VirtualAppliance va, ResourceConstraints rc, Repository vaSource, int count)
           
 VirtualMachine[] requestVM(VirtualAppliance va, ResourceConstraints rc, Repository vaSource, int count, HashMap<String,Object> schedulingConstraints)
          Creates a new VM in the system and immediately returns with a new VM object.
 void stateChanged(PhysicalMachine pm, PhysicalMachine.State oldState, PhysicalMachine.State newState)
           
 void subscribeToCapacityChanges(VMManager.CapacityChangeEvent<PhysicalMachine> e)
           
 void terminateVM(VirtualMachine vm, boolean killTasks)
          Requesting the destruction of a VM in a DESTROYED state will dequeue the VM from the scheduler's request queue.
 String toString()
           
 void unsubscribeFromCapacityChanges(VMManager.CapacityChangeEvent<PhysicalMachine> e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

internalMachines

private final ArrayList<PhysicalMachine> internalMachines
The order of internal machines is not guaranteed


internalRunningMachines

private final ArrayList<PhysicalMachine> internalRunningMachines

machines

public final List<PhysicalMachine> machines

runningMachines

public final List<PhysicalMachine> runningMachines

totalCapacity

private AlterableResourceConstraints totalCapacity

publicTCap

private ResourceConstraints publicTCap

runningCapacity

private AlterableResourceConstraints runningCapacity

publicRCap

private ResourceConstraints publicRCap

capacityListenerManager

private final StateDependentEventHandler<VMManager.CapacityChangeEvent<PhysicalMachine>,List<PhysicalMachine>> capacityListenerManager

internalRepositories

private final ArrayList<Repository> internalRepositories
The order of internal repositories is not guaranteed


repositories

public final List<Repository> repositories

sched

public final Scheduler sched

pmcontroller

public final PhysicalMachineController pmcontroller
Constructor Detail

IaaSService

public IaaSService(Class<? extends Scheduler> s,
                   Class<? extends PhysicalMachineController> c)
            throws InstantiationException,
                   IllegalAccessException,
                   IllegalArgumentException,
                   InvocationTargetException,
                   NoSuchMethodException,
                   SecurityException
Throws:
InstantiationException
IllegalAccessException
IllegalArgumentException
InvocationTargetException
NoSuchMethodException
SecurityException
Method Detail

migrateVM

public void migrateVM(VirtualMachine vm,
                      IaaSService target)
Description copied from interface: VMManager
Migrates a VM from the current system to another. The VM is not going to be running during this period. It will not consume resources on the current system anymore

Specified by:
migrateVM in interface VMManager<IaaSService,PhysicalMachine>
Parameters:
vm - the VM to be relocated
target - the target system that should host the VM in the future

checkVMHost

private PhysicalMachine checkVMHost(VirtualMachine vm)
                             throws VMManager.NoSuchVMException
Throws:
VMManager.NoSuchVMException

reallocateResources

public void reallocateResources(VirtualMachine vm,
                                ResourceConstraints newresources)
                         throws VMManager.NoSuchVMException,
                                VMManager.VMManagementException
Description copied from interface: VMManager
Allows fine-grained resource utilization setup of the particular VM after it was allocated on the system. Even during its runtime. Don't forget that in real VMs resource availability changes might cause troubles. Apply it rarely if you are not sure it will also work in the real world!

Specified by:
reallocateResources in interface VMManager<IaaSService,PhysicalMachine>
Parameters:
vm - The VM to be adjusted
newresources - The new amount of resources needed (this could not only raise the available resources of the VM but also decrease them
Throws:
VMManager.NoSuchVMException - if the request was issued for a VM unknown in the system
VMManager.VMManagementException - if the request cannot be fulfilled for some reason

requestVM

public VirtualMachine[] requestVM(VirtualAppliance va,
                                  ResourceConstraints rc,
                                  Repository vaSource,
                                  int count)
                           throws VMManager.VMManagementException,
                                  NetworkNode.NetworkException
Throws:
VMManager.VMManagementException
NetworkNode.NetworkException

requestVM

public VirtualMachine[] requestVM(VirtualAppliance va,
                                  ResourceConstraints rc,
                                  Repository vaSource,
                                  int count,
                                  HashMap<String,Object> schedulingConstraints)
                           throws VMManager.VMManagementException,
                                  NetworkNode.NetworkException
Description copied from interface: VMManager
Creates a new VM in the system and immediately returns with a new VM object. The user have to check if the VM is actually running through the VM object. Implementors should ensure that the particular VA is accessible for the system before the VM gets started.

Specified by:
requestVM in interface VMManager<IaaSService,PhysicalMachine>
Parameters:
va - the kind of VM to be created
Returns:
the new VM
Throws:
VMManager.VMManagementException - if the request cannot be fulfilled for some reason
NetworkNode.NetworkException

terminateVM

public void terminateVM(VirtualMachine vm,
                        boolean killTasks)
                 throws VMManager.NoSuchVMException,
                        VMManager.VMManagementException
Requesting the destruction of a VM in a DESTROYED state will dequeue the VM from the scheduler's request queue. If the VM was not requested from this IaaSService then a nosuchvmexception is thrown.

Specified by:
terminateVM in interface VMManager<IaaSService,PhysicalMachine>
Parameters:
vm - the VM to be terminated
Throws:
VMManager.NoSuchVMException - if the request was issued for a VM unknown in the system
VMManager.VMManagementException - if the request cannot be fulfilled for some reason

listVMs

public Collection<VirtualMachine> listVMs()
Description copied from interface: VMManager
Provides an overview on the VMs currently in the system

Specified by:
listVMs in interface VMManager<IaaSService,PhysicalMachine>
Returns:
the VMs currently registered with the system (they are either alredy running or will run in the foreseeable future

registerHost

public void registerHost(PhysicalMachine pm)
This function allows the IaaS to grow in size

Parameters:
pm - the new physical machine to be utilized within the system

bulkHostRegistration

public void bulkHostRegistration(List<PhysicalMachine> newPMs)

realDeregistration

private void realDeregistration(PhysicalMachine pm)

deregisterHost

public void deregisterHost(PhysicalMachine pm)
                    throws IaaSService.IaaSHandlingException
This function allows the IaaS to reduce in size.
This function might migrate VMs from the deregistered host to ones remaining in the system. If the deregistered host contains VMs that cannot be migrated, or there is nowhere to migrate the VMs then the function throws an exception. Currently there is no migration implemented!

Parameters:
pm - the physical machine to be dropped from the control of the system
Throws:
IaaSService.IaaSHandlingException

registerRepository

public void registerRepository(Repository r)
This function allows the IaaS to grow its storage capacities

Parameters:
r - the new repository to be utilized within the system

deregisterRepository

public void deregisterRepository(Repository r)
                          throws IaaSService.IaaSHandlingException
This function allows the IaaS to reduce its storage capacities. This function might transfer contents from the deregistered repository to ones remaining in the system. If the deregistered repository contains storage objects that cannot be transferred, or there is nowhere to transfer a few storage objects then the function throws an exception. Currently there is no transfer implemented!

Parameters:
pm - the physical machine to be dropped from the control of the system
Throws:
IaaSService.IaaSHandlingException

getCapacities

public ResourceConstraints getCapacities()
Specified by:
getCapacities in interface VMManager<IaaSService,PhysicalMachine>

getRunningCapacities

public ResourceConstraints getRunningCapacities()

subscribeToCapacityChanges

public void subscribeToCapacityChanges(VMManager.CapacityChangeEvent<PhysicalMachine> e)
Specified by:
subscribeToCapacityChanges in interface VMManager<IaaSService,PhysicalMachine>

unsubscribeFromCapacityChanges

public void unsubscribeFromCapacityChanges(VMManager.CapacityChangeEvent<PhysicalMachine> e)
Specified by:
unsubscribeFromCapacityChanges in interface VMManager<IaaSService,PhysicalMachine>

isRegisteredHost

public boolean isRegisteredHost(PhysicalMachine pm)

toString

public String toString()
Overrides:
toString in class Object

stateChanged

public void stateChanged(PhysicalMachine pm,
                         PhysicalMachine.State oldState,
                         PhysicalMachine.State newState)
Specified by:
stateChanged in interface PhysicalMachine.StateChangeListener


Copyright © 2012–2015 University of Innsbruck & MTA SZTAKI. All rights reserved.