use of com.ms.silverking.cloud.storagepolicy.PolicyParser in project SilverKing by Morgan-Stanley.
the class RingTreeBuilder method main.
public static void main(String[] args) {
try {
if (args.length != 8) {
System.out.println("<topology> <weights> <exclusionList> <ringParentID> <storagePolicyGroup> <storagePolicyName> <HostGroupTableFile> <HostGroup,...>");
} else {
File topoFile;
File weightsFile;
File exclusionFile;
String ringParentID;
File storagePolicyGroupFile;
String storagePolicyName;
RingTree ringTree;
Topology topology;
StoragePolicyGroup storagePolicyGroup;
HostGroupTable hostGroupTable;
Set<String> hostGroups;
topoFile = new File(args[0]);
weightsFile = new File(args[1]);
exclusionFile = new File(args[2]);
ringParentID = args[3];
storagePolicyGroupFile = new File(args[4]);
storagePolicyName = args[5];
topology = TopologyParser.parse(topoFile);
storagePolicyGroup = new PolicyParser().parsePolicyGroup(storagePolicyGroupFile, VersionedDefinition.NO_VERSION);
hostGroupTable = HostGroupTable.parse(args[6], VersionedDefinition.NO_VERSION);
hostGroups = ImmutableSet.copyOf(args[7].split(","));
ringTree = create(new RingTreeRecipe(topology, (Node) topology.getNodeByID(ringParentID), new WeightSpecifications(VersionedDefinition.NO_VERSION).parse(weightsFile), ExclusionSet.parse(exclusionFile), storagePolicyGroup, storagePolicyName, hostGroupTable, hostGroups, 0L, System.currentTimeMillis()));
// TopoReplicationSpecification.parse(replicationFile)));
System.out.println(ringTree);
ringTree.test("10.188.1.1");
ringTree.testDistance("10.188.1.1", "10.188.1.1");
ringTree.testDistance("10.188.1.1", "10.188.1.2");
ringTree.testDistance("10.188.1.1", "10.188.2.2");
ringTree.testDistance("10.188.2.1", "10.188.2.2");
ringTree.testDistance("10.188.2.2", "10.188.2.2");
ringTree.testDistance("10.188.1.1", "blah");
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.ms.silverking.cloud.storagepolicy.PolicyParser in project SilverKing by Morgan-Stanley.
the class TopologyRingCreator method main.
// //////////////////////////////////////////////////
/**
* @param args
*/
public static void main(String[] args) {
try {
if (args.length != 8) {
System.out.println("<topologyFile> <weightSpecsFile> <exclusionList> <nodeID> <storagePolicyGroup> <policyID> <HostGroupTableFile> <HostGroup,...>");
} else {
TopologyRingCreator topologyRingCreator;
Topology topology;
File topologyFile;
File weightSpecsFile;
File exclusionFile;
File storagePolicyGroupFile;
String nodeID;
String policyID;
// Replication replication;
StoragePolicyGroup storagePolicyGroup;
TopologyRing topologyRing;
Node node;
RingTreeRecipe recipe;
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];
storagePolicyGroupFile = new File(args[4]);
policyID = args[5];
storagePolicyGroup = new PolicyParser().parsePolicyGroup(storagePolicyGroupFile, VersionedDefinition.NO_VERSION);
topology = TopologyParser.parse(topologyFile);
topologyRingCreator = new TopologyRingCreator();
hostGroupTable = HostGroupTable.parse(args[6], VersionedDefinition.NO_VERSION);
hostGroups = ImmutableSet.copyOf(args[7].split(","));
recipe = new RingTreeRecipe(topology, topology.getNodeByID(nodeID), new WeightSpecifications(VersionedDefinition.NO_VERSION).parse(weightSpecsFile), ExclusionSet.parse(exclusionFile), storagePolicyGroup, policyID, hostGroupTable, hostGroups, // version not
0L, // this tree
DHTUtil.currentTimeMillis());
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");
topologyRing = topologyRingCreator.reduceDataMovement(topologyRing, topologyRing, recipe);
System.out.println(topologyRing);
}
} catch (Exception e) {
Log.logErrorWarning(e);
}
}
Aggregations