@Test public void instantiate() { VirtualMachinePool vmPool = new VirtualMachinePool(client); res = vmPool.info(); assertTrue(res.getErrorMessage(), !res.isError()); assertTrue(vmPool.getLength() == 0); String tmpl_str = "NAME = vrtemplate\n" + "CPU = 0.1\n" + "MEMORY = 64\n"; res = Template.allocate(client, tmpl_str); assertTrue(res.getErrorMessage(), !res.isError()); int tmplid = Integer.parseInt(res.getMessage()); res = vrouter.instantiate(3, tmplid); assertTrue(res.getErrorMessage(), !res.isError()); res = vmPool.info(); assertTrue(res.getErrorMessage(), !res.isError()); assertTrue(vmPool.getLength() == 3); }
/** * Allocates a new VM in OpenNebula from a registered Template. * * @param client XML-RPC Client. * @param template The source Template. * @return If successful the message contains the associated id generated for this VM. */ public static OneResponse allocateFromTemplate(Client client, Template template) { return allocateFromTemplate(client, template.id()); }