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

Cedric Bosdonnat cbosdonnat at suse.com
Wed Sep 9 12:02:15 UTC 2015


On Tue, 2015-09-08 at 17:29 +0100, Daniel P. Berrange wrote:
> 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",

ACK

--
Cedric




More information about the libvir-list mailing list