On 05/03/2013 06:24 AM, Laine Stump wrote:
This should resolve
https://bugzilla.redhat.com/show_bug.cgi?id=958907
Recent new addition of code to read/write active network state to the
NETWORK_STATE_DIR in the network driver broke startup for
qemu:///session. The network driver had several state file paths
hardcoded to /var, which could never possibly work in session mode.
@@ -373,43 +374,53 @@ networkStateInitialize(bool privileged,
}
networkDriverLock(driverState);
+ /* Configuration paths one of
+ * ~/.libvirt/... (old style session/unprivileged)
+ * ~/.config/libvirt/... (new XDG 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 should change it now.
s/should/can't/ ?
+ */
if (privileged) {
- if (virAsprintf(&driverState->logDir,
- "%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
- goto out_of_memory;
-
- if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
+ if (!(driverState->networkConfigDir
+ = strdup(SYSCONFDIR "/libvirt/qemu/networks")) ||
+ !(driverState->networkAutostartDir
+ = strdup(SYSCONFDIR "/libvirt/qemu/networks/autostart")) ||
+ !(driverState->stateDir
+ = strdup(LOCALSTATEDIR "/lib/libvirt/network")) ||
+ !(driverState->pidDir
+ = strdup(LOCALSTATEDIR "/run/libvirt/network")) ||
+ !(driverState->dnsmasqStateDir
+ = strdup(LOCALSTATEDIR "/lib/libvirt/dnsmasq")) ||
+ !(driverState->radvdStateDir
+ = strdup(LOCALSTATEDIR "/lib/libvirt/radvd"))) {
goto out_of_memory;
+ }
} else {
- char *userdir = virGetUserCacheDirectory();
-
- if (!userdir)
+ configdir = virGetUserConfigDirectory();
+ rundir = virGetUserRuntimeDirectory();
+ if (!(configdir && rundir))
goto error;
- if (virAsprintf(&driverState->logDir,
- "%s/qemu/log", userdir) == -1) {
- VIR_FREE(userdir);
+ if ((virAsprintf(&driverState->networkConfigDir,
+ "%s/qemu/networks", configdir) < 0) ||
+ (virAsprintf(&driverState->networkAutostartDir,
+ "%s/qemu/networks/autostart", configdir) < 0) ||
+ (virAsprintf(&driverState->stateDir,
+ "%s/network/lib", rundir) < 0) ||
+ (virAsprintf(&driverState->pidDir,
+ "%s/network/run", rundir) < 0) ||
+ (virAsprintf(&driverState->dnsmasqStateDir,
+ "%s/dnsmasq/lib", rundir) < 0) ||
+ (virAsprintf(&driverState->radvdStateDir,
+ "%s/radvd/lib", rundir) < 0)) {
goto out_of_memory;
So much easier to read!
ACK.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org