Azure-sdk-for-java: Set custom IOPS and Throughput on a new Azure Disk create

Created on 20 Feb 2020  路  3Comments  路  Source: Azure/azure-sdk-for-java

Query/Question

  • I want to create a managed disk using the Azure SDK.
  • And I am able to do it.
  • However, I can't find any method or interface via which I can set IOPS and Throughput on the disks I create _(I know they are only supported for Ultra disks)_.
  • Is it something only possible via the REST API and not supported from the Java SDK for Azure?
  • I have asked the question here as well.

Current definition stages I see are:

image

// what I have as of now
Azure az = factory.userClient(ctx);
// some stuff

Disk.DefinitionStages.Blank dd = az.disks().define(myDIskModel.getName());
Disk.DefinitionStages.WithGroup ddGroup = dd.withRegion(myDIskModel.getRegion());
Disk.DefinitionStages.WithDiskSource ddSource = ddGroup.withExistingResourceGroup(resourceGroup);
Disk.DefinitionStages.WithDataDiskSource ddData = ddSource.withData();
Disk.DefinitionStages.WithCreate ddCreate = ddData
                .withSizeInGB(Integer.parseInt(myDIskModel.getSizeGb()))
                .withSku(DiskSkuTypes.fromStorageAccountType(DiskStorageAccountTypes.fromString(myDIskModel.getType())))
                .withTag(AzureTags.X, XX)
                .withTag(AzureTags.Y, YY)
                .withTag(AzureTags.Z, ZZ);

Observable<Indexable> asynCreate = ddCreate.createAsync();
Checker checker = new Checker(callerContext, asynCreate, Disk.class);

Why is this not a Bug or a feature Request?

  • Because I think it is something I can't figure out and maybe not necessarily something that's broken.

Setup (please complete the following information if applicable):

  • OS: Mac
  • IDE : IntelliJ
  • Version of the Library used: 1.31.0

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • [x] Query Added
  • [x] Setup information Added
Storage customer-reported question

Most helpful comment

@Shabirmean The whole Rest API is innerObject, when you see an option doesn't appear in fluent API, you could use inner api as a workaround.

In this situation, code is like:

Disk disk = azure.disks().define()....create();
disk.inner().withDiskIOPSReadWrite(1L);
disk.update().apply();

// Or if the options can only be set in creation
Disk.DefinitionStages.WithCreate diskCreate = azure.disks().define()...
    // .create();
((Disk) diskCreate).inner().withDiskIOPSReadWrite(1L);
diskCreate.create();

All 3 comments

Thanks for posting the question on the Java Storage Management SDK @Shabirmean. @yaohaizh @ChenTanyi can you please assist?

/cc @rickle-msft @gapra-msft

@Shabirmean The whole Rest API is innerObject, when you see an option doesn't appear in fluent API, you could use inner api as a workaround.

In this situation, code is like:

Disk disk = azure.disks().define()....create();
disk.inner().withDiskIOPSReadWrite(1L);
disk.update().apply();

// Or if the options can only be set in creation
Disk.DefinitionStages.WithCreate diskCreate = azure.disks().define()...
    // .create();
((Disk) diskCreate).inner().withDiskIOPSReadWrite(1L);
diskCreate.create();

@ChenTanyi - This works. Thank you very much! 馃帀

Was this page helpful?
0 / 5 - 0 ratings