diff --git a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java index 3c140283a3..c56716cf9b 100644 --- a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java +++ b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/strategy/LibvirtComputeServiceAdapter.java @@ -46,7 +46,29 @@ public class LibvirtComputeServiceAdapter implements ComputeServiceAdaptertest" + "abcf2039-a9f1-a659-7f91-e0f82f59d52e" + + "524288" + + "524288" + + "1" + + "hvm" + + " " + + "" + + "destroy"+ + "restart"+ + "restart"+ + "/usr/bin/kvm "+ + ""; + + Domain domain = null; + try { + client.domainDefineXML(xmlDesc); + domain = client.domainCreateXML(xmlDesc, 1); + } catch (LibvirtException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return domain; } @Override @@ -74,6 +96,19 @@ public class LibvirtComputeServiceAdapter implements ComputeServiceAdapter listNodes() { +// try { +// List domains = Lists.newArrayList(); +// for (String domain : client.listDefinedDomains()) { +// domains.add(client.domainLookupByName(domain)); +// } +// return domains; +// } catch (LibvirtException e) { +// return propogate(e); +// } +// } + protected T propogate(LibvirtException e) { Throwables.propagate(e); assert false; @@ -111,4 +146,14 @@ public class LibvirtComputeServiceAdapter implements ComputeServiceAdapter" + " deftest" + + " 004b96e1-2d78-c30f-5aa5-f03c87d21e70" + " 8388608" + + " 2" + " hvm" + " restart" + + " destroy" + " restart" + ""); + + + } + } diff --git a/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java b/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java index c89cfdaf26..5297bce4f6 100644 --- a/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java +++ b/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilderTest.java @@ -35,7 +35,7 @@ public class LibvirtComputeServiceContextBuilderTest { .createContext(new StandaloneComputeServiceContextSpec("libvirt", "test:///default", "1", "identity", "credential", new LibvirtComputeServiceContextModule(), ImmutableSet. of())); - System.err.println(context.getComputeService().listNodes()); + //System.err.println(context.getComputeService(). context.close(); } diff --git a/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java b/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java index 56618b5e6b..da5dc3c7e8 100644 --- a/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java +++ b/sandbox/libvirt/src/test/java/org/jclouds/libvirt/compute/LibvirtExperimentLiveTest.java @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2010 Cloud Conscious, LLC. + * Copyright (C) 2010 Cloud Conscious, LLC. * * ==================================================================== * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,11 @@ import static com.google.common.base.Preconditions.checkNotNull; import org.jclouds.compute.ComputeServiceContext; import org.jclouds.compute.ComputeServiceContextFactory; +import org.jclouds.compute.RunNodesException; import org.jclouds.compute.StandaloneComputeServiceContextSpec; +import org.jclouds.compute.domain.Template; +import org.jclouds.compute.domain.TemplateBuilder; +import org.jclouds.compute.options.TemplateOptions; import org.jclouds.libvirt.Datacenter; import org.jclouds.libvirt.Image; import org.jclouds.libvirt.compute.domain.LibvirtComputeServiceContextModule; @@ -63,9 +67,26 @@ public class LibvirtExperimentLiveTest { endpoint, apiversion, identity, credential, new LibvirtComputeServiceContextModule(), ImmutableSet . of())); - context.getComputeService().listNodes(); + System.out.println("images " + context.getComputeService().listImages()); + System.out.println("hardware profiles " + context.getComputeService().listHardwareProfiles()); + + Template defaultTemplate = context.getComputeService().templateBuilder() + //.hardwareId("").locationId("").imageId("") + .build(); + + /* + * We will probably make a default template out of properties at some point + * You can control the default template via overriding a method in standalonecomputeservicexontextmodule + */ + + +// context.getComputeService().templateOptions().; + context.getComputeService().runNodesWithTag("test", 1); + System.out.println(context.getComputeService().listNodes()); - } finally { + } catch (RunNodesException e) { + e.printStackTrace(); + } finally { if (context != null) context.close(); } diff --git a/sandbox/libvirt/src/test/resources/log4j.xml b/sandbox/libvirt/src/test/resources/log4j.xml index f7337defb9..a3b1e56934 100755 --- a/sandbox/libvirt/src/test/resources/log4j.xml +++ b/sandbox/libvirt/src/test/resources/log4j.xml @@ -130,7 +130,7 @@ - + \ No newline at end of file