Skip to content

Conversation

@cgwalters
Copy link
Collaborator

This streamlines the UX of upgrading from a local build; it's part of the idea of #86 but this is a lot smaller than that.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an --update-from-host flag to libvirt-run to streamline upgrading from a local build. The changes are well-structured, adding a new target_transport option and propagating it through the system, including metadata and documentation. My review includes suggestions to improve command-line argument handling for robustness and consistency, and a minor point on code maintainability by avoiding a magic string.

Comment on lines 64 to 66
if let Some(t) = self.target_transport.as_deref() {
args.push(format!("--target-transport={t}"));
}

Choose a reason for hiding this comment

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

medium

The argument for target_transport is being formatted as a single string "--target-transport={t}". This is inconsistent with how filesystem and root_size arguments are handled, which are pushed as two separate strings ("--filesystem", filesystem.clone()). For consistency and to avoid potential issues with how bootc parses arguments, it would be better to follow the existing pattern for options with values.

Suggested change
if let Some(t) = self.target_transport.as_deref() {
args.push(format!("--target-transport={t}"));
}
if let Some(ref t) = self.target_transport {
args.push("--target-transport".to_string());
args.push(t.clone());
}

Comment on lines 269 to 270
#[clap(long)]
pub update_from_host: bool,

Choose a reason for hiding this comment

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

medium

The --update-from-host flag implicitly sets --target-transport to containers-storage. If a user specifies both --update-from-host and a different --target-transport, the user-provided transport will be silently overridden. This could be confusing.

To prevent this, you can make the arguments mutually exclusive using clap's conflicts_with attribute. This will cause clap to error out if both are provided, making the behavior clearer to the user.

Suggested change
#[clap(long)]
pub update_from_host: bool,
#[clap(long, conflicts_with = "target-transport")]
pub update_from_host: bool,


if opts.update_from_host {
opts.bind_storage_ro = true;
opts.install.target_transport = Some("containers-storage".to_owned());

Choose a reason for hiding this comment

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

medium

The string literal "containers-storage" is used here. To avoid using a magic string, consider defining it as a constant at the module level, for example: const UPDATE_FROM_HOST_TRANSPORT: &str = "containers-storage";. This improves maintainability and readability.

@cgwalters cgwalters enabled auto-merge (rebase) November 7, 2025 21:40
@cgwalters cgwalters requested a review from jeckersb November 10, 2025 14:35
This streamlines the UX of upgrading from a local build; it's
part of the idea of bootc-dev#86
but this is a lot smaller than that.

Signed-off-by: Colin Walters <[email protected]>
@cgwalters cgwalters force-pushed the install-target-imgref branch from d0c785b to 82f8284 Compare November 10, 2025 14:45
@cgwalters cgwalters merged commit d9cc0d8 into bootc-dev:main Nov 10, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants