Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.62k stars 5.04k forks source link

[BUG] Extending SQLVM with additional data disks not working as expected #30204

Open catriona-m opened 1 month ago

catriona-m commented 1 month ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/tree/main/specification/sqlvirtualmachine/resource-manager/Microsoft.SqlVirtualMachine/stable/2023-10-01

API Spec version

2023-10-01

Describe the bug

With an existing sql vm with the following storage configuration:

    "storageConfigurationSettings": {
      "diskConfigurationType": "NEW",
      "sqlDataSettings": {
        "defaultFilePath": "F:\\SQLData",
        "luns": [
0
        ]
      },
      "sqlLogSettings": {
        "defaultFilePath": "F:\\SQLLog",
        "luns": [
0
        ]
      },
      "sqlSystemDbOnDataDisk": false,
      "sqlTempDbSettings": {
        "dataFileCount": 8,
        "dataFileSize": 256,
        "dataGrowth": 512,
        "defaultFilePath": "F:\\SQLTemp",
        "logFileSize": 512,
        "logGrowth": 512,
        "luns": [
0
        ]
      },
      "storageWorkloadType": "OLTP"
    },

When the following PUT request is sent containing the following storage configuration, we get an error that only one disk can be extended at a time:

    "storageConfigurationSettings": {
      "diskConfigurationType": "EXTEND",
      "sqlDataSettings": {
        "defaultFilePath": "F:\\SQLData",
        "luns": [
1
        ]
      },
      "sqlLogSettings": {
        "defaultFilePath": "F:\\SQLLog",
        "luns": [
0
        ]
      },
      "sqlSystemDbOnDataDisk": false,
      "sqlTempDbSettings": {
        "dataFileCount": 8,
        "dataFileSize": 256,
        "dataGrowth": 512,
        "defaultFilePath": "F:\\SQLTemp",
        "logFileSize": 512,
        "logGrowth": 512,
        "luns": [
0
        ]
      },
      "storageWorkloadType": "OLTP"
    },

When sqlTempDbSettings and sqlLogSettings are omitted from the request, we get an error stating "Original Error: Code="InvalidArgument" Message="Invalid argument 'DefaultFilePath'.".

When sqlTempDbSettings, sqlLogSettings and sqlDataSettings.DefaultFilePath are omitted from the PUT request, the extension happens successfully, however in a subsequent GET request our storage configuration now looks like:

    "storageConfigurationSettings": {
      "sqlDataSettings": {
        "luns": [
1
        ]
      },
      "sqlLogSettings": {},
      "sqlTempDbSettings": {},
      "sqlSystemDbOnDataDisk": false,
      "diskConfigurationType": "EXTEND"
    },

Expected behavior

Expect to be able to extend data disk and maintain existing storage configuration

Actual behavior

Existing storage configuration must be omitted from the request and cannot be retrieved from subsequent GETs

Reproduction Steps

  1. Create an SQLVM with storage configuration
  2. Send a PUT request with additional data disk

Environment

No response

v-jiaodi commented 1 month ago

@yareyes Please help take a look, thanks.

lingxiao-microsoft commented 1 month ago

Hello,

This is the expected behavior.

When the diskConfigurationType is "EXTEND", you are expected to pass either "sqlDataSettings" or "sqlTempDbSettings" or "sqlLogSettings".

And when a setting is provided for a "EXTEND", defaultFilePath is not needed, hence you are seeing that error.

For the GET response, it is expected as it shows the last configuration you've applied, in which you only have extended "sqlDataSettings".

Thanks