Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,6 @@ def flexible_server_update_custom_func(cmd, client, instance,
if instance.storage.type == "PremiumV2_LRS":
instance.storage.tier = None

if sku_name or storage_gb:
logger.warning("You are changing the compute and/or storage size of the server. "
"The server will be restarted for this operation and you will see a short downtime.")

if iops:
instance.storage.iops = iops

Expand Down Expand Up @@ -629,16 +625,12 @@ def _confirm_restart_server(instance, sku_name, storage_gb, yes):
show_confirmation = True

# check if requested storage growth is crossing the 4096 threshold
if storage_gb and storage_gb > 4096 and instance.storage.storage_size_gb <= 4096 and instance.storage.type == "":
show_confirmation = True

# 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":
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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")):

Copilot uses AI. Check for mistakes.
show_confirmation = True

if not yes and show_confirmation:
user_confirmation("You are trying to change the compute or the size of storage 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?", yes=yes)
user_confirmation('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?', yes=yes)


def flexible_server_delete(cmd, client, resource_group_name, server_name, yes=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def _postgres_parse_list_capability(result, is_offer_restriction_check_required=
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"]
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 54 to +57
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

# Update once capability calls are corrected for each command
if restricted == "Enabled" and not is_offer_restriction_check_required:
Expand All @@ -65,7 +66,7 @@ def _postgres_parse_list_capability(result, is_offer_restriction_check_required=
single_az = zone_redundant[0].status != "Enabled" if zone_redundant else True
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
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
tiers = result[0].supported_server_editions
tiers_dict = {}
for tier_info in tiers:
Expand Down Expand Up @@ -113,7 +114,8 @@ def _postgres_parse_list_capability(result, is_offer_restriction_check_required=
'zones': zones,
'server_versions': versions,
'supported_server_versions': supported_server_versions,
'autonomous_tuning_supported': autonomous_tuning_supported
'autonomous_tuning_supported': autonomous_tuning_supported,
'online_resize_supported': online_resize_supported
Comment on lines +117 to +118
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
}


Expand Down
Loading