-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[POSTGRESQL] az postgres flexible-server create: Block SSDv2 creation for PG version < 14
#33119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,7 +185,7 @@ def pg_arguments_validator(db_context, location, tier, sku_name, storage_gb, ser | |
| else: | ||
| supported_storageV2_size = None | ||
| _pg_storage_type_validator(storage_type, auto_grow, performance_tier, | ||
| tier, supported_storageV2_size, iops, throughput, instance) | ||
| tier, supported_storageV2_size, iops, throughput, instance, version) | ||
| _pg_storage_performance_tier_validator(performance_tier, | ||
| sku_info, | ||
| tier, | ||
|
|
@@ -712,11 +712,13 @@ def validate_identities(cmd, namespace): | |
|
|
||
|
|
||
| def _pg_storage_type_validator(storage_type, auto_grow, performance_tier, tier, | ||
| supported_storageV2_size, iops, throughput, instance): | ||
| supported_storageV2_size, iops, throughput, instance, version): | ||
| is_create_ssdv2 = storage_type == "PremiumV2_LRS" | ||
| is_update_ssdv2 = instance is not None and instance.storage.type == "PremiumV2_LRS" | ||
|
|
||
| if is_create_ssdv2: | ||
| if version and int(version) < 14: | ||
| raise CLIError('Storage type PremiumV2_LRS is only supported for PostgreSQL version 14 and above.') | ||
| if supported_storageV2_size is None: | ||
|
Comment on lines
719
to
722
|
||
| raise CLIError('Storage type set to PremiumV2_LRS is not supported for this region.') | ||
| if iops is None or throughput is None: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int(version)is evaluated beforepg_version_validatorruns (and before any format validation), so invalid inputs like--version foowith--storage-type PremiumV2_LRSwill raise an unhandledValueErrorinstead of a clean CLI validation error. Consider avoidingint()here (e.g., compare against explicit supported majors like ('11','12','13') or safely parseversion.split('.')[0]inside a try/except that raisesCLIError), or movepg_version_validator(...)earlier soversionis validated before this check.