From 0e09b537e383a0ccd7fada9d301525a56676f8ec Mon Sep 17 00:00:00 2001 From: Shuaiyi Zhang Date: Sun, 4 Dec 2022 19:50:36 +0800 Subject: [PATCH] ch-remote: Add support for vmm.ping Signed-off-by: Shuaiyi Zhang --- src/bin/ch-remote.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/ch-remote.rs b/src/bin/ch-remote.rs index 4a58dad6a..4c8ddd3d9 100644 --- a/src/bin/ch-remote.rs +++ b/src/bin/ch-remote.rs @@ -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();