vm-virtio, vmm: Delete unix socket on shutdown

It's not possible to call UnixListener::Bind() on an existing file so
unlink the created socket when shutting down the Vsock device.

This will allow the VM to be rebooted with a vsock device.

Fixes: #1083

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2020-05-05 10:54:38 +01:00
committed by Sebastien Boeuf
parent 5109f914eb
commit fec97e0586
3 changed files with 31 additions and 4 deletions

View File

@@ -1714,8 +1714,14 @@ impl DeviceManager {
.map_err(DeviceManagerError::CreateVsockBackend)?;
let vsock_device = Arc::new(Mutex::new(
vm_virtio::Vsock::new(id.clone(), vsock_cfg.cid, backend, vsock_cfg.iommu)
.map_err(DeviceManagerError::CreateVirtioVsock)?,
vm_virtio::Vsock::new(
id.clone(),
vsock_cfg.cid,
vsock_cfg.sock.clone(),
backend,
vsock_cfg.iommu,
)
.map_err(DeviceManagerError::CreateVirtioVsock)?,
));
self.add_migratable_device(Arc::clone(&vsock_device) as Arc<Mutex<dyn Migratable>>);