Skip to content

Conversation

@Johan-Liebert1
Copy link
Collaborator

@Johan-Liebert1 Johan-Liebert1 commented Jan 15, 2026

Most of this is in prep for #1913

  1. Add option to reset soft reboot state

  2. Don't soft-reboot automatically
    Aligning with ostree API, now we only initiate soft-reboot if --apply
    is passed to bootc update, bootc switch, else we only prepare the
    soft reboot

  3. Update image digest query format
    After bootc/commit/49d753f996747a9b1f531abf35ba4e207cf4f020,
    composefs-rs saves config in the format oci-config-sha256:.
    Update to match the same

  4. composefs/update: Handle --download-only flag
    When --download-only is passed, only download the image into the
    composefs repository but don't finalize it.
    Conver the /run/composefs/staged-deployment to a JSON file and Add a
    finalization_locked field depending upon which the finalize service will
    either finalize the staged deployment or leave it as is for garbage
    collection (even though GC is not fully implemented right now).

Some commits are split from #1913

Copy link
Contributor

@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 several enhancements to composefs functionality. It adds an option to reset the soft reboot state and modifies the soft reboot logic to align with the ostree API, where a soft reboot is only initiated if --apply is passed. Additionally, it updates the image digest query format to match recent changes in composefs-rs. The changes are well-structured and improve the consistency and usability of the soft reboot feature. My review includes a suggestion to refactor a part of the new reset_soft_reboot function to improve code clarity and maintainability.

Comment on lines +31 to +55
let nextroot = run_dir
.open_dir_optional("nextroot")
.context("Opening nextroot")?;

let Some(nextroot) = nextroot else {
tracing::debug!("Nextroot is not a directory");
println!("No deployment staged for soft rebooting");
return Ok(());
};

let nextroot_mounted = nextroot
.is_mountpoint(".")?
.ok_or_else(|| anyhow::anyhow!("Failed to get mount info"))?;

if !nextroot_mounted {
tracing::debug!("Nextroot is not a mountpoint");
println!("No deployment staged for soft rebooting");
return Ok(());
}

unmount(NEXTROOT, UnmountFlags::DETACH).context("Unmounting nextroot")?;

println!("Soft reboot state cleared successfully");

Ok(())
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The logic to check for the existence and mount status of nextroot can be simplified to avoid code duplication and multiple return paths. This refactoring consolidates the checks into a single conditional block, making the function's control flow more straightforward and easier to maintain.

    let nextroot = run_dir
        .open_dir_optional("nextroot")
        .context("Opening nextroot")?;

    let mounted = match nextroot {
        Some(nextroot) => {
            let is_mounted = nextroot
                .is_mountpoint(".")?
                .ok_or_else(|| anyhow::anyhow!("Failed to get mount info"))?;
            if !is_mounted {
                tracing::debug!("Nextroot is not a mountpoint");
            }
            is_mounted
        }
        None => {
            tracing::debug!("Nextroot is not a directory");
            false
        }
    };

    if mounted {
        unmount(NEXTROOT, UnmountFlags::DETACH).context("Unmounting nextroot")?;
        println!("Soft reboot state cleared successfully");
    } else {
        println!("No deployment staged for soft rebooting");
    }

    Ok(())

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
Aligning with ostree API, now we only initiate soft-reboot if `--apply`
is passed to `bootc update`, `bootc switch`, else we only prepare the
soft reboot

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
After bootc/commit/49d753f996747a9b1f531abf35ba4e207cf4f020,
composefs-rs saves config in the format `oci-config-sha256:`.

Update to match the same

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
When `--download-only` is passed, only download the image into the
composefs repository but don't finalize it.

Conver the /run/composefs/staged-deployment to a JSON file and Add a
finalization_locked field depending upon which the finalize service will
either finalize the staged deployment or leave it as is for garbage
collection (even though GC is not fully implemented right now).

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
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.

1 participant