[PATCH] conf: do not format redirfilter element if it do not have sub-element

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

 



When set a redirfilter element without sub-element, libvirt will
format it like this:

    <redirfilter>
    </redirfilter>

Just drop this element if it do not have any sub-element.

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bfdc94e..1034466 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20596,6 +20596,10 @@ virDomainRedirFilterDefFormat(virBufferPtr buf,
 {
     size_t i;
 
+    /* no need format an empty redirfilter */
+    if (filter->nusbdevs == 0)
+        return 0;
+
     virBufferAddLit(buf, "<redirfilter>\n");
     virBufferAdjustIndent(buf, 2);
     for (i = 0; i < filter->nusbdevs; i++) {
-- 
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]