[Libguestfs] [PATCH v2 7/9] tests: daemon: Cleanly shut down the daemon on exit.
Pino Toscano
ptoscano at redhat.com
Mon Jun 29 17:17:41 UTC 2015
In data giovedì 25 giugno 2015 15:56:59, Richard W.M. Jones ha scritto:
> This refines the previous commit by shutting down the daemon cleanly
> at the end of the test (assuming the test was successful). It
> repurposes the 'internal_exit' API for this, which was previously used
> by the now defunct --enable-valgrind-daemon functionality.
> ---
> daemon/internal.c | 7 +------
> generator/actions.ml | 3 ++-
> tests/daemon/captive-daemon.pm.in | 12 +++++-------
> 3 files changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/daemon/internal.c b/daemon/internal.c
> index 781366d..5fb3d54 100644
> --- a/daemon/internal.c
> +++ b/daemon/internal.c
> @@ -46,14 +46,9 @@ do_internal_autosync (void)
> }
>
> /* NB: Only called when valgrinding the daemon. */
> -int
> +int __attribute__((noreturn))
> do_internal_exit (void)
> {
> - if (!autosync_umount) {
> - reply_with_error ("guestfsd -r flag used, ignoring");
> - return -1;
> - }
> -
> /* Send a reply before exiting so the protocol doesn't get confused. */
> reply (NULL, NULL);
>
> diff --git a/generator/actions.ml b/generator/actions.ml
> index 24e84b5..a48d8ce 100644
> --- a/generator/actions.ml
> +++ b/generator/actions.ml
> @@ -11951,7 +11951,8 @@ This function is used internally when setting up the appliance." };
> name = "internal_exit"; added = (1, 23, 30);
> style = RErr, [], [];
> proc_nr = Some 414;
> - visibility = VInternal;
> + (* Really VInternal, but we need to use it from the Perl bindings. XXX *)
> + visibility = VDebug;
> cancellable = true;
> shortdesc = "cause the daemon to exit (internal use only)";
> longdesc = "\
An option here could be turning internal_exit from a daemon API into
a debug subcommand. It would be undocumented as it should, not leaving
it exposed more.
Thanks,
--
Pino Toscano
More information about the Libguestfs
mailing list