[libvirt] [PATCH v3] qemu: network user/direct/hostdev do not support backend.

Julio Faracco posted 1 patch 6 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1511741382-5841-1-git-send-email-jcfaracco@gmail.com
src/qemu/qemu_domain.c | 10 ++++++++++
1 file changed, 10 insertions(+)
[libvirt] [PATCH v3] qemu: network user/direct/hostdev do not support backend.
Posted by Julio Faracco 6 years, 4 months ago
The tag backend is not supported for user/direct/hostdev network when you
try to define them inside the domain XML. So, other ways to include devices
cannot be permitted too. But the attach-device command is wrongly adding
unsupported features. This commit fixes this bug.

After the patch:

virsh # attach-device rhel7.4 backend.xml
error: Failed to attach device from backend.xml
error: unsupported configuration: Custom tap device path is not supported for: user

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1480251

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 src/qemu/qemu_domain.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9dab6b2..bee44d1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3622,6 +3622,16 @@ qemuDomainDeviceDefValidateNetwork(const virDomainNetDef *net)
         return -1;
     }
 
+    if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
+        net->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+        if (net->backend.tap) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                           _("Custom tap device path is not supported for: %s"),
+                           virDomainNetTypeToString(net->type));
+            return -1;
+        }
+    }
+
     if (STREQ_NULLABLE(net->model, "virtio")) {
         if (net->driver.virtio.rx_queue_size & (net->driver.virtio.rx_queue_size - 1)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-- 
2.7.4

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