orca.cod.control
Class BestFitIdControlChange

java.lang.Object
  extended by orca.cod.control.IdControlChange
      extended by orca.cod.control.BestFitIdControlChange
All Implemented Interfaces:
IResourceControl, IInitialize, IRecover, ISerialize

public class BestFitIdControlChange
extends IdControlChange


Nested Class Summary
 
Nested classes/interfaces inherited from class orca.cod.control.IdControlChange
IdControlChange.ControlState
 
Field Summary
protected  java.util.Hashtable<ID,Machine> machines
          Hashtable of machines keyed by their id
 
Fields inherited from class orca.cod.control.IdControlChange
actor, authority, calendar, guid, identifiers, IndexBandwidth, IndexCpu, IndexMemory, IndexStorage, inplace, lazyClose, logger, machinesFailed, machinesFree, machinesHosting, migrations, nodes, PropertyBandwidth, PropertyCpu, PropertyDimensions, PropertyGuid, PropertyMaxPrefix, PropertyMemory, PropertyNamePrefix, PropertyResourceType, PropertyStorage, restores, saves, type
 
Constructor Summary
BestFitIdControlChange()
           
 
Method Summary
protected  void addToList(Machine entry, java.util.ArrayList<Machine> list)
          Add an entry to the linked list
protected  NodeGroup allocateNodes(java.util.Vector<ID> ids, long[] shares, AuthorityReservation reservation)
          Allocates new nodes
protected  void attachUpdate(Node n)
           
 ResourceSet correctFailed(ResourceSet rset)
           
protected  Node createNode(long[] capacity, ID id, Machine m)
           
 void donate(ResourceSet set)
          Note: must be able to handle multiple donates of the same resources
protected  void fixOrder(java.util.ArrayList<Machine> list, Machine entry)
           
protected  long[] getAvailable(long[] shares, int count)
           
protected  Machine getLogicalHost(ID id)
          Obtain a machine for this logical id.
protected  java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> getLogicallyHosted(NodeSet nset)
           
protected  long[] getMinSpareSharesPerHostedNode(java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> table)
           
protected  java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> getPhysicallyHosted(NodeSet nset)
           
protected  boolean handleChangedIds(NodeSet nodes, java.util.Vector<ID> ids, long[] currentShares, AuthorityReservation reservation)
           
protected  void migrateMachines(NodeSet nset, AuthorityReservation r)
           
protected  boolean migrateNodes(NodeSet nset)
          Migrates the nodes from the NodeSet to their logical machines.
protected  int migrateNodesFromMachine(Machine machine)
          Migrate all VMs hosted on this machine that do not belong to the given reservation.
protected  long[] min(long[] a, long[] b)
           
protected  NodeGroup modify(AuthorityReservation r, NodeSet nset, long[] capacity, long[] currentCapacity)
           
protected  boolean pendingRestore(AuthorityReservation r)
          Checks if nodes in this reservation need to be restored
protected  void release(Node node, boolean remove)
           
protected  void release(Node node, boolean remove, boolean unmapLogical, boolean removeFromNodes)
           
protected  void releaseMigrated(Node node)
          Cannot release logical parts because just migrating the machine.
protected  void releaseNoIds(Node node)
           
protected  void releaseResized(Node n)
           
protected  void releaseSaved(Node n)
           
protected  void removeFromList(Machine entry, java.util.ArrayList<Machine> list)
          Remove the entry from the linked list
 
Methods inherited from class orca.cod.control.IdControlChange
assign, available, calculateChanges, checkLazyClose, configure, convert, correctDeficit, dumpStats, eject, fail, findIndex, forceClose, freed, getDb, getGrowing, getGuid, getIdentifiers, getIds, getInUse, getMachine, getMachineForNodeRevisit, getNewIds, getReservation, getShares, getShares, getState, getToModify, getTypes, handleChangedIds, handleRelease, hasChanged, initialize, inProgress, isExpired, modify, release, release, release, releaseClosed, reserveHostSharesRevisit, reset, revisit, revisit, revisitModify, save, save, selectExtract, selectExtract, setActor, setShares, setShares, setType, subtract, unavailable, zero
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

machines

protected java.util.Hashtable<ID,Machine> machines
Hashtable of machines keyed by their id

Constructor Detail

BestFitIdControlChange

public BestFitIdControlChange()
Method Detail

donate

public void donate(ResourceSet set)
            throws java.lang.Exception
Description copied from class: IdControlChange
Note: must be able to handle multiple donates of the same resources

Specified by:
donate in interface IResourceControl
Overrides:
donate in class IdControlChange
Throws:
java.lang.Exception

