vmm: Report enabled features from the '/vmm.ping' endpoint

Fixes: #5817

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2023-10-04 11:20:34 -07:00 committed by Rob Bradford
parent 11838fca11
commit ff651e0e28
4 changed files with 31 additions and 0 deletions

View File

@ -64,6 +64,8 @@ serde_json = "1.0.107"
test_infra = { path = "test_infra" }
wait-timeout = "0.2.0"
# Please adjust `vmm::feature_list()` accordingly when changing the
# feature list below
[features]
default = ["kvm", "io_uring"]
dbus_api = ["zbus", "vmm/dbus_api"]

View File

@ -171,6 +171,7 @@ pub struct VmmPingResponse {
pub build_version: String,
pub version: String,
pub pid: i64,
pub features: Vec<String>,
}
#[derive(Clone, Deserialize, Serialize, Default, Debug)]

View File

@ -445,6 +445,10 @@ components:
pid:
type: integer
format: int64
features:
type: array
items:
type: string
description: Virtual Machine Monitor information
VmInfo:

View File

@ -293,6 +293,29 @@ impl Serialize for PciDeviceInfo {
}
}
pub fn feature_list() -> Vec<String> {
vec![
#[cfg(feature = "dbus_api")]
"dbus_api".to_string(),
#[cfg(feature = "dhat-heap")]
"dhat-heap".to_string(),
#[cfg(feature = "guest_debug")]
"guest_debug".to_string(),
#[cfg(feature = "io_uring")]
"io_uring".to_string(),
#[cfg(feature = "kvm")]
"kvm".to_string(),
#[cfg(feature = "mshv")]
"mshv".to_string(),
#[cfg(feature = "sev_snp")]
"sev_snp".to_string(),
#[cfg(feature = "tdx")]
"tdx".to_string(),
#[cfg(feature = "tracing")]
"tracing".to_string(),
]
}
pub fn start_event_monitor_thread(
mut monitor: event_monitor::Monitor,
seccomp_action: &SeccompAction,
@ -931,6 +954,7 @@ impl Vmm {
build_version,
version,
pid: std::process::id() as i64,
features: feature_list(),
}
}