[PATCH 1/1] conf: handle empty string in interface target name

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

 



Empty name is not allowed by schema but qemu is able to start with such
a config (and I guess some other hypervisors too). As a result name will
be generated by kernel and have form 'tap<N>'. At the same time if
target element is ommited in config the name will be generated by
libvirt and have form 'vnet<N>'. Let's have only the latter pattern
for autogenerated names by treating empty name as ommited.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---

There is a RFS for the issue - https://www.redhat.com/archives/libvir-list/2019-September/msg00645.html

 src/conf/domain_conf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 76aaa63f57..7ff3972cbb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11592,6 +11592,8 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
             } else if (!ifname &&
                        virXMLNodeNameEqual(cur, "target")) {
                 ifname = virXMLPropString(cur, "dev");
+                if (ifname[0] == '\0')
+                    VIR_FREE(ifname);
                 managed_tap = virXMLPropString(cur, "managed");
             } else if ((!ifname_guest || !ifname_guest_actual) &&
                        virXMLNodeNameEqual(cur, "guest")) {
-- 
2.23.0

--
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