[libvirt] [RFC] daemon: remove hardcode dep on libvirt-guests

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Sep 29 10:13:38 UTC 2016



On 29.09.2016 13:06, Daniel P. Berrange wrote:
> On Thu, Sep 29, 2016 at 01:00:15PM +0300, Nikolay Shirokovskiy wrote:
>>
>>
>> On 29.09.2016 12:21, Jiri Denemark wrote:
>>> On Thu, Sep 29, 2016 at 11:33:04 +0300, Nikolay Shirokovskiy wrote:
>>>> Hi, all.
>>>>
>>>> In virtuozzo mgmt we do not use libvirt-guests service. First because
>>>> we need do extra steps on domain start and second we want to decice
>>>> whether to suspend or to shutdown a domain on per domain basis. Starting
>>>> is not the problem but system shutdown is. As domain in systemd based
>>>> systems is just another unit we need to set ordering dependency so
>>>> that domain will not be killed before mgmt service as ba79e387 do for
>>>> libvirt-guest service. So let's remove this hardcode. I see 2 options.
>>>
>>> I don't see hard dependency anywhere in libvirtd.service, it just says
>>>
>>> Before=libvirt-guests.service
>>
>> Nope, I meant this code from mentioned commit:
>>
>> @@ -243,8 +243,10 @@ int virSystemdCreateMachine(const char *name,
>>                            iscontainer ? "container" : "vm",
>>                            (unsigned int)pidleader,
>>                            rootdir ? rootdir : "",
>> -                          1, "Slice", "s",
>> -                          slicename) < 0)
>> +                          3,
>> +                          "Slice", "s", slicename,
>> +                          "After", "as", 1, "libvirtd.service",
>> +                          "Before", "as", 1, "libvirt-guests.service") < 0)
>>
>> This makes domain a special kind of unit (scope) and sets its ordering dependency.
>> You can't do this with libvirtd.service itself because its different unit.
> 
> IIUC, the problem is that you want to replace 'libvirt-guests.service'
> with a different impl ?
> 
> The way systemd tends to deal with things that must be a configurable
> choice in this way is to define a target, and sysadmins can then make
> arbitrary services dependancies of that target.
> 
> eg, we'd set 'Before: virt-guest-shutdown.target', and then make
> libvirt-guests.service be a part of that target by default. You can
> then have ability to turn off libvirt-guest.service and put your
> own custom thing inside virt-guest-shutdown.taget
> 

Thanx!




More information about the libvir-list mailing list