[libvirt] [PATCH] src: Document autostart for session demon

Michal Privoznik posted 1 patch 5 years, 3 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/5edc3437a6f08e49fa3b2048b8a8531448fb278f.1545054659.git.mprivozn@redhat.com
src/libvirt-domain.c | 5 +++++
1 file changed, 5 insertions(+)
[libvirt] [PATCH] src: Document autostart for session demon
Posted by Michal Privoznik 5 years, 3 months ago
The autostart under session daemon might not behave as you'd
expect it to behave. This patch is inspired by latest
libvirt-users discussion:

https://www.redhat.com/archives/libvirt-users/2018-December/msg00047.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/libvirt-domain.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index d49d7f869f..75c9014c0e 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -6693,6 +6693,11 @@ virDomainCreateWithFiles(virDomainPtr domain, unsigned int nfiles,
  * configured to be automatically started when the host
  * machine boots.
  *
+ * Please note that this might result in unexpected behaviour if
+ * used for some session URIs. Since the session daemon is started
+ * with --timeout it comes and goes and as it does so it
+ * autostarts domains which might have been shut off recently.
+ *
  * Returns -1 in case of error, 0 in case of success
  */
 int
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] src: Document autostart for session demon
Posted by Daniel P. Berrangé 5 years, 3 months ago
On Mon, Dec 17, 2018 at 02:50:59PM +0100, Michal Privoznik wrote:
> The autostart under session daemon might not behave as you'd
> expect it to behave. This patch is inspired by latest
> libvirt-users discussion:
> 
> https://www.redhat.com/archives/libvirt-users/2018-December/msg00047.html
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/libvirt-domain.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index d49d7f869f..75c9014c0e 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -6693,6 +6693,11 @@ virDomainCreateWithFiles(virDomainPtr domain, unsigned int nfiles,
>   * configured to be automatically started when the host
>   * machine boots.
>   *
> + * Please note that this might result in unexpected behaviour if
> + * used for some session URIs. Since the session daemon is started
> + * with --timeout it comes and goes and as it does so it
> + * autostarts domains which might have been shut off recently.
> + *
>   * Returns -1 in case of error, 0 in case of success
>   */
>  int

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


I guess this points to a design flaw in our session daemon, albeit one
that is rather tricky to fix. We really only want to autostart once,
when the session starts, but defining the scope of a "session" for
users is tricky. It is a little better defined in the systemd world
though, so I wonder if there's a way to use that to selectively
trigger autostart.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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