[RFC 25/29] conf: Apply virNetworkDNSForwarderFormatBuf(generated) in virNetworkDNSDefFormat

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

 



Signed-off-by: Shi Lei <shi_lei@xxxxxxxxxxxxxx>
---
 docs/schemas/network.rng |  4 ++++
 src/conf/network_conf.c  | 17 ++---------------
 2 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 7084248..cd5be22 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -288,6 +288,10 @@
                     "post": true,
                     "args.noctxt": true,
                     "args.instname": true
+                  },
+                  "formatfunc": {
+                    "output": "src/conf/network_conf",
+                    "order": ["domain", "addr"]
                   }
                 } -->
                 <element name="forwarder">
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 905c01f..19444d6 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1964,22 +1964,9 @@ virNetworkDNSDefFormat(virBufferPtr buf,
     virBufferAdjustIndent(buf, 2);
 
     for (i = 0; i < def->nforwarders; i++) {
-
-        virBufferAddLit(buf, "<forwarder");
-        if (def->forwarders[i].domain) {
-            virBufferEscapeString(buf, " domain='%s'",
-                                  def->forwarders[i].domain);
-        }
-        if (VIR_SOCKET_ADDR_VALID(&def->forwarders[i].addr)) {
-        char *addr = virSocketAddrFormat(&def->forwarders[i].addr);
-
-        if (!addr)
+        if (virNetworkDNSForwarderFormatBuf(buf, "forwarder",
+                                            &def->forwarders[i]) < 0)
             return -1;
-
-        virBufferAsprintf(buf, " addr='%s'", addr);
-        VIR_FREE(addr);
-        }
-        virBufferAddLit(buf, "/>\n");
     }
 
     for (i = 0; i < def->ntxts; i++) {
-- 
2.17.1







[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