LGTM, thanks!

On Thu, Jul 24, 2014 at 2:32 AM, Yuto KAWAMURA(kawamuray) <
[email protected]> wrote:

> Extend the log file name that will be passed to lxc-start by adding the
> instance uuid to keep and ensure log file isolation between old and new
> instances which have the same instance name.
>
> Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
> ---
>  lib/hypervisor/hv_lxc.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py
> index 3a0cccf..eff07af 100644
> --- a/lib/hypervisor/hv_lxc.py
> +++ b/lib/hypervisor/hv_lxc.py
> @@ -119,11 +119,14 @@ class LXCHypervisor(hv_base.BaseHypervisor):
>      return utils.PathJoin(cls._ROOT_DIR, instance_name + ".conf")
>
>    @classmethod
> -  def _InstanceLogFilePath(cls, instance_name):
> +  def _InstanceLogFilePath(cls, instance):
>      """Return the log file for an instance.
>
> +    @type instance: L{objects.Instance}
> +
>      """
> -    return utils.PathJoin(cls._ROOT_DIR, instance_name + ".log")
> +    filename = "%s.%s.log" % (instance.name, instance.uuid)
> +    return utils.PathJoin(cls._ROOT_DIR, filename)
>
>    @classmethod
>    def _InstanceStashFilePath(cls, instance_name):
> @@ -583,7 +586,7 @@ class LXCHypervisor(hv_base.BaseHypervisor):
>      except errors.GenericError, err:
>        raise HypervisorError("Creating instance directory failed: %s",
> str(err))
>
> -    log_file = self._InstanceLogFilePath(instance.name)
> +    log_file = self._InstanceLogFilePath(instance)
>      if not os.path.exists(log_file):
>        try:
>          utils.WriteFile(log_file, data="",
> mode=constants.SECURE_FILE_MODE)
> --
> 1.8.5.5
>
>

Reply via email to