Skip to content

Image detection updates#8590

Closed
pagienge wants to merge 2 commits intoAzure:mainfrom
pagienge:patch-1
Closed

Image detection updates#8590
pagienge wants to merge 2 commits intoAzure:mainfrom
pagienge:patch-1

Conversation

@pagienge
Copy link
Copy Markdown
Contributor

Updates for Linux image detection for az vm repair creation. New images are added, and the Gen 1 default is made to match Gen2 and ARM64. The Gen1 default turned out to actually be a Gen2 VM in practice, as it was dependent on the marketplace aliases.


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az vm repair create --verbose -g BADRG -n BADVM --repair-username USERNAME --repair-password 'yourPassHere!!!1' --distro=KEYWORD

General Guidelines

  • My extension version conforms to the Extension version schema
    -- this is probably a revision/update - need a hand with the version info update

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

fixing if/else code block to function
Updating image keywords, changing default Gen1 image from a marketplace alias, to match the style of Gen2/ARM, while updating both URNs
@azure-client-tools-bot-prd
Copy link
Copy Markdown

Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @pagienge,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Mar 21, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link
Copy Markdown
Contributor

Hi @pagienge

Release Suggestions

Module: vm-repair

  • Please log updates into to src/vm-repair/HISTORY.rst
  • Update VERSION to 2.1.1 in src/vm-repair/setup.py

Notes

else:
logger.info('No specific distro was provided , using the default Ubuntu distro')
os_image_urn = "Ubuntu2204"
os_image_urn = "Canonical:ubuntu-24_04-lts:server-gen1:latest"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why this specific image?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This loosely correlates to the image already being used in the other two code branches (arm64 and gen2). The issue here was that the Ubuntu2204 alias built elsewhere in ARM had been changed to a Gen2 image which broke several use-cases that rely on a Gen1 VM.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did also update the default ARM version since it was 18.04 and that version is way past EoL.

logger.info('Generation 2 VM detected')
os_image_urn = _select_distro_linux_gen2(distro)
if architecture_type == 'Arm64':
elif architecture_type == 'Arm64':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please add a test or show how an existing test passed with this change.

logger.info('Generation 2 VM detected')
os_image_urn = _select_distro_linux_gen2(distro)
if architecture_type == 'Arm64':
elif architecture_type == 'Arm64':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Arm64 is an elif to hyper v gen being v2? How are these related?
I can see how they call different methods to set the image urn, and so we only need 1, but why do the if checks make sense? Can Arm64 machines not have hyperv gen2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When you select arm64 you aren't allowed to change the generation

armNoGen

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The if/elif/else may not be the absolute best way to solve it, but it makes sense in the current Azure design. The current code is broken in that the initial V2 check never "sticks", it is always set to either ARM or Gen1 because that first V2 'if' is not conditionally tied to the ARM/V1 decision



def _select_distro_linux(distro):
# list of images needs to be added to before the docs reflect, and the docs need to remove the keywords long before we remove the reference from the extension
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As per our VM Repair dev docs, https://dev.azure.com/msazure/AzureWiki/_wiki/wikis/AzureWiki.wiki/702330/VM-Repair , please update the vm repair version in setup.py and history.rst files for this change. Should increment the 2nd integer for this feature.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll try to get a test now that I've got the doc to validate with. Would it be the 2nd or 3rd digit? I don't know what guidelines there are around versions, but I wouldn't think there's really anything important enough for a 'minor', this seems more revisionary, or bug-fix like.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@pagienge
Copy link
Copy Markdown
Contributor Author

Moved changes to #8620 for better git fork hygiene

@pagienge pagienge closed this Mar 31, 2025
@pagienge pagienge deleted the patch-1 branch January 12, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Compute

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants