Re: [PATCH] network: fix network driver startup for qemu:///session

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

 



On 05/02/2013 12:22 PM, Eric Blake wrote:
> On 05/02/2013 12:06 PM, 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.
>>

>>  
>> -#define NETWORK_PID_DIR LOCALSTATEDIR "/run/libvirt/network"
> 
> So previously, this constant represented the network runtime directory
> relative to the configured state dir (default /var in a distro
> installation)...
> 
>> -#define NETWORK_STATE_DIR LOCALSTATEDIR "/lib/libvirt/network"
>> +#define NETWORK_PID_DIR "/run/libvirt/network"
> 
> Now it is just the relative suffix of an (as-yet) unspecified prefix...

Oh, one more thing.  I would write this as "run/libvirt/network" to make
it obvious it will be relative to some other directory...

>>      if (privileged) {
>> -        if (virAsprintf(&driverState->logDir,
>> -                        "%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
>> -            goto out_of_memory;
>> -
>> -        if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
>> +        if (((base = strdup(SYSCONFDIR "/libvirt")) == NULL) ||
>> +            ((driverState->logDir
>> +              = strdup(LOCALSTATEDIR "/log/libvirt/qemu")) == NULL) ||
>> +            ((driverState->stateDir
>> +              = strdup(LOCALSTATEDIR NETWORK_STATE_DIR)) == NULL) ||
> 
> ...privileged initialization uses LOCALSTATEDIR as its location where
> the now-relative NETWORK_STATE_DIR is placed,...[1]

and here initialize it as strdup(LOCALSTATEDIR "/" NETWORK_STATE_DIR),
to make it obvious that we are pasting a directory and a relative path.
(My eyes kind of gloss over ' ' vs. '_', but a "/" in the middle is
easier to spot).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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