[libvirt] [sandbox PATCH v2 09/19] Image: Add check_connect function

Eren Yagdiran erenyagdiran at gmail.com
Tue Aug 4 20:11:15 UTC 2015


Check if user-specified connect 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 feee849..4c19fa8 100755
--- a/virt-sandbox-image/virt-sandbox-image.py
+++ b/virt-sandbox-image/virt-sandbox-image.py
@@ -95,6 +95,12 @@ def create(args):
     except Exception,e:
         print "Create Error %s" % str(e)
 
+def check_connect(connectstr):
+        supportedDrivers = ['lxc:///','qemu:///session','qemu:///system']
+        if not connectstr in supportedDrivers:
+            raise ValueError("%s is not supported by Virt-sandbox" %connectstr)
+        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