[PATCH] Make virsh command 'domxml-to-native' copy the MAC addr parsed from XML

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

 



From: Bing Bu Cao <mars@xxxxxxxxxxxxxxxxxx>

virsh command 'domxml-to-native' did not copy the
MAC address which parsed from a domain xml, in the commandline
the MAC addr of network device always was 00:00:00:00:00:00.
This patch fix it.

Signed-off-by: Bing Bu Cao <mars@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_driver.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8a1eefd..4693dad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5821,6 +5821,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
         virDomainNetDefPtr net = def->nets[i];
         int bootIndex = net->info.bootIndex;
         char *model = net->model;
+        virMacAddr mac = net->mac;
 
         if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
             int actualType = virDomainNetGetActualType(net);
@@ -5843,6 +5844,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
                 net->script = NULL;
                 net->data.ethernet.dev = brnamecopy;
                 net->data.ethernet.ipaddr = NULL;
+                net->mac = mac;
             } else {
                 /* actualType is either NETWORK or DIRECT. In either
                  * case, the best we can do is NULL everything out.
@@ -5854,6 +5856,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
                 net->script = NULL;
                 net->data.ethernet.dev = NULL;
                 net->data.ethernet.ipaddr = NULL;
+                net->mac = mac;
             }
         } else if (net->type == VIR_DOMAIN_NET_TYPE_DIRECT) {
             VIR_FREE(net->data.direct.linkdev);
@@ -5864,6 +5867,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
             net->script = NULL;
             net->data.ethernet.dev = NULL;
             net->data.ethernet.ipaddr = NULL;
+            net->mac = mac;
         } else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
             char *script = net->script;
             char *brname = net->data.bridge.brname;
@@ -5875,6 +5879,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
             net->script = script;
             net->data.ethernet.dev = brname;
             net->data.ethernet.ipaddr = ipaddr;
+            net->mac = mac;
         }
 
         VIR_FREE(net->virtPortProfile);
-- 
1.7.7.6

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