1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

libxl: Move setup of child processing code to driver initialization

Informing libxl how to handle its child proceses should be done once
during driver initialization, not once for each domain-specific
libxl_ctx object.  The related libxl documentation in
$xen-src/tools/libxl/libxl_event.h even mentions that "it is best to
call this at initialisation".

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2015-02-02 16:19:34 -07:00
parent 57db83ae3b
commit 331a02a701
2 changed files with 11 additions and 10 deletions

View File

@ -536,14 +536,6 @@ const struct libxl_event_hooks ev_hooks = {
.disaster = NULL,
};
static const libxl_childproc_hooks libxl_child_hooks = {
#ifdef LIBXL_HAVE_SIGCHLD_OWNER_SELECTIVE_REAP
.chldowner = libxl_sigchld_owner_libxl_always_selective_reap,
#else
.chldowner = libxl_sigchld_owner_libxl,
#endif
};
int
libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
{
@ -580,8 +572,6 @@ libxlDomainObjPrivateInitCtx(virDomainObjPtr vm)
goto cleanup;
}
libxl_childproc_setmode(priv->ctx, &libxl_child_hooks, priv);
ret = 0;
cleanup:

View File

@ -473,6 +473,14 @@ static const libxl_osevent_hooks libxl_osevent_callbacks = {
.timeout_deregister = libxlTimeoutDeregisterEventHook,
};
static const libxl_childproc_hooks libxl_child_hooks = {
#ifdef LIBXL_HAVE_SIGCHLD_OWNER_SELECTIVE_REAP
.chldowner = libxl_sigchld_owner_libxl_always_selective_reap,
#else
.chldowner = libxl_sigchld_owner_libxl,
#endif
};
static int
libxlStateInitialize(bool privileged,
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
@ -521,6 +529,9 @@ libxlStateInitialize(bool privileged,
/* Register the callbacks providing access to libvirt's event loop */
libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx);
/* Setup child process handling. See $xen-src/tools/libxl/libxl_event.h */
libxl_childproc_setmode(cfg->ctx, &libxl_child_hooks, cfg->ctx);
libxl_driver->config = cfg;
if (virFileMakePath(cfg->stateDir) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,