Skip to content
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

{Compute} az sig image-version create: Change --virtual-machine parameter map to new VM backend field #28627

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/vm/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4782,6 +4782,8 @@ def create_image_version(cmd, resource_group_name, gallery_name, gallery_image_n
source = os_disk_image = data_disk_images = None
if managed_image is not None:
source = GalleryArtifactVersionFullSource(id=managed_image)
if virtual_machine is not None:
Copy link
Member

Choose a reason for hiding this comment

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

The issue mentioned the min API version is 2023-07-03. Should we wrap the code with min_api check?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes,added.

source = GalleryArtifactVersionFullSource(virtual_machine_id=virtual_machine)
Copy link
Member

Choose a reason for hiding this comment

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

Accord to the L2425-L2434 in file vm/_validators.py, the virtual_machine value is also assigned to managed_image. Consequently, the line source = GalleryArtifactVersionFullSource(id=managed_image) will be executed even when a --virtual-machine argument is provided. This overlap could introduce potential risks.

if os_snapshot is not None:
os_disk_image = GalleryOSDiskImage(source=GalleryDiskImageSource(id=os_snapshot))
if data_snapshot_luns and not data_snapshots:
Expand Down
Loading
Loading