From: Eren Yagdiran <erenyagdiran(a)gmail.com>
Check if user-specified connect argument is valid
Signed-off-by: Daniel P. Berrange <berrange(a)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