2016-01-20 118 views
0

我在openstack中使用下面的代碼創建實例,該實例將使用openstack風味列表來獲取硬件詳細信息。是否有任何需要使用computeService API顯式傳遞磁盤大小?如何在openstack創建實例中指定磁盤大小

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

回答

0

TemplateBuilder具有minDisk(雙千兆字節),其可以被用來提供最小磁盤大小選項。

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

+0

即使通過,minDisk()也不起作用。 – bagui

+0

你有沒有與MinDisk尺寸相匹配的新星味道?我相信如果應該過濾使用該變量的風味列表。有一件事可以幫助確定發生的事情是啓用線級日誌記錄(按照https://jclouds.apache.org/reference/logging/),並查看nova flavor的列表以及在nova中選擇哪種flavor創建呼叫。 – zacksh