[CentOS] Secret incantations for virt-viewer?

Fri Jan 2 13:22:29 UTC 2015
Bill Gee <bgee at campercaver.net>

Hi Mike - Comments inline below.

On Thursday, January 01, 2015 19:54:53 SilverTip257 wrote:
> On Tue, Dec 30, 2014 at 4:08 PM, Bill Gee <bgee at campercaver.net> wrote:
> > Thanks!  I changed the qemu.conf file to listen on  That works -
> > I can
> > connect to the virtual machines using a VNC client.
> Listening on listens on all network interfaces.
> Mark's comment is not a major concern unless your KVM host is directly
> connected to the Internet (no firewall).
> * You should consider adding firewall rules on your KVM host none the less.

Not a problem, I live behind a NAT box.  Rules for firewalld are on my list of 
things to learn.  For now the host machine has firewalld running with a default 
set of rules.

Even if it were directly connected to the Internet, it would still have to 
listen on some port.  There has to be SOME way for connections to be made.

> > The problem with VNC is that the port number assigned to a particular VM
> > depends on the order in which it is started.  There is no command-line
> > option
> > for VNC that will attach to a VM by name ...  only by display number or
> > port
> > number.
> You can specify the VNC port when creating a host.
> But as far as connecting via VNC to a host VM by name without also having
> to add a port # suffix, that is more difficult. Easiest way for you to do
> so is to create shell aliases for each one.
> For my own deployments, I have a wiki page which documents what VNC ports
> are used.

I keep a page in KJots listing the ports used for my VirtualBox guests.  It 
would be easy to do the same thing here.  However, it seems a kludge.  For 
large installations it is not tenable at all.

> There's also virsh commands to extract info.
> virsh dominfo <VM_name>
> virsh vncdisplay <VM_name>

Yep, I know about these.  But I don't have virsh on the local computer.

> > With virt-viewer I can name the domain on the command line.  It is
> > unambiguous
> > - There is no doubt about which VM it will connect to.
> > 
> > I found where the VNC port can be fixed in the XML file that defines each
> > VM.
> > However, it is a manual process.  I have not found a way to set it using
> > virsh.
> Yes, a manual process.
> One would think there's a way to change it via virsh, but that could/would
> be a problem for a running VM.
> virt-install has options for specifying VNC ports.

It might be a problem for a running machine - but it is a one-time change and 
so no problem to pick a time to shutdown/restart the guest.

> > I found where virsh can report the VNC port number used by a domain.
> > However,
> > the computers from where I am running VNC client do not have virsh
> > installed.
> They do not need virsh.
> SSH to the KVM host and run the virsh commands from there.

The ultimate goal is to create shortcuts in the Start menu which will launch 
directly to the guest.  Your method requires the user to first ssh into the 
host and then modify the Start menu shortcut.  This is not usable even in my 
small home network, never mind the problems with any kind of business 

There *IS* a version of virt-viewer to run on Windows.  I am not using it (my 
workstations run Fedora), but in a business it would be a requirement.

> > Somewhere in all this experimenting I have managed to break virt-viewer
> > again.
> > It was working, but no more.  Argh!  Good thing this is all happening on
> > test
> > computers!
> > 
> > Bill Gee