Re: [PATCH 2/2] conf: network user/direct/hostdev do not support backend tag.

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

 



On Mon, Oct 16, 2017 at 10:07:58PM -0200, Julio Faracco wrote:
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@xxxxxxxxx>
---
src/conf/domain_conf.c   | 10 ++++++++++
tests/qemuxml2argvtest.c |  6 +++---
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0f306b7..2842533 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10518,6 +10518,16 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
            } else if (virXMLNodeNameEqual(cur, "backend")) {
                char *tmp = NULL;

+                /* user/direct/hostdev do not support backend */
+                if (def->type == VIR_DOMAIN_NET_TYPE_USER ||
+                    def->type == VIR_DOMAIN_NET_TYPE_DIRECT ||
+                    def->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+                    virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                                   _("Custom tap device path is not supported for: %s"),
+                                   virDomainNetTypeToString(def->type));
+                    goto error;
+                }
+
                if ((tmp = virXMLPropString(cur, "tap")))
                    def->backend.tap = virFileSanitizePath(tmp);
                VIR_FREE(tmp);

Tightening the XML parser means that domains with this incorrect
configuration would disappear from libvirt on upgrade.

Also, the same error message is currently in
qemuBuildInterfaceCommandLine, which would be dead code after this
patch.

qemuDomainDeviceDefValidate is a better place to move the error to;
it's called for hotplugged devices too and it will only be called
when parsing newly-defined domains.

Jan

Attachment: signature.asc
Description: Digital signature

--
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]
  Powered by Linux