Skip to content
Open
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
40 changes: 18 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,17 @@ parking_lot = "0.12"
rpassword = "7"
russh = "0.62.4"
russh-sftp = "2.3.0"

# Keep this stack reproducible until the block-capacity API is released.
[patch.crates-io]
msb_krun = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_arch = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_arch_gen = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_cpuid = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_devices = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_hvf = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_kernel = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_polly = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_smbios = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_utils = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
msb_krun_vmm = { git = "https://github.com/superradcompany/libkrun", rev = "ec9f119dcc144f1c011fe62ebd224d660c2191a3" }
31 changes: 31 additions & 0 deletions crates/agentd/lib/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@ async fn handle_message(
heartbeat_control: &heartbeat::HeartbeatControl,
) -> AgentdResult<()> {
match msg.t {
MessageType::RootDiskPrepare | MessageType::RootDiskGrow => {
let Some(request) = decode_payload_or_core_error::<
microsandbox_protocol::core::RootDiskGrow,
>(&msg, out_buf)?
else {
return Ok(());
};
let apply = msg.t == MessageType::RootDiskGrow;
let result = tokio::task::spawn_blocking(move || {
crate::root_disk::resize(request.size_bytes, apply)
})
.await
.map_err(|e| AgentdError::ExecSession(format!("root grow worker: {e}")))?;
let reply = match result {
Ok(state) => Message::with_payload(MessageType::RootDiskState, msg.id, &state),
Err(message) => Message::with_payload(
MessageType::CoreError,
msg.id,
&CoreError {
kind: CoreErrorKind::CapabilityUnavailable,
message,
offending_type: Some(msg.t.as_str().into()),
},
),
}
.map_err(|e| AgentdError::ExecSession(format!("encode root capacity: {e}")))?;
codec::encode_to_buf(&reply, out_buf).map_err(|e| {
AgentdError::ExecSession(format!("encode root capacity frame: {e}"))
})?;
}

MessageType::Ping => {
let Some(_) = decode_payload_or_core_error::<Ping>(&msg, out_buf)? else {
return Ok(());
Expand Down
2 changes: 2 additions & 0 deletions crates/agentd/lib/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ mod linux {
match spec {
BlockRootSpec::DiskImage { device, fstype } => {
mount_disk_image(device, fstype.as_deref())?;
crate::root_disk::register("/newroot", device);
}
BlockRootSpec::OciErofs { lower, upper } => {
mount_oci_erofs(lower, upper)?;
Expand Down Expand Up @@ -328,6 +329,7 @@ mod linux {
None::<&str>,
)
.map_err(|e| AgentdError::Init(format!("mount {device} at {upperfs_dir}: {e}")))?;
crate::root_disk::register(upperfs_dir, device);
}
BlockRootUpper::Tmpfs { size_mib } => {
let data = size_mib
Expand Down
1 change: 1 addition & 0 deletions crates/agentd/lib/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
mod config;
mod error;
mod rlimit;
mod root_disk;
mod workload;

//--------------------------------------------------------------------------------------------------
Expand Down
Loading