orca.cod.control
Class XenControl

java.lang.Object
  extended by orca.cod.control.XenControl
All Implemented Interfaces:
IResourceControl, IInitialize, IRecover, ISerialize
Direct Known Subclasses:
XenResizeControl

public class XenControl
extends java.lang.Object
implements IResourceControl

XenControl handles virtual machine reservations (e.g., Xen) for an authority-side mapper (CodMapper). VMs are hosted on inventory nodes running VMMs. Each VM occupies a "sliver" of the hosting node. The key issues are (1) how to bin-pack VMs onto VMMs, and (2) how to assign resources to each sliver. These problems are particularly difficult if reservations "flex" in a way that changes the size of the slivers. The job here is basically to create and release virtual Node objects to represent the virtual machines. Configuration properties (e.g., names and addresses) are assigned on transferIn() of the node to an AuthoritySlice, and the VM is instantiated in the subsequent RAL call from NodeGroup. Currently the allocation policy has the following limitations: - Any flex in a reservation results in a change in the number of VMs, rather than a sliver flex. To flex VM slivers, we need better tracking of slivers, and a way to short-circuit priming of any resources added to the VMs, i.e., AuthorityReservation must distinguish growing VMs from growing the number of VMs in a reservation. - The resources assigned to a VM/sliver are in units of "computons". Computons are simple because they define a fixed "resource ratio" of hardware resources (e.g., CPU:memory:disk following Amdahl's rule). We have no way to allocate slivers with different resource ratios from the same host. The idea of supporting a discrete set of computon types with different ratios has been called "molecules" or "compounds". The current scheme can handle multiple compounds, but it (in essence) statically partitions compound types across the VMM inventory. - VMMs are divided into "pools" indexed by type. Thus each pool must have a different type. All hosting servers (VMMs) in a pool are viewed as equivalent and interchangeable. - Each pool/type has a configured computonsPerNode. Different pools/types may have different computonsPerNode, even if the physical servers in the pools are equivalent. - If type T is a VMM type, then a request for one unit of type T is filled with one VM bound to one computon on a VMM node of type T. For example, a given class of server might be split into multiple pools for small, medium, and large VMs: pools with fewer computonsPerNode host larger VMs. Note also that the resource ratio of each VM is the same as its hosting server, thus we can divide different server classes with different resource ratios (e.g., big memory vs. small memory) into different pools; VMs allocated from the big-memory pool have more memory than those allocated from the small-memory pool.


Field Summary
protected  IActor actor
           
protected  ID guid
           
protected  LoggingTool logger
           
protected  java.util.HashMap<ResourceType,ResourceSet> nodePools
           
protected  java.util.HashMap<ResourceType,BinPool> pools
          Hosting candidates (VMMs) for each VM type are indexed by their free capacity in BinPools, one pool for each type.
static java.lang.String PropertyGuid
           
static java.lang.String PropertyResourceTypePrefix
           
static java.lang.String PropertyResourceTypesCount
           
static java.lang.String ResourceComputonsPrefix
           
 
Constructor Summary
XenControl()
           
 
Method Summary
 ResourceSet assign(AuthorityReservation r)
          Allocates virtual machines to fill a request that has been approved by the mapper.
protected  ResourceSet assign(AuthorityReservation r, ResourceType type, int needed)
           
 void available(ResourceSet rset)
           
 void configSlivers(ResourceType type, int computonsPerNode)
          Indicate that VMM nodes of a particular type are to be broken into a specified number of computons per node.
 void configure(java.util.Properties p)
           
 ResourceSet correctDeficit(AuthorityReservation r)
           
 ResourceSet correctFailed(ResourceSet rset)
           
 void donate(ResourceSet rset)
          Registers server-side VMM inventory.
 void eject(ResourceSet rset)
           
 void freed(ResourceSet rset)
           
 ID getGuid()
           
 ResourceType[] getTypes()
           
protected  NodeGroup groupFromSet(ResourceSet rset)
          Returns the NodeGroup underlying a given resource set.
 void initialize()
          Initializes the object.
protected  void instantiateVMs(NodeGroup group, BinPool pool, int needed, int computons, ResourceType type)
          Fills a NodeGroup with virtual Node objects to fill a virtual reservation request, allocated from selected host nodes in the specified VMM pool.
protected  void internalError(java.lang.String string)
           
protected  void logError(java.lang.String string)
           
 void logException(java.lang.String err, java.lang.Exception e)
           
protected  BinPool poolForRequest(ResourceType type)
          Returns the BinPool with allocation state for VMM inventory of the type matching the passed resource set.
 void release(ResourceSet rset)
          Releases VM resources back to their inventory pool.
protected  void releaseToVMMs(NodeGroup group, BinPool pool)
          Releases the computons held by virtual nodes in a NodeGroup back to their hosting VMMs, and detaches the nodes from the NodeGroup.
 void reset(java.util.Properties p)
          De-serializes the object from the given properties list.
protected  void resetSlivers(java.util.Properties p)
           
protected  void revisit(BinPool pool, NodeGroup inventory, NodeGroup incoming)
          Reallocates the computons held by virtual nodes in a NodeGroup from their hosting VMMs.
 void revisit(IActor actor, java.util.Properties p)
          Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to.
 void revisit(ResourceReservation r)
          Reallocate VM resources from their inventory pool.
 java.util.Properties save()
          Serializes the object into a properties list.
 void save(java.util.Properties p)
          Serializes the object into the given properties list.
protected  void saveSlivers(java.util.Properties p)
           
protected  Node selectAndGetFromVMM(BinPool pool, int computons)
          Selects a VMM to host a new virtual machine, and allocates the requested number of computons from it.
 void setActor(IActor actor)
           
protected  IConcreteSet shrink(AuthorityReservation r, int toRemove)
           
 int unavailable(ResourceSet rset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PropertyResourceTypesCount

public static final java.lang.String PropertyResourceTypesCount
See Also:
Constant Field Values

PropertyResourceTypePrefix

public static final java.lang.String PropertyResourceTypePrefix
See Also:
Constant Field Values

ResourceComputonsPrefix

public static final java.lang.String ResourceComputonsPrefix
See Also:
Constant Field Values

PropertyGuid

public static final java.lang.String PropertyGuid
See Also:
Constant Field Values

guid

protected ID guid

logger

protected LoggingTool logger

pools

protected java.util.HashMap<ResourceType,BinPool> pools
Hosting candidates (VMMs) for each VM type are indexed by their free capacity in BinPools, one pool for each type.


nodePools

protected java.util.HashMap<ResourceType,ResourceSet> nodePools

actor

protected IActor actor
Constructor Detail

XenControl

public XenControl()
Method Detail

setActor

public void setActor(IActor actor)
Specified by:
setActor in interface IResourceControl

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: IInitialize
Initializes the object.

Specified by:
initialize in interface IInitialize
Throws:
java.lang.Exception

configSlivers

public void configSlivers(ResourceType type,
                          int computonsPerNode)
Indicate that VMM nodes of a particular type are to be broken into a specified number of computons per node. Mandatory preconfiguration: exactly once per VMM type.

Parameters:
type - node type
computonsPerNode - how many computons per node

eject

public void eject(ResourceSet rset)
           throws java.lang.Exception
Specified by:
eject in interface IResourceControl
Throws:
java.lang.Exception

available

public void available(ResourceSet rset)
               throws java.lang.Exception
Specified by:
available in interface IResourceControl
Throws:
java.lang.Exception

unavailable

public int unavailable(ResourceSet rset)
                throws java.lang.Exception
Specified by:
unavailable in interface IResourceControl
Throws:
java.lang.Exception

donate

public void donate(ResourceSet rset)
            throws java.lang.Exception
Registers server-side VMM inventory. Note: modifies the passed resource set to reflect number of computons per node.

Specified by:
donate in interface IResourceControl
Parameters:
rset - the resources being donated
Throws:
java.lang.Exception

correctDeficit

public ResourceSet correctDeficit(AuthorityReservation r)
                           throws java.lang.Exception
Specified by:
correctDeficit in interface IResourceControl
Throws:
java.lang.Exception

assign

public ResourceSet assign(AuthorityReservation r)
                   throws java.lang.Exception
Allocates virtual machines to fill a request that has been approved by the mapper.

Specified by:
assign in interface IResourceControl
Parameters:
iset - inventory set to fill request from
needed - number of units needed to fill request
Returns:
a resource set to fill the request (may be partial or empty)
Throws:
java.lang.Exception - with no side effects if error

assign

protected ResourceSet assign(AuthorityReservation r,
                             ResourceType type,
                             int needed)
                      throws java.lang.Exception
Throws:
java.lang.Exception

shrink

protected IConcreteSet shrink(AuthorityReservation r,
                              int toRemove)
                       throws java.lang.Exception
Throws:
java.lang.Exception

freed

public void freed(ResourceSet rset)
           throws java.lang.Exception
Specified by:
freed in interface IResourceControl
Throws:
java.lang.Exception

release

public void release(ResourceSet rset)
             throws java.lang.Exception
Releases VM resources back to their inventory pool. Note: this implementation does not support releasing nodes that represent modifications to existing nodes. Override this method if your control resizes/modifies nodes in a reservation.

Specified by:
release in interface IResourceControl
Parameters:
rset - the resource set being released
Throws:
java.lang.Exception

revisit

public void revisit(ResourceReservation r)
             throws java.lang.Exception
Reallocate VM resources from their inventory pool. Used on reset/recovery.

Specified by:
revisit in interface IResourceControl
Parameters:
rset - the resource set being reallocated
Throws:
java.lang.Exception

instantiateVMs

protected void instantiateVMs(NodeGroup group,
                              BinPool pool,
                              int needed,
                              int computons,
                              ResourceType type)
                       throws java.lang.Exception
Fills a NodeGroup with virtual Node objects to fill a virtual reservation request, allocated from selected host nodes in the specified VMM pool. Throw an exception if the result cannot be fully met: in this case, the partial set is returned, and must be released if it is not to be used.

Parameters:
group - empty NodeGroup to fill with virtual nodes
pool - inventory pool of VMM candidates to allocate from
needed - number of VMs needed
computons - the number of computons per VM
Throws:
java.lang.Exception - if allocation is incomplete

releaseToVMMs

protected void releaseToVMMs(NodeGroup group,
                             BinPool pool)
Releases the computons held by virtual nodes in a NodeGroup back to their hosting VMMs, and detaches the nodes from the NodeGroup.


revisit

protected void revisit(BinPool pool,
                       NodeGroup inventory,
                       NodeGroup incoming)
Reallocates the computons held by virtual nodes in a NodeGroup from their hosting VMMs. Used on reset/recovery.


selectAndGetFromVMM

protected Node selectAndGetFromVMM(BinPool pool,
                                   int computons)
                            throws java.lang.Exception
Selects a VMM to host a new virtual machine, and allocates the requested number of computons from it.

Parameters:
pool - inventory pool of candidate VMMs
computons - number of computons to allocate
Returns:
a virtual node hosted on selected VMM host
Throws:
java.lang.Exception - if no eligible candidates

groupFromSet

protected NodeGroup groupFromSet(ResourceSet rset)
                          throws java.lang.Exception
Returns the NodeGroup underlying a given resource set. The ResourceSet could be a free pool or a resource set for and extend or release. Identical to CodMapper.groupFromSet.

Parameters:
rset - resource set of some type
Returns:
concrete set underlying this resource set
Throws:
java.lang.Exception - if no concrete set, or if not a NodeGroup

poolForRequest

protected BinPool poolForRequest(ResourceType type)
                          throws java.lang.Exception
Returns the BinPool with allocation state for VMM inventory of the type matching the passed resource set.

Parameters:
rset - resource set of some type
Returns:
inventory pool for VMM hosting nodes matching the type
Throws:
java.lang.Exception - if no inventory pool

internalError

protected void internalError(java.lang.String string)
                      throws java.lang.Exception
Throws:
java.lang.Exception

logError

protected void logError(java.lang.String string)

logException

public void logException(java.lang.String err,
                         java.lang.Exception e)

saveSlivers

protected void saveSlivers(java.util.Properties p)
                    throws java.lang.Exception
Throws:
java.lang.Exception

resetSlivers

protected void resetSlivers(java.util.Properties p)
                     throws java.lang.Exception
Throws:
java.lang.Exception

save

public java.util.Properties save()
                          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into a properties list.

Specified by:
save in interface ISerialize
Returns:
properties list representing this object
Throws:
java.lang.Exception

save

public void save(java.util.Properties p)
          throws java.lang.Exception
Description copied from interface: ISerialize
Serializes the object into the given properties list.

Specified by:
save in interface ISerialize
Parameters:
p - properties list to serialize the object into
Throws:
java.lang.Exception

reset

public void reset(java.util.Properties p)
           throws java.lang.Exception
Description copied from interface: ISerialize
De-serializes the object from the given properties list.

Specified by:
reset in interface ISerialize
Parameters:
p - properties list containing the serialized version of the object
Throws:
java.lang.Exception

revisit

public void revisit(IActor actor,
                    java.util.Properties p)
             throws java.lang.Exception
Description copied from interface: IRecover
Recovers state of the component using a previously saved properties list and a references to the actor this component belongs to. The component can use the actor object to access other objects necessary for its complete recovery.

Specified by:
revisit in interface IRecover
Parameters:
actor - actor object the component belongs to
p - properties list containing configuration data about the component
Throws:
java.lang.Exception

getTypes

public ResourceType[] getTypes()
Specified by:
getTypes in interface IResourceControl

configure

public void configure(java.util.Properties p)
               throws java.lang.Exception
Throws:
java.lang.Exception

correctFailed

public ResourceSet correctFailed(ResourceSet rset)
                          throws java.lang.Exception
Specified by:
correctFailed in interface IResourceControl
Throws:
java.lang.Exception

getGuid

public ID getGuid()
Specified by:
getGuid in interface IResourceControl


Copyright © 2007 Network/Internet Computing Lab. All Rights Reserved.