use of org.btrplace.btrpsl.element.BtrpElement in project scheduler by btrplace.
the class TemplateAssignment method addVM.
private void addVM(String tplName, String id, Map<String, String> opts) {
try {
Element el = namingServiceVMs.resolve(id);
if (el == null) {
VM vm = mo.newVM();
mo.getMapping().addReadyVM(vm);
// We add the VM to the $me variable
if (vm == null) {
ignoreError("No UUID to create node '" + id + "'");
} else {
namingServiceVMs.register(vm, id);
el = vm;
((BtrpSet) syms.getSymbol(SymbolsTable.ME)).getValues().add(new BtrpElement(BtrpOperand.Type.VM, id, el));
}
}
tpls.check(script, tplName, el, opts);
if (!script.add(new BtrpElement(BtrpOperand.Type.VM, id, el))) {
ignoreError("VM '" + id + "' already created");
}
} catch (ElementBuilderException ex) {
ignoreError(ex);
}
}
Aggregations