virtio-devices: Print out error message from the net worker thread

Partially fixes: #1551

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2020-08-14 14:53:16 -07:00 committed by Sebastien Boeuf
parent 1bf7817c40
commit 3d6d9ca4de

View File

@ -206,7 +206,7 @@ pub struct Net {
config: VirtioNetConfig,
queue_evts: Option<Vec<EventFd>>,
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
epoll_threads: Option<Vec<thread::JoinHandle<result::Result<(), EpollHelperError>>>>,
epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
ctrl_queue_epoll_thread: Option<thread::JoinHandle<()>>,
paused: Arc<AtomicBool>,
paused_sync: Arc<Barrier>,
@ -492,7 +492,11 @@ impl VirtioDevice for Net {
let paused_sync = self.paused_sync.clone();
thread::Builder::new()
.name("virtio_net".to_string())
.spawn(move || handler.run(paused, paused_sync))
.spawn(move || {
if let Err(e) = handler.run(paused, paused_sync) {
error!("Error running worker: {:?}", e);
}
})
.map(|thread| epoll_threads.push(thread))
.map_err(|e| {
error!("failed to clone queue EventFd: {}", e);