allocateNodes

protected NodeGroup allocateNodes(java.util.Vector<ID> ids,
                                  long[] shares,
                                  AuthorityReservation reservation)
                           throws java.lang.Exception
Description copied from class: IdControlChange
Allocates new nodes

Overrides:
allocateNodes in class IdControlChange
Parameters:
ids - list of logical ids to use
shares - resource shares
reservation - for which reservation
Returns:
a node group with newly allocated nodes. null if cannot satisfy request
Throws:
java.lang.Exception - if an error occurs

modify

protected NodeGroup modify(AuthorityReservation r,
                           NodeSet nset,
                           long[] capacity,
                           long[] currentCapacity)
                    throws java.lang.Exception
Throws:
java.lang.Exception

handleChangedIds

protected boolean handleChangedIds(NodeSet nodes,
                                   java.util.Vector<ID> ids,
                                   long[] currentShares,
                                   AuthorityReservation reservation)
                            throws java.lang.Exception
Throws:
java.lang.Exception

pendingRestore

protected boolean pendingRestore(AuthorityReservation r)
                          throws java.lang.Exception
Checks if nodes in this reservation need to be restored

Overrides:
pendingRestore in class IdControlChange
Parameters:
r - the reservation
Returns:
true if at least one restore operation was scheduled or still has to be scheduled (insufficient capacity at the destination host)
Throws:
java.lang.Exception

releaseMigrated

protected void releaseMigrated(Node node)
                        throws java.lang.Exception
Cannot release logical parts because just migrating the machine.

Overrides:
releaseMigrated in class IdControlChange
Parameters:
node -
Throws:
java.lang.Exception

releaseSaved

protected void releaseSaved(Node n)
                     throws java.lang.Exception
Overrides:
releaseSaved in class IdControlChange
Throws:
java.lang.Exception

releaseResized

protected void releaseResized(Node n)
                       throws java.lang.Exception
Overrides:
releaseResized in class IdControlChange
Throws:
java.lang.Exception

release

protected void release(Node node,
                       boolean remove)
                throws java.lang.Exception
Overrides:
release in class IdControlChange
Throws:
java.lang.Exception

releaseNoIds

protected void releaseNoIds(Node node)
                     throws java.lang.Exception
Throws:
java.lang.Exception

release

protected void release(Node node,
                       boolean remove,
                       boolean unmapLogical,
                       boolean removeFromNodes)
                throws java.lang.Exception
Throws:
java.lang.Exception

getLogicalHost

protected Machine getLogicalHost(ID id)
                          throws java.lang.Exception
Obtain a machine for this logical id. If there is no machine currently assigned to this id, a machine will be selected from machinesFree and will be assigned the given logical id.

Throws:
java.lang.Exception

migrateNodesFromMachine

protected int migrateNodesFromMachine(Machine machine)
                               throws java.lang.Exception
Migrate all VMs hosted on this machine that do not belong to the given reservation. Returns null if at least one node is scheduled for migration. Returns a vector if no node is scheduled for migration and there are nodes we just allocated that need to be moved.

Parameters:
machine -
r -
gained -
Returns:
Throws:
java.lang.Exception

migrateNodes

protected boolean migrateNodes(NodeSet nset)
Migrates the nodes from the NodeSet to their logical machines. Called from modify.

Parameters:
nset -
Returns:

migrateMachines

protected void migrateMachines(NodeSet nset,
                               AuthorityReservation r)
                        throws java.lang.Exception
Throws:
java.lang.Exception

getLogicallyHosted

protected java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> getLogicallyHosted(NodeSet nset)

getPhysicallyHosted

protected java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> getPhysicallyHosted(NodeSet nset)

getAvailable

protected long[] getAvailable(long[] shares,
                              int count)

getMinSpareSharesPerHostedNode

protected long[] getMinSpareSharesPerHostedNode(java.util.Hashtable<ID,orca.cod.control.BestFitIdControlChange.CountHelper> table)

min

protected long[] min(long[] a,
                     long[] b)

attachUpdate

protected void attachUpdate(Node n)

createNode

protected Node createNode(long[] capacity,
                          ID id,
                          Machine m)

removeFromList

protected void removeFromList(Machine entry,
                              java.util.ArrayList<Machine> list)
Remove the entry from the linked list

Parameters:
entry -

addToList

protected void addToList(Machine entry,
                         java.util.ArrayList<Machine> list)
Add an entry to the linked list

Parameters:
entry -

fixOrder

protected void fixOrder(java.util.ArrayList<Machine> list,
                        Machine entry)

correctFailed

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


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