[libvirt] [PATCH 03/11] qemuDomainAttachSCSIVHostDevice: manage /dev entry

Michal Privoznik posted 11 patches 9 years ago
[libvirt] [PATCH 03/11] qemuDomainAttachSCSIVHostDevice: manage /dev entry
Posted by Michal Privoznik 9 years ago
Again, one missed bit. This time without this commit there is no
/dev entry when attaching vhost SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_hotplug.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index dd6e31823..778c8ef20 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2532,6 +2532,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
     char *devstr = NULL;
     bool teardowncgroup = false;
     bool teardownlabel = false;
+    bool teardowndevice = false;
     bool releaseaddr = false;
 
     if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) {
@@ -2548,6 +2549,10 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
         return -1;
     }
 
+    if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
+        goto cleanup;
+    teardowndevice = true;
+
     if (qemuSetupHostdevCgroup(vm, hostdev) < 0)
         goto cleanup;
     teardowncgroup = true;
@@ -2613,6 +2618,9 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
         if (teardownlabel &&
             qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
+        if (teardowndevice &&
+            qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+            VIR_WARN("Unable to remove host device from /dev");
         if (releaseaddr)
             qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
     }
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 03/11] qemuDomainAttachSCSIVHostDevice: manage /dev entry
Posted by Peter Krempa 8 years, 12 months ago
On Wed, Feb 08, 2017 at 11:37:06 +0100, Michal Privoznik wrote:
> Again, one missed bit. This time without this commit there is no
> /dev entry when attaching vhost SCSI device.

Commit message is a bit confusing. So the /dev/ entry in the namespace
of the qemu process is not created when attaching scsi disks.

> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_hotplug.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list