Re: [libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices

2014-02-24 Thread Cole Robinson
On 02/21/2014 07:32 AM, Michal Privoznik wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1031696
 
 When creating a new domain, we let systemd know about it by calling
 CreateMachine() function via dbus. Systemd then creates a scope and
 places domain into it. However, later when the host is shutting
 down, systemd computes the shutdown order to see what processes can
 be shut down in parallel. And since we were not setting
 dependencies at all, the slices (and thus domains) were most likely
 killed before libvirt-guests.service. So user domains that had to
 be saved, shut off, whatever were in fact killed.  This problem can
 be solved by letting systemd know that scopes we're creating must
 not be killed before libvirt-guests.service.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com
 ---
  src/util/virsystemd.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
 index 503fff7..9247c92 100644
 --- a/src/util/virsystemd.c
 +++ b/src/util/virsystemd.c
 @@ -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)
  goto cleanup;
  
  ret = 0;
 

Ahh, so this does indeed work all along and I just messed up the gvariant :/

ACK

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices

2014-02-21 Thread Michal Privoznik
https://bugzilla.redhat.com/show_bug.cgi?id=1031696

When creating a new domain, we let systemd know about it by calling
CreateMachine() function via dbus. Systemd then creates a scope and
places domain into it. However, later when the host is shutting
down, systemd computes the shutdown order to see what processes can
be shut down in parallel. And since we were not setting
dependencies at all, the slices (and thus domains) were most likely
killed before libvirt-guests.service. So user domains that had to
be saved, shut off, whatever were in fact killed.  This problem can
be solved by letting systemd know that scopes we're creating must
not be killed before libvirt-guests.service.

Signed-off-by: Michal Privoznik mpriv...@redhat.com
---
 src/util/virsystemd.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 503fff7..9247c92 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -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)
 goto cleanup;
 
 ret = 0;
-- 
1.9.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/3] virSystemdCreateMachine: Set dependencies for slices

2014-02-21 Thread Daniel P. Berrange
On Fri, Feb 21, 2014 at 01:32:35PM +0100, Michal Privoznik wrote:
 https://bugzilla.redhat.com/show_bug.cgi?id=1031696
 
 When creating a new domain, we let systemd know about it by calling
 CreateMachine() function via dbus. Systemd then creates a scope and
 places domain into it. However, later when the host is shutting
 down, systemd computes the shutdown order to see what processes can
 be shut down in parallel. And since we were not setting
 dependencies at all, the slices (and thus domains) were most likely
 killed before libvirt-guests.service. So user domains that had to
 be saved, shut off, whatever were in fact killed.  This problem can
 be solved by letting systemd know that scopes we're creating must
 not be killed before libvirt-guests.service.
 
 Signed-off-by: Michal Privoznik mpriv...@redhat.com

ACK


Regards,
Daniel
-- 
|: http://berrange.com  -o-http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org  -o- http://virt-manager.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org   -o-   http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list