API version is set to 1.1 by default

ignoring nulls in name and field for image descriptions
This commit is contained in:
Dmitri Babaev 2011-04-07 20:46:51 +04:00 committed by Dmitri Babaev
parent 402ee2adbe
commit e0a76aa08b
4 changed files with 24 additions and 9 deletions

View File

@ -34,7 +34,7 @@ public class NovaPropertiesBuilder extends PropertiesBuilder {
@Override
protected Properties defaultProperties() {
Properties properties = super.defaultProperties();
properties.setProperty(PROPERTY_API_VERSION, "1.0");
properties.setProperty(PROPERTY_API_VERSION, "1.1");
return properties;
}

View File

@ -44,10 +44,10 @@ public class NovaImageToImage implements Function<org.jclouds.openstack.nova.dom
public Image apply(org.jclouds.openstack.nova.domain.Image from) {
ImageBuilder builder = new ImageBuilder();
builder.ids(from.getId() + "");
builder.name(from.getName());
builder.description(from.getName());
builder.name(from.getName() + "");
builder.description(from.getName() + "");
builder.version(from.getUpdated().getTime() + "");
builder.operatingSystem(imageToOs.apply(from));
//builder.operatingSystem(imageToOs.apply(from)); //image name may not represent the OS type
builder.defaultCredentials(new Credentials("root", null));
Image image = builder.build();
return image;

View File

@ -55,7 +55,7 @@ public class NovaListNodesStrategy implements ListNodesStrategy {
@Override
public Iterable<? extends NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
return Iterables.filter(Iterables.transform(client.listServers(ListOptions.Builder.withDetails()),
return Iterables.filter(Iterables.transform(client.listServers(/*ListOptions.Builder.withDetails()*/),
serverToNodeMetadata), filter);
}
}

View File

@ -3,6 +3,10 @@ package org.jclouds.openstack.nova;
import org.jclouds.compute.ComputeService;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.ComputeServiceContext;
import org.jclouds.compute.RunNodesException;
import org.jclouds.compute.domain.Template;
import org.jclouds.compute.domain.TemplateBuilder;
import org.jclouds.compute.options.TemplateOptions;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import java.util.Collections;
@ -26,9 +30,20 @@ public class _NovaClient {
ComputeServiceContext context = contextFactory.createContext("nova", identity, credential, Collections.singleton(new JschSshClientModule()), overrides);
ComputeService cs = context.getComputeService();
System.out.println(cs.listImages());
System.out.println(cs.listNodes());
System.out.println(cs.listAssignableLocations());
System.out.println(cs.listHardwareProfiles());
TemplateOptions options = new TemplateOptions();
//options.authorizePublicKey("");
Template template = cs.templateBuilder().hardwareId("m1.small").imageId("ami-0000000d").options(options).build();
try {
cs.runNodesWithTag("test", 1, template);
} catch (RunNodesException e) {
e.printStackTrace();
}
//System.out.println(cs.listNodes());
//System.out.println(cs.listImages());
//System.out.println(cs.listNodes());
//System.out.println(cs.listAssignableLocations());
//System.out.println(cs.listHardwareProfiles());
}
}