use of com.ms.silverking.cloud.toporing.RingTreeRecipe in project SilverKing by Morgan-Stanley.
the class TestTopoRingCreator method main.
public static void main(String[] args) {
try {
if (args.length != 8) {
System.out.println("<topologyFile> <weightSpecsFile> <exclusionList> <nodeID> <storagePolicyGroup1,...> <policyID> <HostGroupTableFile> <HostGroup,...>");
} else {
TopologyRingCreator topologyRingCreator;
Topology topology;
File topologyFile;
File weightSpecsFile;
File exclusionFile;
String nodeID;
String policyID;
// Replication replication;
StoragePolicyGroup[] storagePolicyGroups;
TopologyRing lastRing;
HostGroupTable hostGroupTable;
Set<String> hostGroups;
// Log.setLevelAll();
topologyFile = new File(args[0]);
weightSpecsFile = new File(args[1]);
exclusionFile = new File(args[2]);
nodeID = args[3];
storagePolicyGroups = parseStoragePolicyGroups(args[4]);
policyID = args[5];
topology = TopologyParser.parse(topologyFile);
topologyRingCreator = new TopologyRingCreator();
hostGroupTable = HostGroupTable.parse(args[6], VersionedDefinition.NO_VERSION);
hostGroups = ImmutableSet.copyOf(args[7].split(","));
lastRing = null;
for (StoragePolicyGroup spGroup : storagePolicyGroups) {
RingTreeRecipe recipe;
TopologyRing topologyRing;
recipe = new RingTreeRecipe(topology, topology.getNodeByID(nodeID), new WeightSpecifications(VersionedDefinition.NO_VERSION).parse(weightSpecsFile), ExclusionSet.parse(exclusionFile), spGroup, policyID, hostGroupTable, hostGroups, 0L, DHTUtil.currentTimeMillis());
System.out.println("********************************");
System.out.println("RingTreeRecipe: " + recipe);
topologyRing = topologyRingCreator.create(recipe, nodeID);
System.out.println("\n\nTopologyRing:\n");
System.out.println(topologyRing);
System.out.println("\n\n");
if (lastRing != null) {
topologyRing = topologyRingCreator.reduceDataMovement(lastRing, topologyRing, recipe);
System.out.println(topologyRing);
}
lastRing = topologyRing;
}
}
} catch (Exception e) {
Log.logErrorWarning(e);
}
}
Aggregations