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

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Thu Sep 29 10:00:15 UTC 2016



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.

Nikolay




More information about the libvir-list mailing list