diff options
author | Charles William Dick <cwd@google.com> | 2020-04-08 11:05:24 +0900 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-13 02:59:02 +0000 |
commit | ed22f6b611e2623f5836ccf1288adf6b46146088 (patch) | |
tree | 5b7204940ee070a2ed48f1164dee10de221db862 /src | |
parent | 4ee9bffbd5722ac6602abaac6f691917add12f48 (diff) | |
download | crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar.gz crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar.bz2 crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar.lz crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar.xz crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.tar.zst crosvm-ed22f6b611e2623f5836ccf1288adf6b46146088.zip |
crosvm balloon_stats command
In preparation for moving balloon sizing logic from crosvm to concierge, expose a balloon_stats command in crosvm. This will allow concierge to query the actual balloon size and available memory of VMs. BUG=b:153134684 TEST=(chroot)$ tast run <DUT> arc.Boot.vm; (vm)$ crosvm balloon_stats <pipe>; See stats are reported. Change-Id: I1f544526ee728a085d842035754a0c17cf41ed3f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2141752 Tested-by: Charles Dueck <cwd@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Chirantan Ekbote <chirantan@chromium.org> Commit-Queue: Charles Dueck <cwd@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index 241334d..6900099 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1474,6 +1474,19 @@ fn balloon_vms(mut args: std::env::Args) -> std::result::Result<(), ()> { vms_request(&VmRequest::BalloonCommand(command), args) } +fn balloon_stats(args: std::env::Args) -> std::result::Result<(), ()> { + if args.len() != 1 { + print_help("crosvm balloon_stats", "VM_SOCKET", &[]); + println!("Prints virtio balloon statistics for a `VM_SOCKET`."); + return Err(()); + } + let command = BalloonControlCommand::Stats {}; + let request = &VmRequest::BalloonCommand(command); + let response = handle_request(request, args)?; + println!("{}", response); + Ok(()) +} + fn create_qcow2(args: std::env::Args) -> std::result::Result<(), ()> { let arguments = [ Argument::positional("PATH", "where to create the qcow2 image"), @@ -1820,6 +1833,7 @@ fn crosvm_main() -> std::result::Result<(), ()> { Some("resume") => resume_vms(args), Some("run") => run_vm(args), Some("balloon") => balloon_vms(args), + Some("balloon_stats") => balloon_stats(args), Some("create_qcow2") => create_qcow2(args), Some("disk") => disk_cmd(args), Some("usb") => modify_usb(args), |