Blame SOURCES/libvirt-Generate-a-MAC-when-loading-a-config-instead-of-package-update.patch

9119d9
From 4cf1de1c458fd21cc55546f4281ed03fc1532c7b Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <4cf1de1c458fd21cc55546f4281ed03fc1532c7b@dist-git>
9119d9
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
9119d9
Date: Tue, 2 Dec 2014 16:12:35 +0100
9119d9
Subject: [PATCH] Generate a MAC when loading a config instead of package
9119d9
 update
9119d9
9119d9
Partially reverts commit 5754dbd.
9119d9
9119d9
The code in the specfile adds a MAC address to every <bridge>,
9119d9
even for <forward mode='bridge'> for which we don't support
9119d9
changing MAC addresses.
9119d9
9119d9
Remove it completely. For new networks, we have been adding
9119d9
MAC addresses on definition/creation since the commit mentioned above.
9119d9
For existing networks (pre-0.9.0), the MAC is added by this commit.
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1156367
9119d9
(cherry picked from commit a47ae7c004e92f959b45808ca82326e8559c2f61)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 libvirt.spec.in         | 42 ------------------------------------------
9119d9
 src/conf/network_conf.c |  4 ++++
9119d9
 2 files changed, 4 insertions(+), 42 deletions(-)
9119d9
9119d9
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
9119d9
index d348a20..7b17d59 100644
9119d9
--- a/src/conf/network_conf.c
9119d9
+++ b/src/conf/network_conf.c
9119d9
@@ -3147,6 +3147,10 @@ virNetworkObjPtr virNetworkLoadConfig(virNetworkObjListPtr nets,
9119d9
         def->forward.type == VIR_NETWORK_FORWARD_NAT ||
9119d9
         def->forward.type == VIR_NETWORK_FORWARD_ROUTE) {
9119d9
 
9119d9
+        if (!def->mac_specified) {
9119d9
+            virNetworkSetBridgeMacAddr(def);
9119d9
+            virNetworkSaveConfig(configDir, def);
9119d9
+        }
9119d9
         /* Generate a bridge if none is specified, but don't check for collisions
9119d9
          * if a bridge is hardcoded, so the network is at least defined.
9119d9
          */
9119d9
-- 
9119d9
2.2.0
9119d9