[PATCH 2/5] network: change location of network state xml files

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

 



For some reason these have been stored in /var/lib, although other
drivers store their state files in /var/run.

It's much nicer to store them in /var/run because they are
automatically cleared out when the system reboots. This can be a
useful way of learning whether or not a particular network is active.

Note that this change by itself will cause problems in the case of an
upgrade from an older libvirt that uses /var/lib, and also in the case
of a downgrade from a newer libvirt using /var/run to an older version
using /var/lib. This compatibility problem will be addressed in the
next patch.
---
 src/network/bridge_driver.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index fdddc9a..a027b47 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -446,10 +446,11 @@ networkStateInitialize(bool privileged,
      * ~/.config/libvirt/... (session/unprivileged)
      * /etc/libvirt/... && /var/(run|lib)/libvirt/... (system/privileged).
      *
-     * NB: The qemu driver puts its domain state in /var/run, and I
-     * think the network driver should have used /var/run too (instead
-     * of /var/lib), but it's been this way for a long time, and we
-     * probably shouldn't change it now.
+     * NB: The network driver previously stored its status xml in
+     * /var/lib/libvirt/network instead of
+     * /var/run/libvirt/network. An upgrade downgrade between libvirt
+     * versions using different state directories may or may not cause
+     * problems.
      */
     if (privileged) {
         if (VIR_STRDUP(driverState->networkConfigDir,
@@ -457,7 +458,7 @@ networkStateInitialize(bool privileged,
             VIR_STRDUP(driverState->networkAutostartDir,
                        SYSCONFDIR "/libvirt/qemu/networks/autostart") < 0 ||
             VIR_STRDUP(driverState->stateDir,
-                       LOCALSTATEDIR "/lib/libvirt/network") < 0 ||
+                       LOCALSTATEDIR "/run/libvirt/network") < 0 ||
             VIR_STRDUP(driverState->pidDir,
                        LOCALSTATEDIR "/run/libvirt/network") < 0 ||
             VIR_STRDUP(driverState->dnsmasqStateDir,
-- 
1.9.0

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