Re: [PATCH 2/2] Implementation deficiency in virInitctlSetRunLevel v4

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

 



On 12/20/2013 01:41 PM, Eric Blake wrote:
> On 12/20/2013 09:24 AM, Reco wrote:
>> Use helper virProcessRunInMountNamespace in lxcDomainShutdownFlags and
>> lxcDomainReboot.
>>

>>  static int
>> +virDomainShutdownCallback(pid_t pid ATTRIBUTE_UNUSED,
>> +                          void *opaque ATTRIBUTE_UNUSED)
>> +{
>> +    int rc;
>> +    rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, NULL);
>> +    return rc;
> 
> Hmm.  The callback's return value being used directly as the _exit()
> value in patch 1 is not a good idea; either this function must convert
> -1 to EXIT_FAILURE, or we should fix the framework to turn our normal -1
> conventions into the correct exit code (I'm opting for the latter).

Eww, it's even worse than that.  virInitctlSetRunLevel() is documented
as returning -1 on failure, 0 if initctl doesn't exist, and 1 on
success; but virProcessRunInMountNamespace() was declaring failure on
all but a return status of 0 (which only happens when initctl doesn't
exist), which means failure and success both get lumped into the
callback mechanism declaring failure.

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