Merge pull request #1670 from liubin/1668-remove-ProcessListContainer-API

remove ProcessListContainer API
This commit is contained in:
Fupan Li
2021-04-12 10:22:37 +08:00
committed by GitHub
16 changed files with 240 additions and 954 deletions

View File

@@ -79,9 +79,6 @@ const CMD_REPEAT: &'static str = "repeat";
const DEFAULT_PROC_SIGNAL: &'static str = "SIGKILL";
// Format is either "json" or "table".
const DEFAULT_PS_FORMAT: &str = "json";
const ERR_API_FAILED: &str = "API failed";
static AGENT_CMDS: &'static [AgentCmd] = &[
@@ -155,11 +152,6 @@ static AGENT_CMDS: &'static [AgentCmd] = &[
st: ServiceType::Agent,
fp: agent_cmd_sandbox_list_routes,
},
AgentCmd {
name: "ListProcesses",
st: ServiceType::Agent,
fp: agent_cmd_container_list_processes,
},
AgentCmd {
name: "MemHotplugByProbe",
st: ServiceType::Agent,
@@ -1101,40 +1093,6 @@ fn agent_cmd_sandbox_get_guest_details(
Ok(())
}
fn agent_cmd_container_list_processes(
ctx: &Context,
client: &AgentServiceClient,
_health: &HealthClient,
options: &mut Options,
args: &str,
) -> Result<()> {
let mut req = ListProcessesRequest::default();
let ctx = clone_context(ctx);
let cid = utils::get_option("cid", options, args);
let mut list_format = utils::get_option("format", options, args);
if list_format == "" {
list_format = DEFAULT_PS_FORMAT.to_string();
}
req.set_container_id(cid);
req.set_format(list_format);
debug!(sl!(), "sending request"; "request" => format!("{:?}", req));
let reply = client
.list_processes(ctx, &req)
.map_err(|e| anyhow!("{:?}", e).context(ERR_API_FAILED))?;
info!(sl!(), "response received";
"response" => format!("{:?}", reply));
Ok(())
}
fn agent_cmd_container_wait_process(
ctx: &Context,
client: &AgentServiceClient,