-
Notifications
You must be signed in to change notification settings - Fork 51
Apply simple rule for checking Azure Gen2 Spec #2175
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
Conversation
seokho-son
commented
Oct 2, 2025
- To fix [Azure] The selected VM size 'Standard_D4_v3' cannot boot Hypervisor Generation '2' cm-beetle#208
Signed-off-by: Seokho Son <[email protected]>
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.
Pull Request Overview
This PR simplifies the Azure Gen2 specification checking logic by implementing a pattern-based rule that determines Gen2 support based on the presence of a digit followed by 's' in the spec name (e.g., "2s", "4s"). This replaces the previous complex version-based checking logic.
- Replaces complex D-series version checking with a simple digit+s pattern detection
- Consolidates Gen1-only detection into a single rule for all D-family specs without the storage optimization indicator
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// D-family: Simple rule based on storage optimization indicator | ||
// Pattern: Standard_D{number}s_{version} → Gen2 supported | ||
// Pattern: Standard_D{number}_{version} → Gen1 only | ||
|
||
// Check for digit+s pattern (e.g., "2s", "4s", "8s", "16s") | ||
// This covers: Standard_D2s_v3, Standard_D4s_v3, Standard_D8s_v3, etc. | ||
for i := 0; i < len(lowerSpecName)-1; i++ { | ||
if lowerSpecName[i] >= '0' && lowerSpecName[i] <= '9' && lowerSpecName[i+1] == 's' { | ||
return false // Found digit+s pattern = Gen2 supported | ||
} | ||
} | ||
return false | ||
|
||
// All other D-family specs without digit+s pattern are Gen1-only | ||
// (includes all Dv2, Dv3, Dv4, Dv5, etc.) |
Copilot
AI
Oct 2, 2025
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.
The comment states that Dv2, Dv3, Dv4, Dv5 are Gen1-only, but this contradicts Azure documentation where most D-series v2 and later versions support Gen2. The simplified rule may incorrectly classify Gen2-capable instances as Gen1-only.
Copilot uses AI. Check for mistakes.
for i := 0; i < len(lowerSpecName)-1; i++ { | ||
if lowerSpecName[i] >= '0' && lowerSpecName[i] <= '9' && lowerSpecName[i+1] == 's' { | ||
return false // Found digit+s pattern = Gen2 supported | ||
} | ||
} |
Copilot
AI
Oct 2, 2025
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.
This pattern matching could produce false positives. For example, a spec name containing 'test1spec' would match the digit+s pattern incorrectly. The logic should be more specific to Azure naming conventions.
Copilot uses AI. Check for mistakes.
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.
Note that 'test1spec' type pattern would not be added according to Azure spec/family naming rule.
So, the chance for false positives would be limited.
/approve |