check the container root before each start
This commit is contained in:
parent
0999cffdaf
commit
a44a7256a7
1 changed files with 624 additions and 12 deletions
|
|
@ -20,7 +20,8 @@
|
|||
//! dispatch table. Each op family's handlers and validation live in their
|
||||
//! own module: [`container`] (lifecycle), [`container_config`] (nspawn flags,
|
||||
//! systemd drop-ins), [`rootfs`] (the salvage of a container's root before it
|
||||
//! turns ephemeral), [`storage`] (btrfs subvolumes, quotas, snapshots, disk
|
||||
//! turns ephemeral), [`prestart`] (the check of a container's root that runs
|
||||
//! before each start, as a sub-command), [`storage`] (btrfs subvolumes, quotas, snapshots, disk
|
||||
//! measurement), [`files`] (pause marker, socket dir, legacy tmpfiles),
|
||||
//! [`infra`] (gateway nginx, infra containers) and [`closure`] (downloads from
|
||||
//! the swarm cache). Helpers more than one family uses are in [`shared`].
|
||||
|
|
@ -30,6 +31,7 @@ mod container;
|
|||
mod container_config;
|
||||
mod files;
|
||||
mod infra;
|
||||
mod prestart;
|
||||
mod rootfs;
|
||||
mod shared;
|
||||
mod storage;
|
||||
|
|
@ -44,6 +46,13 @@ use tokio::net::{UnixListener, UnixStream};
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
// `hive-priv check-rootfs <container>` is a container unit's `ExecStartPre=`,
|
||||
// not the daemon: it answers with an exit code and never touches the socket.
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
if let Some(code) = prestart::run(&args) {
|
||||
std::process::exit(code);
|
||||
}
|
||||
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue