Can someone help me understanding how to assign a specific network to a newly created VM using the JClouds API in OpenStack? I'm using following code to create the real server:
CreateServerOptions[] serverOptions = new CreateServerOptions[0];
ServerCreated serverCreated = serverApi.create(clonedVmName, imageId, FlavourId, serverOptions);
Also I'm using v1.0-quantum
APIs to fetch all the networks as follows but it's not returning any. I'm not sure what's wrong with the following code:
Iterable<Module> modules = ImmutableSet.<Module> of(
new SLF4JLoggingModule());
quantum = ContextBuilder.newBuilder(provider)
.endpoint("http://10.37.53.229:5000/v2.0/")
.credentials(identity, password)
.modules(modules)
.build();
QuantumApi quanApi = (QuantumApi)quantum.getApi();
for(String zone : quanApi.getConfiguredZones())
{
System.out.println("Zone : "+ zone);
}
NetworkApi netApi = quanApi.getNetworkApiForZone("RegionOne");
FluentIterable<? extends Network> nets = netApi.list();
for(Network net : nets)
{
System.out.println(net.getName() +" Id : "+net.getId());
}
I use version 1.7.3 of JClouds and I build the options in the following way, giving network ids as parameters:
As for listing networks here are good examples.