[libvirt] [sandbox PATCH 09/11] Image: Add check_driver function

Eren Yagdiran erenyagdiran at gmail.com
Thu Jul 23 15:57:35 UTC 2015


Check if user-specified driver argument is valid
---
 virt-sandbox-image/virt-sandbox-image.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/virt-sandbox-image/virt-sandbox-image.py b/virt-sandbox-image/virt-sandbox-image.py
index 81b825c..fd02567 100644
--- a/virt-sandbox-image/virt-sandbox-image.py
+++ b/virt-sandbox-image/virt-sandbox-image.py
@@ -111,6 +111,12 @@ def create(args):
     except Exception,e:
         print "Create Error %s" % str(e)
 
+def check_driver(driver):
+        supportedDrivers = ['lxc:///','qemu:///session','qemu:///system']
+        if not driver in supportedDrivers:
+            raise ValueError("%s is not supported by Virt-sandbox" %driver)
+        return True
+
 def requires_name(parser):
     parser.add_argument("name",
                         help=_("name of the template"))
-- 
2.1.0




More information about the libvir-list mailing list