From: Bing Bu Cao <mars(a)linux.vnet.ibm.com>
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(a)linux.vnet.ibm.com>
---
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