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

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Wed Feb 12 10:28:35 UTC 2014



> -----Original Message-----
> From: Martin Kletzander [mailto:mkletzan at redhat.com]
> Sent: Tuesday, February 11, 2014 11:52 PM
> To: Chen Hanxiao
> Cc: Cole Robinson; Chen Hanxiao; virt-tools-list at redhat.com
> Subject: Re: [virt-tools-list] [virt-manager PATCH] virt-install: add "-c"
as short
> option of "--connect"
> 
> On Tue, Feb 11, 2014 at 10:22:13PM +0800, Chen Hanxiao wrote:
> >
> >
> > On 02/11/2014 09:04 PM, Cole Robinson wrote:
> > > On 02/11/2014 01:58 AM, Chen Hanxiao wrote:
> > >> From: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > >>
> > >> Add "-c" as short option of "--connect".
> > >> Replace original "-c" as "-cd" for "--cdrom"
> > >>
> > >> This will be much convenient if we operate
> > >> non-default hypervisor.
> > >>
> > >> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> > >> ---
> > >>   man/virt-install.pod | 2 +-
> > >>   man/virt-xml.pod     | 2 +-
> > >>   virt-install         | 7 ++-----
> > >>   virtinst/cli.py      | 2 +-
> > >>   4 files changed, 5 insertions(+), 8 deletions(-)
> > >>
> > >
> > > This will break any pre-existing users of virt-install -c <cdrom>, so
it's not
> > > acceptable. We could make the -c shortcut available for the other
tools, but
> > > then things would be inconsistent. So I'd rather just leave it the way
it is.
> > >
> >
> > How about give --connect a shortcut?
> > It's not so convenient if using virt-xml editing LXC domain.
> >
> 
> I use the following approach, maybe it'll help you:
> 
> in '~/.config/libvirt/libvirt.conf' I have the address I use the most
> from my user set as default:
> 
> uri_default = "qemu:///system"
> 
> and some aliases for other connections:
> 
> uri_aliases = [
>   'mg1=qemu+ssh://mg-host1/system',
>   'mg2=qemu+ssh://mg-host1/system',
> ...
> 
> Well, you get the idea.  And for example instead of using 'virsh -c
> lxc:///' all the time for lxc containers, I have an alias in
> '~/.bashrc' or '~/.zshrc':
> 
> vlxc='virsh -c lxc:///'
> 
> This makes your life way easier and that sort of thing can be used for
> virt-xml too ;-)
> 
> Hope this helps,
> Martin
> 
> P.S.: In order to satisfy one friend of mine I have to mention that
> creating a function instead of an alias should be way faster to use in
> bash (the following example is not tested and typed by hand only):
> 
> vlxc() { virsh -c lxc:/// "$@"; }

Thanks very much!
I used to use alias, 
from now on I'll try to use function when adding new one.

PS: your example works fine on my machine.





More information about the virt-tools-list mailing list