mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
main: Enable the api-socket to be passed as an fd
To avoid race issues where the api-socket may not be created by the time a cloud-hypervisor caller is ready to look for it, enable the caller to pass the api-socket fd directly. Avoid breaking current callers by allowing the --api-socket path to be passed as it is now in addition to through the path argument. Signed-off-by: William Douglas <william.r.douglas@gmail.com>
This commit is contained in:
+6
-2
@@ -247,9 +247,11 @@ impl Serialize for PciDeviceInfo {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn start_vmm_thread(
|
||||
vmm_version: String,
|
||||
http_path: &Option<String>,
|
||||
http_fd: Option<RawFd>,
|
||||
api_event: EventFd,
|
||||
api_sender: Sender<ApiRequest>,
|
||||
api_receiver: Receiver<ApiRequest>,
|
||||
@@ -280,9 +282,11 @@ pub fn start_vmm_thread(
|
||||
})
|
||||
.map_err(Error::VmmThreadSpawn)?;
|
||||
|
||||
// The VMM thread is started, we can start serving HTTP requests
|
||||
if let Some(http_path) = http_path {
|
||||
// The VMM thread is started, we can start serving HTTP requests
|
||||
api::start_http_thread(http_path, http_api_event, api_sender, seccomp_action)?;
|
||||
api::start_http_path_thread(http_path, http_api_event, api_sender, seccomp_action)?;
|
||||
} else if let Some(http_fd) = http_fd {
|
||||
api::start_http_fd_thread(http_fd, http_api_event, api_sender, seccomp_action)?;
|
||||
}
|
||||
Ok(thread)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user