vmm: device_manager: Create a virtio-net device from TAP fd

If a TAP fd is supplied then create an virtio-net device using that TAP
fd.

Fixes: #2052

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-12-16 17:31:10 +00:00 committed by Samuel Ortiz
parent 72e5ed3372
commit 7f9cdf1183

View File

@ -1809,6 +1809,18 @@ impl DeviceManager {
) )
.map_err(DeviceManagerError::CreateVirtioNet)?, .map_err(DeviceManagerError::CreateVirtioNet)?,
)) ))
} else if let Some(fd) = net_cfg.fd {
Arc::new(Mutex::new(
virtio_devices::Net::from_tap_fd(
id.clone(),
fd,
Some(net_cfg.mac),
net_cfg.iommu,
net_cfg.queue_size,
self.seccomp_action.clone(),
)
.map_err(DeviceManagerError::CreateVirtioNet)?,
))
} else { } else {
Arc::new(Mutex::new( Arc::new(Mutex::new(
virtio_devices::Net::new( virtio_devices::Net::new(