[PATCH 2/3] conf: Use virMacAddrFormat while generating domain XML files

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

 



Format the address using the helper to avoid code duplication.
---
 src/conf/domain_conf.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 4cae0d3..40dfc99 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13354,6 +13354,7 @@ virDomainNetDefFormat(virBufferPtr buf,
                       unsigned int flags)
 {
     const char *type = virDomainNetTypeToString(def->type);
+    char macstr[VIR_MAC_STRING_BUFLEN];

     if (!type) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -13369,10 +13370,8 @@ virDomainNetDefFormat(virBufferPtr buf,
     virBufferAddLit(buf, ">\n");

     virBufferAdjustIndent(buf, 6);
-    virBufferAsprintf(buf,
-                      "<mac address='%02x:%02x:%02x:%02x:%02x:%02x'/>\n",
-                      def->mac.addr[0], def->mac.addr[1], def->mac.addr[2],
-                      def->mac.addr[3], def->mac.addr[4], def->mac.addr[5]);
+    virBufferAsprintf(buf, "<mac address='%s'/>\n",
+                      virMacAddrFormat(&def->mac, macstr));

     switch (def->type) {
     case VIR_DOMAIN_NET_TYPE_NETWORK:
-- 
1.8.1.5

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