[Libvir] Stable UUID needed for default network

The UUID for the default network is not included in the example default config. So every time you restart the libvirt_qemud we get a randomly generated UUID. This isn't really in keeping with the idea of having a permanent UID :-) So I think we need to do two things: - In the 'make install' routine - if-and-only-if the $prefix/etc/libvirt/networks/default.xml file was newly installed, then stuff a random UUID into it, eg UUID=`uuidgen` sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ $prefix/etc/libvirt/networks/default.xml If the system doesn't have uuidgen, we can just ignore this step - In the RPM %post section we need to stuff in a UUID at install time if-and-only-if this is a new install - ie leave it alone during upgrades UUID=`uuidgen` sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ %(sysconfdir)/libvirt/networks/default.xml Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Fri, 2007-03-09 at 03:32 +0000, Daniel P. Berrange wrote:
The UUID for the default network is not included in the example default config. So every time you restart the libvirt_qemud we get a randomly generated UUID. This isn't really in keeping with the idea of having a permanent UID :-) So I think we need to do two things:
- In the 'make install' routine - if-and-only-if the $prefix/etc/libvirt/networks/default.xml
file was newly installed, then stuff a random UUID into it, eg
UUID=`uuidgen` sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ $prefix/etc/libvirt/networks/default.xml
If the system doesn't have uuidgen, we can just ignore this step
- In the RPM %post section we need to stuff in a UUID at install time if-and-only-if this is a new install - ie leave it alone during upgrades
UUID=`uuidgen` sed -e "s,</name>,</name>\n <uuid>$UUID</uuid>," \ %(sysconfdir)/libvirt/networks/default.xml
I'd have no problem with something like this. A little tricky to implement, but it should be fine. Cheers, Mark.
participants (2)
-
Daniel P. Berrange
-
Mark McLoughlin