feat(cuttlefish): implement storage flash via HO user artifacts - #1031
Draft
bennyz wants to merge 1 commit into
Draft
feat(cuttlefish): implement storage flash via HO user artifacts#1031bennyz wants to merge 1 commit into
bennyz wants to merge 1 commit into
Conversation
bennyz
marked this pull request as draft
August 27, 2026 09:52
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implement CvdFlasher.flash() to upload image archives to the Cuttlefish
Host Orchestrator's user-artifact store and stage them for the next CVD
creation.
The flow: stream the source to a temp file while computing its SHA-256
(HO addresses artifacts by checksum), skip the transfer if already
present, chunked-multipart PUT to /v1/userartifacts/{checksum}, extract
server-side, then create and populate an image directory. The resulting
dir id is staged on the parent so the next power.on() references it via
HO's @image_dirs/{id} token.
The large streaming upload uses httpx.AsyncClient so a multi-GB transfer
never blocks the event loop; the small JSON control-plane calls reuse the
existing sync operation-polling helpers via anyio.to_thread. A failed
chunk retries at the same offset (the offset scheme makes resume free),
rather than aborting the whole transfer.
power.on() injects the staged image dir via _env_config_for_create(),
which deep-copies the configured env_config and rewrites
common.host_package and each instance's disk.default_build to the
@image_dirs/{id} token (synthesizing an instance when none is
configured). With no staged dirs the configured env_config passes
through unchanged, preserving existing behavior.
Staged image dirs are reclaimed best-effort: re-flashing deletes the
previously staged dir, and close() deletes any remaining dirs at
teardown (a failed DELETE is logged, not raised, since HO refuses to
delete a dir a running CVD still references).
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
bennyz
force-pushed
the
cuttlefish-storage-flash
branch
from
August 27, 2026 10:34
2708dd0 to
c1adcde
Compare
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.
Implement CvdFlasher.flash() to upload image archives to the Cuttlefish Host Orchestrator's user-artifact store and stage them for the next CVD creation.
The flow: stream the source to a temp file while computing its SHA-256 (HO addresses artifacts by checksum), skip the transfer if already present, chunked-multipart PUT to /v1/userartifacts/{checksum}, extract server-side, then create and populate an image directory. The resulting dir id is staged on the parent so the next power.on() references it via HO's @image_dirs/{id} token.
The large streaming upload uses httpx.AsyncClient so a multi-GB transfer never blocks the event loop; the small JSON control-plane calls reuse the existing sync operation-polling helpers via anyio.to_thread.
env_config injection of the staged image dir (_env_config_for_create) is intentionally left as a follow-up decision (which fields, merge vs overwrite); with no staged dirs the configured env_config passes through unchanged, preserving existing behavior.