diff --git a/src/vmm/src/devices/virtio/block/vhost_user/device.rs b/src/vmm/src/devices/virtio/block/vhost_user/device.rs index d5b096da885..99b27915598 100644 --- a/src/vmm/src/devices/virtio/block/vhost_user/device.rs +++ b/src/vmm/src/devices/virtio/block/vhost_user/device.rs @@ -336,13 +336,13 @@ impl VirtioDevice for VhostUserBlock // with guest driver as well. self.vu_handle .set_features(self.acked_features) - .map_err(ActivateError::VhostUser)?; - self.vu_handle - .setup_backend( - &mem, - &[(0, &self.queues[0], &self.queue_evts[0])], - &self.irq_trigger, - ) + .and_then(|()| { + self.vu_handle.setup_backend( + &mem, + &[(0, &self.queues[0], &self.queue_evts[0])], + &self.irq_trigger, + ) + }) .map_err(|err| { self.metrics.activate_fails.inc(); ActivateError::VhostUser(err) diff --git a/src/vmm/src/devices/virtio/block/virtio/device.rs b/src/vmm/src/devices/virtio/block/virtio/device.rs index b9a952e3daf..7313cbb8b5c 100644 --- a/src/vmm/src/devices/virtio/block/virtio/device.rs +++ b/src/vmm/src/devices/virtio/block/virtio/device.rs @@ -652,6 +652,7 @@ impl VirtioDevice for VirtioBlock { } if self.activate_evt.write(1).is_err() { + self.metrics.activate_fails.inc(); return Err(ActivateError::EventFd); } self.device_state = DeviceState::Activated(mem); diff --git a/src/vmm/src/devices/virtio/net/device.rs b/src/vmm/src/devices/virtio/net/device.rs index 3ab8b0ad66c..1e0d2153296 100755 --- a/src/vmm/src/devices/virtio/net/device.rs +++ b/src/vmm/src/devices/virtio/net/device.rs @@ -862,6 +862,7 @@ impl VirtioDevice for Net { } if self.activate_evt.write(1).is_err() { + self.metrics.activate_fails.inc(); return Err(ActivateError::EventFd); } self.device_state = DeviceState::Activated(mem);