From d8a142e3ed06973fccfd750094e8df36ee74794f Mon Sep 17 00:00:00 2001 From: MaximilianoUribe Date: Mon, 15 Jun 2026 11:39:30 -0700 Subject: [PATCH] Parse NC_RTXPRO6000BSE_v6 GPU VM sizes The NC RTX PRO 6000 BSE v6 GPU sizes use a new naming shape that the size parser could not match, e.g. NC288ds_xl_RTXPRO6000BSE_v6, causing 'could not parse VM size' errors. Two elements were unsupported: - the 'xl_' size descriptor that precedes the accelerator, and - an accelerator name with trailing letters (RTXPRO6000BSE), while the accelerator group only matched . Extend the accelerator group to '(xl_[A-Z]+[0-9]+[A-Z]*|[A-Z]+[0-9]+)'. The trailing-letters form is gated behind the literal 'xl_' so existing accelerators (e.g. MI300X, H100) keep hitting their dedicated groups and their series flags are unchanged. The 'xl_' descriptor is stripped so AcceleratorType reflects the accelerator name only (RTXPRO6000BSE). Applied to both the root and v2 modules, with tests for the ds and lds variants. The full real-SKU corpus (TestParseVMSize) still passes with no regressions. --- v2/vmsize.go | 15 +++++++++++---- v2/vmsize_test.go | 34 ++++++++++++++++++++++++++++++++++ vmsize.go | 15 +++++++++++---- vmsize_test.go | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 8 deletions(-) diff --git a/v2/vmsize.go b/v2/vmsize.go index 2b4f0ed..f0b29b0 100644 --- a/v2/vmsize.go +++ b/v2/vmsize.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strconv" + "strings" ) // This file adds support for more capabilities based on VM naming conventions that includes vmsize parsing. @@ -12,7 +13,7 @@ import ( // fetched using the ResourceSKU API, are not included here. They can be found in sku.go. var skuSizeScheme = regexp.MustCompile( - `^([A-Z])([A-Z]?)([A-Z]?)([0-9]+)-?((?:[0-9]+)?)((?:[abcdeiflmnotspPr]+|C+|NP)?)_?(?:([A-Z]+[0-9]+)_?)?(_cc_)?(_[0-9]+_)?(_MI300X_)?(_H100_)?((?:[vV][1-9])?)?(_Promo)?$`, + `^([A-Z])([A-Z]?)([A-Z]?)([0-9]+)-?((?:[0-9]+)?)((?:[abcdeiflmnotspPr]+|C+|NP)?)_?(?:(xl_[A-Z]+[0-9]+[A-Z]*|[A-Z]+[0-9]+)_?)?(_cc_)?(_[0-9]+_)?(_MI300X_)?(_H100_)?((?:[vV][1-9])?)?(_Promo)?$`, ) // unParsableVMSizes map holds vmSize strings that cannot be easily parsed with skuSizeScheme. @@ -102,10 +103,16 @@ func GetVMSize(vmSizeName string) (*VMSizeType, error) { // [Accelerator Type]* // _?: Optionally captures an underscore. - // (?:([A-Z][0-9]+)_?)?: Optionally captures a pattern that starts with an uppercase letter followed by digits, - // followed by an optional underscore. + // (?:(xl_[A-Z]+[0-9]+[A-Z]*|[A-Z]+[0-9]+)_?)?: Optionally captures the accelerator type. + // The first alternative matches GPU SKUs that prefix the accelerator with a size + // descriptor and may include trailing letters (e.g. "xl_RTXPRO6000BSE" in + // NC288ds_xl_RTXPRO6000BSE_v6); the second matches the common "" + // form (e.g. "A100", "T4"). A trailing optional underscore is also captured. if len(parts[7]) > 0 { - vmSize.AcceleratorType = &parts[7] + // Strip the optional size descriptor (e.g. "xl_") so AcceleratorType reflects + // the accelerator name only. + accelerator := strings.TrimPrefix(parts[7], "xl_") + vmSize.AcceleratorType = &accelerator } // [Confidential Child Capability]* - only AKS diff --git a/v2/vmsize_test.go b/v2/vmsize_test.go index c215218..4170f13 100644 --- a/v2/vmsize_test.go +++ b/v2/vmsize_test.go @@ -237,6 +237,40 @@ var testCases = []struct { }, err: nil, }, + { + name: "Standard_NC288ds_xl_RTXPRO6000BSE_v6", + size: "NC288ds_xl_RTXPRO6000BSE_v6", + expectedVM: &VMSizeType{ + Family: "N", + Subfamily: to.Ptr("C"), + Cpus: "288", + CpusConstrained: nil, + AdditiveFeatures: []rune{'d', 's'}, + AcceleratorType: to.Ptr("RTXPRO6000BSE"), + ConfidentialChildCapability: false, + Version: "v6", + PromoVersion: false, + Series: "NCds_v6", + }, + err: nil, + }, + { + name: "Standard_NC24lds_xl_RTXPRO6000BSE_v6", + size: "NC24lds_xl_RTXPRO6000BSE_v6", + expectedVM: &VMSizeType{ + Family: "N", + Subfamily: to.Ptr("C"), + Cpus: "24", + CpusConstrained: nil, + AdditiveFeatures: []rune{'l', 'd', 's'}, + AcceleratorType: to.Ptr("RTXPRO6000BSE"), + ConfidentialChildCapability: false, + Version: "v6", + PromoVersion: false, + Series: "NClds_v6", + }, + err: nil, + }, { name: "Standard_inValid", size: "inValid", diff --git a/vmsize.go b/vmsize.go index 39f5f8d..b374555 100644 --- a/vmsize.go +++ b/vmsize.go @@ -4,6 +4,7 @@ import ( "fmt" "regexp" "strconv" + "strings" ) // This file adds support for more capabilities based on VM naming conventions that includes vmsize parsing. @@ -12,7 +13,7 @@ import ( // fetched using the ResourceSKU API, are not included here. They can be found in sku.go. var skuSizeScheme = regexp.MustCompile( - `^([A-Z])([A-Z]?)([A-Z]?)([0-9]+)-?((?:[0-9]+)?)((?:[abcdeiflmnotspPr]+|C+|NP)?)_?(?:([A-Z]+[0-9]+)_?)?(_cc_)?(_[0-9]+_)?(_MI300X_)?(_H100_)?((?:[vV][1-9])?)?(_Promo)?$`, + `^([A-Z])([A-Z]?)([A-Z]?)([0-9]+)-?((?:[0-9]+)?)((?:[abcdeiflmnotspPr]+|C+|NP)?)_?(?:(xl_[A-Z]+[0-9]+[A-Z]*|[A-Z]+[0-9]+)_?)?(_cc_)?(_[0-9]+_)?(_MI300X_)?(_H100_)?((?:[vV][1-9])?)?(_Promo)?$`, ) // unParsableVMSizes map holds vmSize strings that cannot be easily parsed with skuSizeScheme. @@ -102,10 +103,16 @@ func GetVMSize(vmSizeName string) (*VMSizeType, error) { // [Accelerator Type]* // _?: Optionally captures an underscore. - // (?:([A-Z][0-9]+)_?)?: Optionally captures a pattern that starts with an uppercase letter followed by digits, - // followed by an optional underscore. + // (?:(xl_[A-Z]+[0-9]+[A-Z]*|[A-Z]+[0-9]+)_?)?: Optionally captures the accelerator type. + // The first alternative matches GPU SKUs that prefix the accelerator with a size + // descriptor and may include trailing letters (e.g. "xl_RTXPRO6000BSE" in + // NC288ds_xl_RTXPRO6000BSE_v6); the second matches the common "" + // form (e.g. "A100", "T4"). A trailing optional underscore is also captured. if len(parts[7]) > 0 { - vmSize.AcceleratorType = &parts[7] + // Strip the optional size descriptor (e.g. "xl_") so AcceleratorType reflects + // the accelerator name only. + accelerator := strings.TrimPrefix(parts[7], "xl_") + vmSize.AcceleratorType = &accelerator } // [Confidential Child Capability]* - only AKS diff --git a/vmsize_test.go b/vmsize_test.go index 6b82a68..daea656 100644 --- a/vmsize_test.go +++ b/vmsize_test.go @@ -237,6 +237,40 @@ var testCases = []struct { }, err: nil, }, + { + name: "Standard_NC288ds_xl_RTXPRO6000BSE_v6", + size: "NC288ds_xl_RTXPRO6000BSE_v6", + expectedVM: &VMSizeType{ + Family: "N", + Subfamily: to.Ptr("C"), + Cpus: "288", + CpusConstrained: nil, + AdditiveFeatures: []rune{'d', 's'}, + AcceleratorType: to.Ptr("RTXPRO6000BSE"), + ConfidentialChildCapability: false, + Version: "v6", + PromoVersion: false, + Series: "NCds_v6", + }, + err: nil, + }, + { + name: "Standard_NC24lds_xl_RTXPRO6000BSE_v6", + size: "NC24lds_xl_RTXPRO6000BSE_v6", + expectedVM: &VMSizeType{ + Family: "N", + Subfamily: to.Ptr("C"), + Cpus: "24", + CpusConstrained: nil, + AdditiveFeatures: []rune{'l', 'd', 's'}, + AcceleratorType: to.Ptr("RTXPRO6000BSE"), + ConfidentialChildCapability: false, + Version: "v6", + PromoVersion: false, + Series: "NClds_v6", + }, + err: nil, + }, { name: "Standard_inValid", size: "inValid",