|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceSpreader
hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.MaxMinFairSpreader
hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.MaxMinConsumer
hu.mta.sztaki.lpds.cloud.simulator.iaas.VirtualMachine
public class VirtualMachine
This class represents a single virtual machine in the system. It simulates its behavior. Currently it supports three approaches for VM image storage:
| Nested Class Summary | |
|---|---|
private class |
VirtualMachine.EventSetup
This internal interface is used to customize internal state change actions in the VM class. |
(package private) class |
VirtualMachine.InitialTransferEvent
|
static class |
VirtualMachine.State
|
static interface |
VirtualMachine.StateChange
This interface helps to receive events on status changes in virtual machines. |
static class |
VirtualMachine.StateChangeException
This class is defined to ensure one can differentiate errors that were caused because the functions on the VM class are called in an improper order. |
| Nested classes/interfaces inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceSpreader |
|---|
ResourceSpreader.FreqSyncer, ResourceSpreader.PowerBehaviorChangeListener |
| Field Summary | |
|---|---|
static EnumSet<VirtualMachine.State> |
consumingStates
|
private VirtualMachine.State |
currState
|
private StorageObject |
disk
|
static float |
loadwhilenotrunning
|
static EnumSet<VirtualMachine.State> |
preStartupStates
|
private PhysicalMachine.ResourceAllocation |
ra
|
private StorageObject |
savedmemory
|
private VirtualMachine.EventSetup |
sdEvent
|
private CopyOnWriteArrayList<VirtualMachine.StateChange> |
subscribers
|
private VirtualMachine.EventSetup |
susEvent
|
static EnumSet<VirtualMachine.State> |
suspendedStates
|
private ArrayList<ResourceConsumption> |
suspendedTasks
|
(package private) VirtualMachine.EventSetup |
switchonEvent
|
static EnumSet<VirtualMachine.State> |
transferringStates
|
private VirtualAppliance |
va
|
private Repository |
vasource
|
private Repository |
vatarget
|
| Fields inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceSpreader |
|---|
lastNotifTime, negligableProcessing, perTickProcessingPower, toBeAdded, underProcessing |
| Constructor Summary | |
|---|---|
VirtualMachine(VirtualAppliance va)
Instantiates a VM object |
|
| Method Summary | |
|---|---|
private void |
actualMigration(PhysicalMachine.ResourceAllocation target)
This function is responsible for the actual transfer between the old physical machine and the new one. |
void |
destroy(boolean killTasks)
Destroys the VM, and cleans up all repositories that could contain disk or memory states. |
PhysicalMachine.ResourceAllocation |
getResourceAllocation()
|
VirtualMachine.State |
getState()
Query the current state of the VM |
VirtualAppliance |
getVa()
Queries the VA used by this VM |
private void |
initialTransfer(Repository vasource,
Repository vatarget,
VirtualMachine.EventSetup es)
Ensures the transfer of the VM to the appropriate location. |
protected boolean |
isAcceptableConsumption(ResourceConsumption con)
|
void |
migrate(PhysicalMachine.ResourceAllocation target)
Moves all data necessary for the VMs execution from its current physical machine to another. |
ResourceConsumption |
newComputeTask(double total,
double limit,
ResourceConsumption.ConsumptionEvent e)
|
void |
prepare(Repository vasource,
Repository vatarget)
Prepares the VM so it can be started without the need to clone its VA first. |
private void |
realResume()
|
void |
resume()
Resumes an already suspended VM. |
private void |
resumeAfterMigration(PhysicalMachine.ResourceAllocation target)
This function is called after the disk and memory images of the VM are located on its new hosting repository. |
void |
setNonservable()
If there are not enough resources for the VM currently, to recover from this state (and allow the VM to be rescheduled) just issue a destroy command on the VM |
void |
setResourceAllocation(PhysicalMachine.ResourceAllocation newRA)
|
private void |
setState(VirtualMachine.State newstate)
Always use this function to set the current VM state. |
void |
subscribeStateChange(VirtualMachine.StateChange consumer)
Use this function to get notified about state changes on this VM |
void |
suspend()
Suspends an already running VM. |
private void |
suspend(VirtualMachine.EventSetup ev)
Just like regular suspend but allows eventsetup hooks. |
void |
switchoff(boolean killTasks)
Switches off an already running machine. |
void |
switchOn(PhysicalMachine.ResourceAllocation allocation,
Repository vasource)
Initiates the startup procedure of a VM. |
String |
toString()
|
void |
unsubscribeStateChange(VirtualMachine.StateChange consumer)
Use this function to be no longer notified about state changes on this VM |
| Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.MaxMinConsumer |
|---|
getCounterPart, getSamePart, isConsumer, processSingleConsumption, updateConsumptionLimit |
| Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.MaxMinFairSpreader |
|---|
singleGroupwiseFreqUpdater |
| Methods inherited from class hu.mta.sztaki.lpds.cloud.simulator.iaas.resourcemodel.ResourceSpreader |
|---|
getCurrentPowerBehavior, getPerTickProcessingPower, getSyncer, getTotalProcessed, hashCode, removeTheseConsumptions, setCurrentPowerBehavior, setPerTickProcessingPower, subscribePowerBehaviorChangeEvents, unsubscribePowerBehaviorChangeEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final VirtualMachine.EventSetup sdEvent
private final VirtualMachine.EventSetup susEvent
private VirtualAppliance va
private PhysicalMachine.ResourceAllocation ra
private StorageObject disk
private StorageObject savedmemory
private Repository vasource
private Repository vatarget
public static final EnumSet<VirtualMachine.State> consumingStates
public static final EnumSet<VirtualMachine.State> transferringStates
public static final EnumSet<VirtualMachine.State> suspendedStates
public static final EnumSet<VirtualMachine.State> preStartupStates
private final CopyOnWriteArrayList<VirtualMachine.StateChange> subscribers
private VirtualMachine.State currState
public static final float loadwhilenotrunning
private final ArrayList<ResourceConsumption> suspendedTasks
final VirtualMachine.EventSetup switchonEvent
| Constructor Detail |
|---|
public VirtualMachine(VirtualAppliance va)
va - the virtual appliance that should be the base for this VM| Method Detail |
|---|
private void setState(VirtualMachine.State newstate)
newstate - The new state the VM is in.public VirtualAppliance getVa()
public VirtualMachine.State getState()
public void prepare(Repository vasource,
Repository vatarget)
throws VMManager.VMManagementException,
NetworkNode.NetworkException
vatarget - the disk that will host the VM.vasource - the repository where the VA for this VM is found. If null, the
function assumes it is found in the hosting PM's repository.
VirtualMachine.StateChangeException - if the VM is not destroyed
VMManager.VMManagementException - if the VA transfer failed and the state change was reverted
NetworkNode.NetworkException
private void initialTransfer(Repository vasource,
Repository vatarget,
VirtualMachine.EventSetup es)
throws VMManager.VMManagementException,
NetworkNode.NetworkException
pm - the physical machine that hosts the VM.vasource - the repository where the VA for this VM is found. If null, the
function assumes it is found in the hosting PM's repository.es - The way the VM's state should be changed the function will
fire an event on this channel if the VA is cloned properly
VMManager.VMManagementException - if the VA transfer failed and the state change was reverted
NetworkNode.NetworkException
public void switchOn(PhysicalMachine.ResourceAllocation allocation,
Repository vasource)
throws VMManager.VMManagementException,
NetworkNode.NetworkException
pm - the physical machine that hosts the VM.vasource - the repository where the VA for this VM is found. If null, the
function assumes it is found in the hosting PM's repository.
VirtualMachine.StateChangeException - if the VM is not destroyed or shutdown
VMManager.VMManagementException - if the VA transfer failed and the state change was reverted
NetworkNode.NetworkException
private void resumeAfterMigration(PhysicalMachine.ResourceAllocation target)
throws NetworkNode.NetworkException
target - the new resource allocation on which the resume operation
should take place
VMManager.VMManagementException - in case some errors were reported during the resume operation
at the new physical machine
NetworkNode.NetworkException
private void actualMigration(PhysicalMachine.ResourceAllocation target)
throws NetworkNode.NetworkException
target - the new resource allocation on which the resume operation
should take place
NetworkNode.NetworkException
public void migrate(PhysicalMachine.ResourceAllocation target)
throws VMManager.VMManagementException,
NetworkNode.NetworkException
target - the new resource allocation on which the resume operation
should take place
VirtualMachine.StateChangeException - if the VM is not in running state currently
VMManager.VMManagementException - if the system have had troubles during the suspend operation.
NetworkNode.NetworkException
public void destroy(boolean killTasks)
throws VMManager.VMManagementException
VirtualMachine.StateChangeException - if some parts of the VM are under transfer so it cannot be
determined what to clean up.
VMManager.VMManagementException
public void switchoff(boolean killTasks)
throws VirtualMachine.StateChangeException
VirtualMachine.StateChangeException - if is not running currently
public void suspend()
throws VMManager.VMManagementException,
NetworkNode.NetworkException
VirtualMachine.StateChangeException - if the machine is not in running state
VMManager.VMManagementException - if there is not enough space to store the memory state (first
locally, then locally/remotely depending on the VM storage
scenario
NetworkNode.NetworkException
private void suspend(VirtualMachine.EventSetup ev)
throws VMManager.VMManagementException,
NetworkNode.NetworkException
ev - the eventsetup hook to be used when the suspend operation is
complete.
VirtualMachine.StateChangeException - see at regular suspend
VMManager.VMManagementException - see at regular suspend
NetworkNode.NetworkException
private void realResume()
throws VMManager.VMManagementException,
NetworkNode.NetworkException
VMManager.VMManagementException
NetworkNode.NetworkException
public void resume()
throws VMManager.VMManagementException,
NetworkNode.NetworkException
VirtualMachine.StateChangeException - if the machine is not in suspended state
VMManager.VMManagementException - if there is not enough space to retreive the memory state to
the PM's repository
NetworkNode.NetworkExceptionpublic void subscribeStateChange(VirtualMachine.StateChange consumer)
consumer - the party to be notified when the state changespublic void unsubscribeStateChange(VirtualMachine.StateChange consumer)
consumer - the party who previously received notificationsprotected boolean isAcceptableConsumption(ResourceConsumption con)
isAcceptableConsumption in class ResourceSpreader
public ResourceConsumption newComputeTask(double total,
double limit,
ResourceConsumption.ConsumptionEvent e)
throws VirtualMachine.StateChangeException,
NetworkNode.NetworkException
VirtualMachine.StateChangeException
NetworkNode.NetworkException
public void setResourceAllocation(PhysicalMachine.ResourceAllocation newRA)
throws VMManager.VMManagementException
VMManager.VMManagementExceptionpublic PhysicalMachine.ResourceAllocation getResourceAllocation()
public void setNonservable()
public String toString()
toString in class MaxMinConsumer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||