[libvirt] [PATCH sandbox v5 05/20] Image: virt-sandbox-image default dir constants

Cedric Bosdonnat cbosdonnat at suse.com
Wed Sep 9 11:43:10 UTC 2015


On Tue, 2015-09-08 at 17:29 +0100, Daniel P. Berrange wrote:
> From: Eren Yagdiran <erenyagdiran at gmail.com>
> 
> Define some constants to refer to the default image and
> template storage directories
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  libvirt-sandbox/image/cli.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
> index 3bf7d58..de34321 100755
> --- a/libvirt-sandbox/image/cli.py
> +++ b/libvirt-sandbox/image/cli.py
> @@ -32,6 +32,16 @@ import sys
>  import urllib2
>  import subprocess
>  
> +if os.geteuid() == 0:
> +    default_template_dir = "/var/lib/libvirt/templates"
> +    default_image_dir = "/var/lib/libvirt/images"
> +else:
> +    default_template_dir = os.environ['HOME'] + "/.local/share/libvirt/templates"
> +    default_image_dir = os.environ['HOME'] + "/.local/share/libvirt/images"
> +
> +debug = False
> +verbose = False
> +
>  import importlib
>  def dynamic_source_loader(name):
>      name = name[0].upper() + name[1:]

ACK

--
Cedric





More information about the libvir-list mailing list