[libvirt] [PATCH sandbox v5 11/20] Image: Add check_connect function

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


From: Eren Yagdiran <erenyagdiran at gmail.com>

Check if user-specified connect argument is valid

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 libvirt-sandbox/image/cli.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index 6f9a5e7..2672a20 100755
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -105,6 +105,12 @@ def requires_name(parser):
     parser.add_argument("-n","--name",
                         help=_("Name of the running sandbox"))
 
+def check_connect(connectstr):
+    supportedDrivers = ['lxc:///','qemu:///session','qemu:///system']
+    if not connectstr in supportedDrivers:
+        raise ValueError("URI '%s' is not supported by virt-sandbox-image" % connectstr)
+    return True
+
 def requires_source(parser):
     parser.add_argument("-s","--source",
                         default="docker",
-- 
2.4.3




More information about the libvir-list mailing list