[libvirt] [PATCH 2/3] Ensure logging is initialized early in libvirt_lxc

Stefan Berger stefanb at linux.vnet.ibm.com
Tue May 1 14:36:36 UTC 2012


On 05/01/2012 06:10 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> The virLogSetFromEnv call was done too late in startup to
> catch many log messages (eg from security driver initialization).
> To assist debugging also explicitly log the security details
> at startup
> ---
>   src/lxc/lxc_controller.c |   12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
> index 1e3ec30..26b3115 100644
> --- a/src/lxc/lxc_controller.c
> +++ b/src/lxc/lxc_controller.c
> @@ -1668,6 +1668,9 @@ int main(int argc, char *argv[])
>           exit(EXIT_FAILURE);
>       }
>
> +    /* Initialize logging */
> +    virLogSetFromEnv();
> +
>       while (1) {
>           int c;
>
> @@ -1784,6 +1787,12 @@ int main(int argc, char *argv[])
>                                        0)) == NULL)
>           goto cleanup;
>
> +    VIR_DEBUG("Security model %s type %s label %s imagelabel %s",
> +              NULLSTR(def->seclabel.model),
> +              virDomainSeclabelTypeToString(def->seclabel.type),
> +              NULLSTR(def->seclabel.label),
> +              NULLSTR(def->seclabel.imagelabel));
> +
>       if (def->nnets != nveths) {
>           fprintf(stderr, "%s: expecting %d veths, but got %d\n",
>                   argv[0], def->nnets, nveths);
> @@ -1828,9 +1837,6 @@ int main(int argc, char *argv[])
>           }
>       }
>
> -    /* Initialize logging */
> -    virLogSetFromEnv();
> -
>       /* Accept initial client which is the libvirtd daemon */
>       if ((client = accept(monitor, NULL, 0))<  0) {
>           virReportSystemError(errno, "%s",

ACK




More information about the libvir-list mailing list