mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-09 14:25:21 +00:00
ch-remote: add support for coredump
Adding the wrapping layer to be able to coredump the guest from the ch-remote tool. Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
This commit is contained in:
parent
8b585b96c1
commit
0bb2060ca7
@ -264,6 +264,20 @@ fn restore_api_command(socket: &mut UnixStream, config: &str) -> Result<(), Erro
|
|||||||
.map_err(Error::ApiClient)
|
.map_err(Error::ApiClient)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn coredump_api_command(socket: &mut UnixStream, destination_url: &str) -> Result<(), Error> {
|
||||||
|
let coredump_config = vmm::api::VmCoredumpData {
|
||||||
|
destination_url: String::from(destination_url),
|
||||||
|
};
|
||||||
|
|
||||||
|
simple_api_command(
|
||||||
|
socket,
|
||||||
|
"PUT",
|
||||||
|
"coredump",
|
||||||
|
Some(&serde_json::to_string(&coredump_config).unwrap()),
|
||||||
|
)
|
||||||
|
.map_err(Error::ApiClient)
|
||||||
|
}
|
||||||
|
|
||||||
fn receive_migration_api_command(socket: &mut UnixStream, url: &str) -> Result<(), Error> {
|
fn receive_migration_api_command(socket: &mut UnixStream, url: &str) -> Result<(), Error> {
|
||||||
let receive_migration_data = vmm::api::VmReceiveMigrationData {
|
let receive_migration_data = vmm::api::VmReceiveMigrationData {
|
||||||
receiver_url: url.to_owned(),
|
receiver_url: url.to_owned(),
|
||||||
@ -422,6 +436,14 @@ fn do_command(matches: &ArgMatches) -> Result<(), Error> {
|
|||||||
.value_of("restore_config")
|
.value_of("restore_config")
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
),
|
),
|
||||||
|
Some("coredump") => coredump_api_command(
|
||||||
|
&mut socket,
|
||||||
|
matches
|
||||||
|
.subcommand_matches("coredump")
|
||||||
|
.unwrap()
|
||||||
|
.value_of("coredump_config")
|
||||||
|
.unwrap(),
|
||||||
|
),
|
||||||
Some("send-migration") => send_migration_api_command(
|
Some("send-migration") => send_migration_api_command(
|
||||||
&mut socket,
|
&mut socket,
|
||||||
matches
|
matches
|
||||||
@ -595,6 +617,11 @@ fn main() {
|
|||||||
.help(vmm::config::RestoreConfig::SYNTAX),
|
.help(vmm::config::RestoreConfig::SYNTAX),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.subcommand(
|
||||||
|
Command::new("coredump")
|
||||||
|
.about("Create a coredump from VM")
|
||||||
|
.arg(Arg::new("coredump_config").index(1).help("<file_path>")),
|
||||||
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
Command::new("send-migration")
|
Command::new("send-migration")
|
||||||
.about("Initiate a VM migration")
|
.about("Initiate a VM migration")
|
||||||
|
Loading…
Reference in New Issue
Block a user