feat(azure-compute): create managed image from a disk - #908
Merged
Conversation
Extend driver ImageConfig/ImageInfo with a disk-source alternative (OSDiskID/OSType/OSState/DiskSizeGB). The Azure images handler now builds a managed image directly from storageProfile.osDisk.managedDisk.id when sourceVirtualMachine is absent, validating the disk and capturing its size; the VM-capture branch is unchanged. Ref #611.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a source-disk path for Azure managed images. Previously an image could only be created by capturing a VM (
sourceVirtualMachine). This letsarmcomputeImagesClientcreate aMicrosoft.Compute/imagesdirectly from an existing managed disk viastorageProfile.osDisk.managedDisk.id, with no VM involved.driver.ImageConfig/ImageInfogain optionalOSDiskID/OSType/OSState/DiskSizeGB— a disk-source alternative toInstanceID.sourceVirtualMachineis absent butstorageProfile.osDisk.managedDisk.idis present, it resolves the disk by its ARM name (mirroringdisks/handler.go), captures its size, and creates the image from the disk. The VM-capture branch is untouched.storageProfile.osDiskwithmanagedDisk,osType,osState,diskSizeGB. Sync-200 (no LRO), matching the existing images poller contract.Architecture fit
managedDisk, and the newImageInfojson tags) are allomitempty, so old images serialize identically on the wire and in snapshots.OSDiskIDholds the client-facing ARM disk ID (drift-safe echo); the wire handler owns disk-existence validation (the provider does not treat it as a driver key).hugeParamgocritic nolint added to eachCreateImageimpl (AWS/GCP/Azure/portable) follows the existing interface-signature convention (UpdateVolumealready carries it) — growingImageConfigpast 80 bytes trips it uniformly.Persistence note
The images store is already in the VM mock's snapshot dumps list, and the new
ImageInfofields are exported, so they persist automatically. Verified with a snapshot -> restore round-trip test assertingOSDiskID/OSType/OSState/DiskSizeGBsurvive.Test
armcomputeDisksClient+ImagesClient): create a disk, create an image frommanagedDisk.id(nosourceVirtualMachine) ->Getround-tripsosType/osState/diskSizeGB/managedDisk.id, andsourceVirtualMachineis absent.Ref #611.