vmm: Implement HTTP API for obtaining counters

The counters are a hash of device name to hash of counter name to u64
value. Currently the API is only implemented with a stub that returns an
empty set of counters.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2020-06-24 11:20:13 +01:00
committed by Samuel Ortiz
parent fd4aba8eae
commit bca8a19244
5 changed files with 57 additions and 3 deletions

View File

@@ -44,8 +44,8 @@ use linux_loader::cmdline::Cmdline;
#[cfg(target_arch = "x86_64")]
use linux_loader::loader::elf::Error::InvalidElfMagicNumber;
use linux_loader::loader::KernelLoader;
use signal_hook::{iterator::Signals, SIGINT, SIGTERM, SIGWINCH};
use std::collections::HashMap;
#[cfg(target_arch = "x86_64")]
use std::convert::TryInto;
use std::ffi::CString;
@@ -53,6 +53,7 @@ use std::fs::{File, OpenOptions};
use std::io::{self, Write};
#[cfg(target_arch = "x86_64")]
use std::io::{Seek, SeekFrom};
use std::num::Wrapping;
use std::ops::Deref;
use std::path::PathBuf;
use std::sync::{Arc, Mutex, RwLock};
@@ -992,6 +993,10 @@ impl Vm {
Ok(pci_device_info)
}
pub fn counters(&self) -> Result<HashMap<String, HashMap<&'static str, Wrapping<u64>>>> {
Ok(HashMap::new())
}
fn os_signal_handler(signals: Signals, console_input_clone: Arc<Console>, on_tty: bool) {
for signal in signals.forever() {
match signal {