Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install: Enable composefs by default, add a disable_composefs option #304

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,19 @@ async fn initialize_ostree_root_from_self(
} else {
"none"
};
for (k, v) in [
let composefs_enabled = !state.install_config.disable_composefs.unwrap_or_default();
tracing::debug!("composefs: {composefs_enabled}");
let repo_opts = [
("sysroot.bootloader", bootloader),
// Always flip this one on because we need to support alongside installs
// to systems without a separate boot partition.
("sysroot.bootprefix", "true"),
("sysroot.readonly", "true"),
] {
]
.into_iter()
.chain(composefs_enabled.then_some(("ex-integrity.composefs", "true")));

for (k, v) in repo_opts {
Task::new("Configuring ostree repo", "ostree")
.args(["config", "--repo", "ostree/repo", "set", k, v])
.cwd(rootfs_dir)?
Expand Down
23 changes: 18 additions & 5 deletions lib/src/install/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub(crate) struct BasicFilesystems {
pub(crate) struct InstallConfiguration {
/// Root filesystem type
pub(crate) root_fs_type: Option<super::baseline::Filesystem>,
/// Allow disabling composefs
pub(crate) disable_composefs: Option<bool>,
pub(crate) filesystem: Option<BasicFilesystems>,
/// Kernel arguments, applied at installation time
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -93,6 +95,7 @@ impl Mergeable for InstallConfiguration {
/// Apply any values in other, overriding any existing values in `self`.
fn merge(&mut self, other: Self) {
merge_basic(&mut self.root_fs_type, other.root_fs_type);
merge_basic(&mut self.disable_composefs, other.disable_composefs);
self.filesystem.merge(other.filesystem);
if let Some(other_kargs) = other.kargs {
self.kargs
Expand Down Expand Up @@ -179,6 +182,7 @@ root-fs-type = "xfs"
root_fs_type: Some(Filesystem::Ext4),
filesystem: None,
kargs: None,
..Default::default()
}),
};
install.merge(other.install.unwrap());
Expand Down Expand Up @@ -206,18 +210,23 @@ kargs = ["console=ttyS0", "foo=bar"]
assert_eq!(install.root_fs_type.unwrap(), Filesystem::Ext4);
let other = InstallConfigurationToplevel {
install: Some(InstallConfiguration {
root_fs_type: None,
filesystem: None,
kargs: Some(
["console=tty0", "nosmt"]
.into_iter()
.map(ToOwned::to_owned)
.collect(),
),
..Default::default()
}),
};
assert!(install.disable_composefs.is_none());
install.merge(other.install.unwrap());
install.merge(InstallConfiguration {
disable_composefs: Some(true),
..Default::default()
});
assert_eq!(install.root_fs_type.unwrap(), Filesystem::Ext4);
assert!(install.disable_composefs.unwrap());
assert_eq!(
install.kargs,
Some(
Expand All @@ -226,7 +235,12 @@ kargs = ["console=ttyS0", "foo=bar"]
.map(ToOwned::to_owned)
.collect()
)
)
);
install.merge(InstallConfiguration {
disable_composefs: Some(false),
..Default::default()
});
assert!(!install.disable_composefs.unwrap());
}

#[test]
Expand All @@ -245,13 +259,12 @@ type = "xfs"
);
let other = InstallConfigurationToplevel {
install: Some(InstallConfiguration {
root_fs_type: None,
filesystem: Some(BasicFilesystems {
root: Some(RootFS {
fstype: Some(Filesystem::Ext4),
}),
}),
kargs: None,
..Default::default()
}),
};
install.merge(other.install.unwrap());
Expand Down
3 changes: 2 additions & 1 deletion manpages-md-extra/bootc-install-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ that can be overridden in a derived container image.

This is the only defined toplevel table.

The `install`` section supports two subfields:
The `install`` section supports the following subfields:

- `filesystem`: See below.
- `disable_composefs`: A boolean, which will use the legacy ostree mode.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this needs more explanation, and maybe even a better name. Where exactly is being composefs disabled? In the kernel? In the filesystem layout in the root mount namespace? Might be also worth explaining what's the legacy ostree mode.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah...you're right this was under-documented (the real docs live on the ostree side right now). But the more I think about it the more I think this should be a property of the container, not bootc.

So ostreedev/ostree#3165 will make this work to configure that way.

- `kargs`: An array of strings; this will be appended to the set of kernel arguments.

# filesystem
Expand Down
Loading