Class ClusterConfiguration
- All Implemented Interfaces:
Serializable
,Comparable<ClusterConfiguration>
- DomU onto primary Dom0
- DomU onto secondary Dom0
- DomUDisk onto a set of primary physical volumes
- DomUDisk onto a set of secondary physical volumes
The heap space used should be as small as possible to allow the maximum number of possible configurations to be explored.
Everything in ClusterConfiguration is not thread-safe, if using from multiple threads, external synchronization is required.
DomU VMs may only be allocated to Dom0 machines in the same cluster.
- Author:
- AO Industries, Inc.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddDomUConfiguration
(DomU domU, Dom0 primaryDom0, Dom0 secondaryDom0) Adds a domU to the configuration.addDomUDiskConfiguration
(DomU domU, DomUDisk domUDisk, List<PhysicalVolumeConfiguration> primaryPhysicalVolumeConfigurations, List<PhysicalVolumeConfiguration> secondaryPhysicalVolumeConfigurations) Adds a domU disk to the configuration.int
compareTo
(ClusterConfiguration other) Sorted ascending.boolean
equals
(ClusterConfiguration other) Performs a deep field-by-field comparison to see if two configurations are identical in every way.boolean
Performs a deep field-by-field comparison to see if two configurations are identical in every way.getDomUConfiguration
(DomU domU) Gets the cluster configuration for the provided DomU.Gets an unmodifiable list of all configured DomUs.int
hashCode()
liveMigrate
(DomU domU) Swaps the primary and secondary for the provided DomU and returns the new cluster configuration.moveSecondary
(DomU domU, Dom0 newSecondaryDom0) Moves the secondary to another machine if it is possible to map all of the extents for the DomUDisks onto free physical volumes in Dom0.toString()
-
Constructor Details
-
ClusterConfiguration
Creates a newClusterConfiguration
.
-
-
Method Details
-
toString
-
getCluster
-
getDomUConfigurations
Gets an unmodifiable list of all configured DomUs. -
getDomUConfiguration
Gets the cluster configuration for the provided DomU. To conserve heap space at the expense of more time, this runs in O(n).- Returns:
- the DomUConfiguration or null if not found
-
addDomUConfiguration
Adds a domU to the configuration. -
addDomUDiskConfiguration
public ClusterConfiguration addDomUDiskConfiguration(DomU domU, DomUDisk domUDisk, List<PhysicalVolumeConfiguration> primaryPhysicalVolumeConfigurations, List<PhysicalVolumeConfiguration> secondaryPhysicalVolumeConfigurations) Adds a domU disk to the configuration. -
liveMigrate
Swaps the primary and secondary for the provided DomU and returns the new cluster configuration. -
moveSecondary
Moves the secondary to another machine if it is possible to map all of the extents for the DomUDisks onto free physical volumes in Dom0.Because there can be many mappings between DomUDisk and PhysicalVolumes, in factorial combinations, this method has a large impact on the branch factor for the cluster optimizer. However, it also affects which solutions may be found or transitioned through in the path to a solution.
This implementation is meant to be as simple as possible. It focuses on reducing the search space while possibly missing some valid configurations. It works as follows:
- Make sure all DomUDisk have the same minspeed - error otherwise.
- Find all unallocated physical volumes, sort by speed, device, partition
- Work through each Dom0Disk as a starting point
- Allocate all the extents of the free physical volumes in order on each Dom0Disk in order until VM mapped
- If mapping complete add to results (avoid allocation to exactly equal resources in exactly equal ways)
- If mapping incomplete return results found
In the future, a more advanced configuration could try to reduce the combinations while (hopefully) not losing any possible solution by:
- Always allocating DomUDisks of the same min speed, extents, and weight in order by device
- Always allocating to the physical volumes in order by speed, device, partition
- Always allocating from the first unused physical volumes on a single Dom0Disk
- Always consuming as many of the physical volumes in a single Dom0Disk as possible
- Not returning multiple results onto different Dom0Disk that have the same speed, size, and overall allocation
- Returns:
- the new configuration(s)
-
equals
Performs a deep field-by-field comparison to see if two configurations are identical in every way. -
equals
Performs a deep field-by-field comparison to see if two configurations are identical in every way.- See Also:
-
hashCode
public int hashCode() -
compareTo
Sorted ascending. By:- cluster
- Specified by:
compareTo
in interfaceComparable<ClusterConfiguration>
-