mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 19:45:46 +00:00
vmm: api: include BUILD_VERSION
and CH pid in VmmPingResponse
Signed-off-by: Omer Faruk Bayram <omer.faruk@sartura.hr>
This commit is contained in:
parent
59012ccc6e
commit
346ee09e6b
@ -511,7 +511,7 @@ fn start_vmm(toplevel: TopLevel) -> Result<Option<String>, Error> {
|
|||||||
let vm_debug_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::CreateDebugEventFd)?;
|
let vm_debug_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::CreateDebugEventFd)?;
|
||||||
|
|
||||||
let vmm_thread = vmm::start_vmm_thread(
|
let vmm_thread = vmm::start_vmm_thread(
|
||||||
env!("CARGO_PKG_VERSION").to_string(),
|
vmm::VmmVersionInfo::new(env!("BUILD_VERSION"), env!("CARGO_PKG_VERSION")),
|
||||||
&api_socket_path,
|
&api_socket_path,
|
||||||
api_socket_fd,
|
api_socket_fd,
|
||||||
api_evt.try_clone().unwrap(),
|
api_evt.try_clone().unwrap(),
|
||||||
|
@ -165,7 +165,9 @@ pub struct VmInfo {
|
|||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
pub struct VmmPingResponse {
|
pub struct VmmPingResponse {
|
||||||
|
pub build_version: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
pub pid: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize, Default, Debug)]
|
#[derive(Clone, Deserialize, Serialize, Default, Debug)]
|
||||||
|
@ -438,8 +438,13 @@ components:
|
|||||||
- version
|
- version
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
build_version:
|
||||||
|
type: string
|
||||||
version:
|
version:
|
||||||
type: string
|
type: string
|
||||||
|
pid:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
description: Virtual Machine Monitor information
|
description: Virtual Machine Monitor information
|
||||||
|
|
||||||
VmInfo:
|
VmInfo:
|
||||||
|
@ -281,7 +281,7 @@ impl Serialize for PciDeviceInfo {
|
|||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn start_vmm_thread(
|
pub fn start_vmm_thread(
|
||||||
vmm_version: String,
|
vmm_version: VmmVersionInfo,
|
||||||
http_path: &Option<String>,
|
http_path: &Option<String>,
|
||||||
http_fd: Option<RawFd>,
|
http_fd: Option<RawFd>,
|
||||||
api_event: EventFd,
|
api_event: EventFd,
|
||||||
@ -322,7 +322,7 @@ pub fn start_vmm_thread(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut vmm = Vmm::new(
|
let mut vmm = Vmm::new(
|
||||||
vmm_version.to_string(),
|
vmm_version,
|
||||||
api_event,
|
api_event,
|
||||||
#[cfg(feature = "guest_debug")]
|
#[cfg(feature = "guest_debug")]
|
||||||
debug_event,
|
debug_event,
|
||||||
@ -390,6 +390,21 @@ struct VmMigrationConfig {
|
|||||||
memory_manager_data: MemoryManagerSnapshotData,
|
memory_manager_data: MemoryManagerSnapshotData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct VmmVersionInfo {
|
||||||
|
pub build_version: String,
|
||||||
|
pub version: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VmmVersionInfo {
|
||||||
|
pub fn new(build_version: &str, version: &str) -> Self {
|
||||||
|
Self {
|
||||||
|
build_version: build_version.to_owned(),
|
||||||
|
version: version.to_owned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Vmm {
|
pub struct Vmm {
|
||||||
epoll: EpollContext,
|
epoll: EpollContext,
|
||||||
exit_evt: EventFd,
|
exit_evt: EventFd,
|
||||||
@ -399,7 +414,7 @@ pub struct Vmm {
|
|||||||
debug_evt: EventFd,
|
debug_evt: EventFd,
|
||||||
#[cfg(feature = "guest_debug")]
|
#[cfg(feature = "guest_debug")]
|
||||||
vm_debug_evt: EventFd,
|
vm_debug_evt: EventFd,
|
||||||
version: String,
|
version: VmmVersionInfo,
|
||||||
vm: Option<Vm>,
|
vm: Option<Vm>,
|
||||||
vm_config: Option<Arc<Mutex<VmConfig>>>,
|
vm_config: Option<Arc<Mutex<VmConfig>>>,
|
||||||
seccomp_action: SeccompAction,
|
seccomp_action: SeccompAction,
|
||||||
@ -482,7 +497,7 @@ impl Vmm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new(
|
fn new(
|
||||||
vmm_version: String,
|
vmm_version: VmmVersionInfo,
|
||||||
api_evt: EventFd,
|
api_evt: EventFd,
|
||||||
#[cfg(feature = "guest_debug")] debug_evt: EventFd,
|
#[cfg(feature = "guest_debug")] debug_evt: EventFd,
|
||||||
#[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
|
#[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
|
||||||
@ -802,8 +817,15 @@ impl Vmm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn vmm_ping(&self) -> VmmPingResponse {
|
fn vmm_ping(&self) -> VmmPingResponse {
|
||||||
|
let VmmVersionInfo {
|
||||||
|
build_version,
|
||||||
|
version,
|
||||||
|
} = self.version.clone();
|
||||||
|
|
||||||
VmmPingResponse {
|
VmmPingResponse {
|
||||||
version: self.version.clone(),
|
build_version,
|
||||||
|
version,
|
||||||
|
pid: std::process::id() as i64,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2057,7 +2079,7 @@ mod unit_tests {
|
|||||||
|
|
||||||
fn create_dummy_vmm() -> Vmm {
|
fn create_dummy_vmm() -> Vmm {
|
||||||
Vmm::new(
|
Vmm::new(
|
||||||
"dummy".to_string(),
|
VmmVersionInfo::new("dummy", "dummy"),
|
||||||
EventFd::new(EFD_NONBLOCK).unwrap(),
|
EventFd::new(EFD_NONBLOCK).unwrap(),
|
||||||
#[cfg(feature = "guest_debug")]
|
#[cfg(feature = "guest_debug")]
|
||||||
EventFd::new(EFD_NONBLOCK).unwrap(),
|
EventFd::new(EFD_NONBLOCK).unwrap(),
|
||||||
|
Loading…
Reference in New Issue
Block a user