mirror of https://github.com/apache/jclouds.git
API version is set to 1.1 by default
ignoring nulls in name and field for image descriptions
This commit is contained in:
parent
402ee2adbe
commit
e0a76aa08b
|
@ -34,7 +34,7 @@ public class NovaPropertiesBuilder extends PropertiesBuilder {
|
||||||
@Override
|
@Override
|
||||||
protected Properties defaultProperties() {
|
protected Properties defaultProperties() {
|
||||||
Properties properties = super.defaultProperties();
|
Properties properties = super.defaultProperties();
|
||||||
properties.setProperty(PROPERTY_API_VERSION, "1.0");
|
properties.setProperty(PROPERTY_API_VERSION, "1.1");
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,10 @@ public class NovaImageToImage implements Function<org.jclouds.openstack.nova.dom
|
||||||
public Image apply(org.jclouds.openstack.nova.domain.Image from) {
|
public Image apply(org.jclouds.openstack.nova.domain.Image from) {
|
||||||
ImageBuilder builder = new ImageBuilder();
|
ImageBuilder builder = new ImageBuilder();
|
||||||
builder.ids(from.getId() + "");
|
builder.ids(from.getId() + "");
|
||||||
builder.name(from.getName());
|
builder.name(from.getName() + "");
|
||||||
builder.description(from.getName());
|
builder.description(from.getName() + "");
|
||||||
builder.version(from.getUpdated().getTime() + "");
|
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));
|
builder.defaultCredentials(new Credentials("root", null));
|
||||||
Image image = builder.build();
|
Image image = builder.build();
|
||||||
return image;
|
return image;
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class NovaListNodesStrategy implements ListNodesStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterable<? extends NodeMetadata> listDetailsOnNodesMatching(Predicate<ComputeMetadata> filter) {
|
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);
|
serverToNodeMetadata), filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@ package org.jclouds.openstack.nova;
|
||||||
import org.jclouds.compute.ComputeService;
|
import org.jclouds.compute.ComputeService;
|
||||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||||
import org.jclouds.compute.ComputeServiceContext;
|
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 org.jclouds.ssh.jsch.config.JschSshClientModule;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -26,9 +30,20 @@ public class _NovaClient {
|
||||||
ComputeServiceContext context = contextFactory.createContext("nova", identity, credential, Collections.singleton(new JschSshClientModule()), overrides);
|
ComputeServiceContext context = contextFactory.createContext("nova", identity, credential, Collections.singleton(new JschSshClientModule()), overrides);
|
||||||
|
|
||||||
ComputeService cs = context.getComputeService();
|
ComputeService cs = context.getComputeService();
|
||||||
System.out.println(cs.listImages());
|
|
||||||
System.out.println(cs.listNodes());
|
TemplateOptions options = new TemplateOptions();
|
||||||
System.out.println(cs.listAssignableLocations());
|
//options.authorizePublicKey("");
|
||||||
System.out.println(cs.listHardwareProfiles());
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue