[PATCH V2 1/2] qemu: forbid define a capabilities mode hostdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hostdev has mode "capabilities" for LXC, from formatdomain.html:
"
Block / character devices from the host can be passed through to
the guest using the hostdev element.
This is only possible with container based virtualization.
since after 1.0.1 for LXC
"
So forbid capabilities mode hostdev if domain is not LXC.

The related bug is:
https://bugzilla.redhat.com/show_bug.cgi?id=1111044

Signed-off-by: Jincheng Miao <jmiao@xxxxxxxxxx>
---
 src/qemu/qemu_command.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2caee66..338235a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8907,6 +8907,14 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainHostdevDefPtr hostdev = def->hostdevs[i];
         char *devstr;
 
+        /* forbid capabilities mode hostdev in this type of hypervisor */
+        if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Unsupported capabilities mode hostdev in %s"),
+                           virDomainVirtTypeToString(def->virtType));
+            goto error;
+        }
+
         if (hostdev->info->bootIndex) {
             if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
                 (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
-- 
1.8.3.1

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]