mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
vmm: Start the HTTP server thread
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
b14fd37db9
commit
aa31748781
@ -338,8 +338,13 @@ fn main() {
|
||||
let (api_request_sender, api_request_receiver) = channel();
|
||||
let api_evt = EventFd::new(EFD_NONBLOCK).expect("Cannot create API EventFd");
|
||||
|
||||
let vmm_thread = match vmm::start_vmm_thread(api_evt.try_clone().unwrap(), api_request_receiver)
|
||||
{
|
||||
let http_sender = api_request_sender.clone();
|
||||
let vmm_thread = match vmm::start_vmm_thread(
|
||||
api_socket_path,
|
||||
api_evt.try_clone().unwrap(),
|
||||
http_sender,
|
||||
api_request_receiver,
|
||||
) {
|
||||
Ok(t) => t,
|
||||
Err(e) => {
|
||||
println!("Failed spawning the VMM thread {:?}", e);
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user