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
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
