mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-22 04:18:53 +00:00
agent: add get volume stats handler in agent
retrieve the stats of direct-assigned volumes from the guest Fixes: #3454 Signed-off-by: shuochen0311 <shuo.chen@databricks.com>
This commit is contained in:
@@ -171,6 +171,11 @@ static AGENT_CMDS: &[AgentCmd] = &[
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_get_oom_event,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "GetVolumeStats",
|
||||
st: ServiceType::Agent,
|
||||
fp: agent_cmd_sandbox_get_volume_stats,
|
||||
},
|
||||
AgentCmd {
|
||||
name: "ListInterfaces",
|
||||
st: ServiceType::Agent,
|
||||
@@ -1641,6 +1646,29 @@ fn agent_cmd_sandbox_get_oom_event(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_sandbox_get_volume_stats(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
_health: &HealthClient,
|
||||
_options: &mut Options,
|
||||
args: &str,
|
||||
) -> Result<()> {
|
||||
let req: VolumeStatsRequest = utils::make_request(args)?;
|
||||
|
||||
let ctx = clone_context(ctx);
|
||||
|
||||
debug!(sl!(), "sending request"; "request" => format!("{:?}", req));
|
||||
|
||||
let reply = client
|
||||
.get_volume_stats(ctx, &req)
|
||||
.map_err(|e| anyhow!(e).context(ERR_API_FAILED))?;
|
||||
|
||||
info!(sl!(), "response received";
|
||||
"response" => format!("{:?}", reply));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn agent_cmd_sandbox_copy_file(
|
||||
ctx: &Context,
|
||||
client: &AgentServiceClient,
|
||||
|
Reference in New Issue
Block a user