Signed-off-by: Shi Lei <shi_...@massclouds.com>
---
 src/conf/network_conf.c | 18 ++----------------
 src/conf/network_conf.h |  2 +-
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 96664ab..518f6da 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2211,22 +2211,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], def, 
NULL) < 0)
+                return -1;
         }
     }
 
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 3636698..041119e 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -137,7 +137,7 @@ struct _virNetworkDNSTxtDef {   /* genparse:concisehook, 
genformat */
 
 typedef struct _virNetworkDNSSrvDef virNetworkDNSSrvDef;
 typedef virNetworkDNSSrvDef *virNetworkDNSSrvDefPtr;
-struct _virNetworkDNSSrvDef {   /* genparse:withhook */
+struct _virNetworkDNSSrvDef {   /* genparse:withhook, genformat */
     char *service;              /* xmlattr */
     char *protocol;             /* xmlattr */
     char *domain;               /* xmlattr */
-- 
2.25.1


Reply via email to