Ejemplo n.º 1
0
  private void make(Configuration cfg) {

    VJob v = new BasicPlasmaVJob("vappHA");

    ManagedElementSet<VirtualMachine> t1 = new SimpleManagedElementSet<VirtualMachine>();
    t1.add(cfg.getAllVirtualMachines().get("vappHA.VM1"));
    t1.add(cfg.getAllVirtualMachines().get("vappHA.VM2"));
    t1.add(cfg.getAllVirtualMachines().get("vappHA.VM3"));
    v.addConstraint(new ContinuousSpread(t1));
    v.addVirtualMachine(cfg.getAllVirtualMachines().get("vappHA.VM10"));
    v.addVirtualMachine(cfg.getAllVirtualMachines().get("vappHA.top"));
    v.addVirtualMachine(cfg.getAllVirtualMachines().get("vappHA.middle"));
    ManagedElementSet<Node> ns = new SimpleManagedElementSet<Node>();
    ns.add(cfg.getOnlines().get("node-1"));
    ns.add(cfg.getOnlines().get("node-2"));
    v.addConstraint(new Capacity(ns, 15));

    ManagedElementSet<Node> ns2 = new SimpleManagedElementSet<Node>();
    ns2.add(cfg.getOnlines().get("node-3"));
    ns2.add(cfg.getOnlines().get("node-4"));
    Set<ManagedElementSet<Node>> x = new HashSet<ManagedElementSet<Node>>();
    x.add(ns);
    x.add(ns2);
    v.addConstraint(new Among(t1, x));
    v.addConstraint(new Ban(t1, ns2));
    try {
      ProtobufVJobSerializer.getInstance().write(v, RESOURCE);
    } catch (Exception e) {
      Assert.fail(e.getMessage(), e);
    }
  }