[virt-tools-list] [virt-manager PATCH] virt-xml: add "-c" as short option of "--connect"

Cole Robinson crobinso at redhat.com
Wed Feb 12 14:43:31 UTC 2014


On 02/12/2014 05:21 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> 
> Add "-c" as short option of "--connect" for virt-xml.
> 
> We could use either
> virt-xml -c lxc:///
> or
> virt-xml --connect lxc:///
> 
> This will be more convenient if we operate
> non-default hypervisor.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  man/virt-xml.pod |  2 +-
>  virt-xml         |  2 +-
>  virtinst/cli.py  | 10 +++++++---
>  3 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/man/virt-xml.pod b/man/virt-xml.pod
> index 44f6353..23d8c82 100644
> --- a/man/virt-xml.pod
> +++ b/man/virt-xml.pod
> @@ -37,7 +37,7 @@ Show the help message and exit
>  
>  Show program's version number and exit
>  
> -=item  --connect=URI
> +=item  -c URI, --connect=URI
>  
>  Connect to a non-default hypervisor. See L<virt-install(1)> for details
>  
> diff --git a/virt-xml b/virt-xml
> index dc0093a..0f83dc5 100755
> --- a/virt-xml
> +++ b/virt-xml
> @@ -299,7 +299,7 @@ def parse_args():
>          _("Edit libvirt XML using command line options."),
>          introspection_epilog=True)
>  
> -    cli.add_connect_option(parser)
> +    cli.add_connect_option(parser, "virt-xml")
>  
>      parser.add_argument("domain", nargs='?',
>          help=_("Domain name, id, or uuid"))
> diff --git a/virtinst/cli.py b/virtinst/cli.py
> index a1875d3..504aff1 100644
> --- a/virtinst/cli.py
> +++ b/virtinst/cli.py
> @@ -552,9 +552,13 @@ def set_os_variant(obj, distro_type, distro_variant):
>  # Common CLI option/group   #
>  #############################
>  
> -def add_connect_option(parser):
> -    parser.add_argument("--connect", metavar="URI",
> -                      help=_("Connect to hypervisor with libvirt URI"))
> +def add_connect_option(parser, invoker=None):
> +    if invoker == "virt-xml":
> +        parser.add_argument("-c", "--connect", metavar="URI",
> +                help=_("Connect to hypervisor with libvirt URI"))
> +    else:
> +        parser.add_argument("--connect", metavar="URI",
> +                help=_("Connect to hypervisor with libvirt URI"))
>  
>  
>  def add_misc_options(grp, prompt=False, replace=False,
> 

ACK

- Cole




More information about the virt-tools-list mailing list