You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jclouds.apache.org by Subhadip Bagui <i....@gmail.com> on 2016/01/21 08:25:15 UTC

specify disk size while creating instance in openstack

Hi,

I'm using the below code in openstack for create instance which will use
openstack flavor list to get the hardware details. Is there any was to pass
the *disk size explicitly* using computeService API ? Like I can do the
same from openstack console and a cinder volume will get attached in
instance.

    ComputeServiceContext computeContext =
ContextBuilder.newBuilder(credentials.getProviderName())
           .endpoint(credentials.getResourceEndPoint())
           .credentials(cred, passwd)
           .modules(ImmutableSet.<Module> of(new SshjSshClientModule()))
           .overrides(openStackPropeties)
           .buildView(ComputeServiceContext.class);

templateBuilder.imageId(instance.getImageId());
           templateBuilder.hardwareId(instance.getInstanceType());
           options.as(NovaTemplateOptions.class).nodeNames(
                   new ArrayList<String>(Arrays.asList(instance
                           .getInstanceName())));
           options.as(NovaTemplateOptions.class).networks(
                   instance.getNetworkType());
           templateBuilder.locationId("RegionOne");
           build = templateBuilder.build();

Set<? extends NodeMetadata> nodeMetadatas =
computeService.createNodesInGroup("securitygroup.name",
                   instanceCount, build);

I have tried giving templateBuilder.minDisk(5); but this is not taking the
required volume.

Please let me know is there any other way to do this.


Regards,
Subhadip

-------------------------------------------------------------------------------------------------------------------