diff --git a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java index 49c9021c36..0aa12766b5 100644 --- a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java +++ b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/LibvirtComputeServiceContextBuilder.java @@ -19,6 +19,8 @@ package org.jclouds.libvirt.compute; +import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; + import java.util.List; import java.util.Properties; @@ -39,6 +41,9 @@ public class LibvirtComputeServiceContextBuilder extends StandaloneComputeServic public LibvirtComputeServiceContextBuilder(Properties props) { super(props); + + if (!properties.containsKey(PROPERTY_LIBVIRT_DOMAIN_DIR)) + properties.setProperty(PROPERTY_LIBVIRT_DOMAIN_DIR, "/etc/libvirt/qemu"); } @Override diff --git a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java index 25d1a2cb03..fc3876eea4 100644 --- a/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java +++ b/sandbox/libvirt/src/main/java/org/jclouds/libvirt/compute/domain/LibvirtComputeServiceContextModule.java @@ -19,7 +19,11 @@ package org.jclouds.libvirt.compute.domain; +import static com.google.common.collect.Maps.newLinkedHashMap; +import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; + import java.net.URI; +import java.util.Map; import javax.inject.Named; import javax.inject.Singleton; @@ -48,6 +52,7 @@ import org.libvirt.Domain; import org.libvirt.LibvirtException; import com.google.common.base.Function; +import com.google.common.base.Splitter; import com.google.common.base.Supplier; import com.google.inject.Injector; import com.google.inject.Key; @@ -90,7 +95,9 @@ StandaloneComputeServiceContextModule { @Override protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - String domainDir = injector.getInstance(Key.get(String.class, Names.named("jclouds.libvirt.domain-dir"))); + //String domainDir = injector.getInstance(Key.get(String.class, Names.named(PROPERTY_LIBVIRT_DOMAIN_DIR))); + String domainDir = ""; + System.out.println("++++ domain dir: " + domainDir); String hardwareId = searchForHardwareIdInDomainDir(domainDir); String image = searchForImageIdInDomainDir(domainDir); return template.hardwareId(hardwareId).imageId(image) ; @@ -105,4 +112,16 @@ StandaloneComputeServiceContextModule { // TODO return "c7ff2039-a9f1-a659-7f91-e0f82f59d52e"; } + + /* + * Map regions = newLinkedHashMap(); + for (String region : Splitter.on(',').split(regionString)) { + regions.put( + region, + URI.create(injector.getInstance(Key.get(String.class, + Names.named(Constants.PROPERTY_ENDPOINT + "." + region))))); + } + return regions; + */ + } \ No newline at end of file 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 c092e4ca20..9d8782ef4b 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 @@ -20,6 +20,7 @@ package org.jclouds.libvirt.compute.strategy; import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.libvirt.LibvirtConstants.PROPERTY_LIBVIRT_DOMAIN_DIR; import java.io.IOException; import java.io.StringReader; @@ -63,6 +64,7 @@ import com.google.common.base.Splitter; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.inject.name.Named; import com.jamesmurty.utils.XMLBuilder; /** @@ -76,8 +78,9 @@ public class LibvirtComputeServiceAdapter implements ComputeServiceAdapter