fix: size boot disks from the image instead of failing - #152
Conversation
|
Heads-up on ordering with #150, which is open against the same disk documentation. The Ruby merges cleanly — #150 changes Resolution is to take the and the same pairing in the deprecated-options table. I test-merged the two branches with that resolution locally: |
The driver hardcodes a 10 GB default boot disk. GCE refuses to create a
disk smaller than the image it is cloned from, so every image larger
than 10 GB fails at create with stock configuration:
Google::Apis::ClientError: invalid: Invalid value for field
'resource.disks[0].initializeParams.diskSizeGb': '10'. Requested
disk size cannot be smaller than the image size (50 GB)
Current sizes of the stock images this affects:
ubuntu-2204-lts 10 GB ok
debian-12 10 GB ok
rocky-linux-9 20 GB fails
centos-stream-9 20 GB fails
windows-2022 50 GB fails
windows-2025 50 GB fails
Every Windows image is 50 GB, so the driver's Windows support - the
`email` option, the WinRM startup script and the whole password reset
path - could not be reached at all without the user first discovering
that they had to set `disk_size` by hand.
Rather than fail over a size the user never chose, look up the image's
own size and raise the request to meet it, logging that it happened. An
explicitly configured size larger than the image is still honoured
untouched, and a size GCE could never accept is now corrected rather
than rejected. The same treatment is applied to extra disks built from
a `custom_image`, which have the identical constraint.
Verified against real GCE: rocky-linux-9 and windows-2022 both now
create, converge and verify with no disk configuration at all.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
31e3073 to
7ce271a
Compare
|
Rebased onto The only conflict was the one predicted above, in README.md. Resolved as described — The Ruby merged without conflict, and the two changes compose the way you would want — #150 guards params.disk_type = disk_type_url_for(disk_config[:disk_type]) if disk_config[:disk_type]
...
elsif disk.boot
params.disk_size_gb = disk_size_for_image(disk_config[:disk_size], image_name)Re-verified against live GCE on the rebased branch rather than assuming, since Local |
What
When a disk is cloned from an image, look up the image's own size and raise the requested size to meet it, logging that it happened.
Why
The driver hardcodes a 10 GB default boot disk. GCE refuses to create a disk smaller than the image it is cloned from, so every image larger than 10 GB fails at create with stock configuration:
Current sizes of the stock images this affects:
disk_sizeunsetubuntu-2204-ltsdebian-12rocky-linux-9centos-stream-9windows-2022windows-2025Every Windows image is 50 GB. That means the driver's Windows support — the
emailoption, the WinRM startup script, and the whole password-reset path added in 3.0.0 — could not be reached at all unless the user first worked out on their own that they had to setdisk_sizeby hand. There is nothing in the README that says so.Approach
Failing over a size the user never chose is not useful, and GCE cannot honour a smaller value under any circumstances, so the driver corrects it and says what it did:
An explicitly configured size larger than the image is honoured untouched. The same treatment is applied to extra disks built from a
custom_image, which carry the identical constraint. Image sizes are memoised per name, and a lookup failure falls back to the configured value rather than raising.Verification
Against real GCE. Before this change
rocky-9andwindows-2022both fail at create; after it, both complete the fullkitchen testcycle with no disk configuration at all:Unit coverage added for: no size requested, a smaller size requested, a larger size requested, a
custom_imageextra disk, and an image that reports no size.🤖 Generated with Claude Code