0
votes

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 ?

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);
1

1 Answers

0
votes

TemplateBuilder has a minDisk(double gigabytes) option that can be used to supply minimum disk size.

https://jclouds.apache.org/reference/javadoc/1.9.x/org/jclouds/compute/domain/TemplateBuilder.html#minDisk(double)