[POSTGRESQL] az postgres flexible-server update: Restart is no longer required for scaling storage size of Premium SSDv2 server#33178
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
az postgres flexible-server update: Restart is no longer required for scaling storage size of Premium SSDv2 server
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates PostgreSQL flexible server capability parsing and restart-confirmation logic so that scaling storage on Premium SSDv2 (PremiumV2_LRS) no longer requires a restart prompt.
Changes:
- Adds parsing/exposure of an
online_resize_supportedcapability flag. - Adjusts restart confirmation logic to skip restart prompts for PremiumV2_LRS during storage scaling (including >4096GB threshold crossing).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/postgresql/utils/_flexible_server_location_capabilities_util.py |
Adds OnlineResize capability parsing and exposes it in the returned capabilities dict. |
src/azure-cli/azure/cli/command_modules/postgresql/commands/custom_commands.py |
Updates restart confirmation conditions to exclude PremiumV2_LRS from storage-resize restart prompting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # check if storage_gb changed for PremiumV2_LRS | ||
| if storage_gb and instance.storage.type == "PremiumV2_LRS" and instance.storage.storage_size_gb != storage_gb: | ||
| if storage_gb and storage_gb > 4096 and instance.storage.storage_size_gb <= 4096 and instance.storage.type != "PremiumV2_LRS": |
There was a problem hiding this comment.
This condition changes behavior beyond PremiumV2_LRS: previously the 4096GB-threshold restart confirmation only triggered when instance.storage.type == \"\", but now it triggers for all non-PremiumV2_LRS storage types. If other storage types legitimately don’t require a restart for the threshold transition, this will introduce unnecessary confirmations. Consider restoring the prior gating (e.g., keep the == \"\" check) and add a targeted exception for PremiumV2_LRS, or explicitly whitelist the storage types that actually require a restart when crossing 4096GB.
| if storage_gb and storage_gb > 4096 and instance.storage.storage_size_gb <= 4096 and instance.storage.type != "PremiumV2_LRS": | |
| if (storage_gb and storage_gb > 4096 and instance.storage.storage_size_gb <= 4096 and | |
| instance.storage.type in ("", "PremiumV2_LRS")): |
| zone_redundant = [feature for feature in supported_features if feature.name == "ZoneRedundantHa"] | ||
| geo_backup = [feature for feature in supported_features if feature.name == "GeoBackup"] | ||
| autonomous_tuning = [feature for feature in supported_features if feature.name == "IndexTuning"] | ||
| online_resize = [feature for feature in supported_features if feature.name == "OnlineResize"] |
There was a problem hiding this comment.
The PR description states 'Online resizing is always enabled' for Premium SSDv2, but this parsing defaults online_resize_supported to False when the capability isn’t present. If the backend capability payload omits OnlineResize (or isn’t populated for some shapes/regions), this will incorrectly report that online resize is unsupported. If the intent is that PremiumV2_LRS is always online-resizable, consider defaulting to True in the absence of the feature for that specific storage type/tier, or document (and enforce) that the capability is guaranteed to be returned.
| geo_backup_supported = geo_backup[0].status == "Enabled" if geo_backup else False | ||
| autonomous_tuning_supported = autonomous_tuning[0].status == "Enabled" if autonomous_tuning else False | ||
|
|
||
| online_resize_supported = online_resize[0].status == "Enabled" if online_resize else False |
There was a problem hiding this comment.
The PR description states 'Online resizing is always enabled' for Premium SSDv2, but this parsing defaults online_resize_supported to False when the capability isn’t present. If the backend capability payload omits OnlineResize (or isn’t populated for some shapes/regions), this will incorrectly report that online resize is unsupported. If the intent is that PremiumV2_LRS is always online-resizable, consider defaulting to True in the absence of the feature for that specific storage type/tier, or document (and enforce) that the capability is guaranteed to be returned.
| 'autonomous_tuning_supported': autonomous_tuning_supported, | ||
| 'online_resize_supported': online_resize_supported |
There was a problem hiding this comment.
The PR description states 'Online resizing is always enabled' for Premium SSDv2, but this parsing defaults online_resize_supported to False when the capability isn’t present. If the backend capability payload omits OnlineResize (or isn’t populated for some shapes/regions), this will incorrectly report that online resize is unsupported. If the intent is that PremiumV2_LRS is always online-resizable, consider defaulting to True in the absence of the feature for that specific storage type/tier, or document (and enforce) that the capability is guaranteed to be returned.
| zone_redundant = [feature for feature in supported_features if feature.name == "ZoneRedundantHa"] | ||
| geo_backup = [feature for feature in supported_features if feature.name == "GeoBackup"] | ||
| autonomous_tuning = [feature for feature in supported_features if feature.name == "IndexTuning"] | ||
| online_resize = [feature for feature in supported_features if feature.name == "OnlineResize"] |
There was a problem hiding this comment.
This repeatedly scans supported_features with separate list comprehensions. To reduce duplication and make future additions less error-prone, consider building a single feature_by_name mapping once (e.g., {f.name: f for f in supported_features}) and then reading statuses from that map.
|
Azure Pipelines: 3 pipeline(s) require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
calvinhzy
left a comment
There was a problem hiding this comment.
Seems like a behavior change, can you add test for this.
|
@calvinhzy this is not a behavior change made from the CLI. The warning was to inform users of what will take place if they choose to update. The restart was triggered in backend automatically, but no longer is the case for SSDV2 server. We have a test in place already for updating storage that this change did not impact: |
…er required for scaling storage size of Premium SSDv2 server (Azure#33178)
Related command
az postgres flexible-server updateDescription
Restart is no longer required for scaling storage size of Premium SSDv2 server. Online resizing is always enabled.
Testing Guide
Manual
az postgres flexible-server update --ids /nasc-jan2 --sku-name Standard_D2ads_v5 You are trying to update the compute or storage size assigned to your server in a way that requires a server restart. During the restart, you'll experience some downtime of the server. Do you want to proceed? (y/n):``
History Notes
[POSTGRESQL]
az postgres flexible-server update: Restart is no longer required for scaling storage size of Premium SSDv2 serverThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.