vmm: Start the HTTP server thread

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-09-26 18:19:00 +02:00
parent b14fd37db9
commit aa31748781
2 changed files with 19 additions and 4 deletions
+12 -2
View File
@@ -157,12 +157,17 @@ impl AsRawFd for EpollContext {
}
pub fn start_vmm_thread(
http_path: &str,
api_event: EventFd,
api_sender: Sender<ApiRequest>,
api_receiver: Receiver<ApiRequest>,
) -> Result<thread::JoinHandle<Result<()>>> {
thread::Builder::new()
let http_api_event = api_event.try_clone().map_err(Error::EventFdClone)?;
let thread = thread::Builder::new()
.name("vmm".to_string())
.spawn(move || {
// let vmm_api_event = api_event.try_clone().map_err(Error::EventFdClone)?;
let mut vmm = Vmm::new(api_event)?;
let receiver = Arc::new(api_receiver);
@@ -219,7 +224,12 @@ pub fn start_vmm_thread(
Ok(())
})
.map_err(Error::VmmThreadSpawn)
.map_err(Error::VmmThreadSpawn)?;
// The VMM thread is started, we can start serving HTTP requests
api::start_http_thread(http_path, http_api_event, api_sender)?;
Ok(thread)
}
pub fn vm_create(