On 11/08/2012 01:06 PM, Eric Blake wrote:
I noticed that after a fresh install, the file
/etc/libvirt/qemu/networks/default.xml lacked the usual header
inserted by modern 'virsh net-edit'; and traced it to the fact
that libvirt.spec installs this file by copying a template
rather than using libvirt API. We might as well make our template
match what libvirt itself would generate in that location.
* src/network/default.xml: Add header and newer XML details.
---
src/network/default.xml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/network/default.xml b/src/network/default.xml
index 9cfc01e..e124621 100644
--- a/src/network/default.xml
+++ b/src/network/default.xml
@@ -1,7 +1,14 @@
+<!--
+WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
+OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
+ virsh net-edit default
+or other application using the libvirt API.
+-->
+
<network>
<name>default</name>
- <bridge name="virbr0" />
- <forward/>
+ <forward mode='nat'/>
mode='nat' is the defined default, so that isn't strictly necessary...
+ <bridge name="virbr0" stp='on'
delay='0'/>
The above line shouldn't be in the file. This will create conflicts if
someone has a libvirt installation that already has networks defined
(and so is already using virbr0 for a different network), and you go
through the back door to create a network definition that re-uses it.
(which makes me wonder if the auto-created bridge name used by a default
network created in this manner will end up being written to the config
file in /etc...)
<ip address="192.168.122.1"
netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" />
Actually there is another open bug about the way we're creating this
network:
https://bugzilla.redhat.com/show_bug.cgi?id=867546
The problem is that when libvirtd is already running and you install the
libvirt-daemon-config-network-config package (which I believe is what
happens during the initial install of everything), the default network
doesn't show up in libvirt's list until the next time you restart
libvirtd (because we've just copied it into place on the disk, so
libvirtd hasn't been told about it).