[libvirt] [PATCH v2] lxc: create the required directories upon driver start

Cedric Bosdonnat cbosdonnat at suse.com
Thu Apr 9 09:04:23 UTC 2015


Hi Lubomir,

On Wed, 2015-04-08 at 19:16 +0200, Lubomir Rintel wrote:
> /var/run may reside on a tmpfs and we fail to create the PID file if
> /var/run/lxc does not exist.

I would enhance the commit message with something like this:

Since commit 0a8addc1, the lxc driver's state directory isn't
automatically created before starting a domain. Now, the lxc driver
makes sure the state directory exists when it initializes.

> [cbosdonnat at suse.com: use cfg->stateDir instead of LXC_STATE_DIR]

This line shouldn't be in the commit message: see my other comment.

> Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>

You don't have to sign-off your patches.

> ---

The changes with the previous version should go here: this way they
won't appear in the git commit message.

I'll push your patch with those changes.

Thanks for your help.
--
Cedric

>  src/lxc/lxc_driver.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 245000d..8dfa686 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -1648,6 +1648,13 @@ static int lxcStateInitialize(bool privileged,
>      if (!(caps = virLXCDriverGetCapabilities(lxc_driver, false)))
>          goto cleanup;
>  
> +    if (virFileMakePath(cfg->stateDir) < 0) {
> +        virReportSystemError(errno,
> +                             _("Failed to mkdir %s"),
> +                             cfg->stateDir);
> +        goto cleanup;
> +    }
> +
>      /* Get all the running persistent or transient configs first */
>      if (virDomainObjListLoadAllConfigs(lxc_driver->domains,
>                                         cfg->stateDir,





More information about the libvir-list mailing list