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

Daniel P. Berrange berrange at redhat.com
Tue Sep 8 16:29:36 UTC 2015


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:]
-- 
2.4.3




More information about the libvir-list mailing list