ch-remote: Add support for vmm.ping

Signed-off-by: Shuaiyi Zhang <zhangsy28@lenovo.com>
This commit is contained in:
Shuaiyi Zhang 2022-12-04 19:50:36 +08:00 committed by Bo Chen
parent ca6d338ffa
commit 0e09b537e3

View File

@ -8,6 +8,7 @@ extern crate clap;
use api_client::simple_api_command;
use api_client::simple_api_command_with_fds;
use api_client::simple_api_full_command;
use api_client::Error as ApiClientError;
use clap::{Arg, ArgAction, ArgMatches, Command};
use option_parser::{ByteSized, ByteSizedParseError};
@ -338,6 +339,9 @@ fn do_command(matches: &ArgMatches) -> Result<(), Error> {
Some("counters") => {
simple_api_command(&mut socket, "GET", "counters", None).map_err(Error::ApiClient)
}
Some("ping") => {
simple_api_full_command(&mut socket, "GET", "vmm.ping", None).map_err(Error::ApiClient)
}
Some("resize") => resize_api_command(
&mut socket,
matches
@ -675,6 +679,9 @@ fn main() {
Command::new("create")
.about("Create VM from a JSON configuration")
.arg(Arg::new("path").index(1).default_value("-")),
)
.subcommand(
Command::new("ping").about("Ping the VMM to check for API server availability"),
);
let matches = app.get_matches();