API: remove ProcessListContainer/ListProcesses

This commit will remove ProcessListContainer API from VCSandbox
and ListProcesses from agent.proto.

Fixes: #1668

Signed-off-by: bin <bin@hyper.sh>
This commit is contained in:
bin
2021-04-09 16:03:29 +08:00
parent d75fe95685
commit 421439c633
17 changed files with 255 additions and 1012 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,