[RFC 27/29] conf: Apply virNetworkDNSSrvDefFormatBuf(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 |  1 +
 src/conf/network_conf.c  | 20 ++------------------
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng
index 1d7b854..b97510f 100644
--- a/docs/schemas/network.rng
+++ b/docs/schemas/network.rng
@@ -339,6 +339,7 @@
                       {"name": "partialOkay", "type": "Bool"}
                     ]
                   },
+                  "formatfunc": {"output": "src/conf/network_conf"},
                   "members": [
                     {"id": "service", "opt": true},
                     {"id": "protocol", "opt": true}
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index b40ab4d..1e8bfbc 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -1975,24 +1975,8 @@ virNetworkDNSDefFormat(virBufferPtr buf,
     }
 
     for (i = 0; i < def->nsrvs; i++) {
-        if (def->srvs[i].service && def->srvs[i].protocol) {
-            virBufferEscapeString(buf, "<srv service='%s' ",
-                                  def->srvs[i].service);
-            virBufferEscapeString(buf, "protocol='%s'", def->srvs[i].protocol);
-
-            if (def->srvs[i].domain)
-                virBufferEscapeString(buf, " domain='%s'", def->srvs[i].domain);
-            if (def->srvs[i].target)
-                virBufferEscapeString(buf, " target='%s'", def->srvs[i].target);
-            if (def->srvs[i].port)
-                virBufferAsprintf(buf, " port='%d'", def->srvs[i].port);
-            if (def->srvs[i].priority)
-                virBufferAsprintf(buf, " priority='%d'", def->srvs[i].priority);
-            if (def->srvs[i].weight)
-                virBufferAsprintf(buf, " weight='%d'", def->srvs[i].weight);
-
-            virBufferAddLit(buf, "/>\n");
-        }
+        if (virNetworkDNSSrvDefFormatBuf(buf, "srv", &def->srvs[i]) < 0)
+            return -1;
     }
 
     if (def->nhosts) {
-- 
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