KVM

From Noah.org
Revision as of 03:19, 4 December 2009 by Root (talk | contribs) (→‎virsh)
Jump to navigationJump to search


virsh

The XML config files are stored here: /etc/libvirt/qemu/*.xml.

virsh -c qemu:///system

Common commands. Note that domain is the guest name. Also note that list should really be called list_only_running; you want the --all option to make it actually list all the domains no matter what state they are in.

help
list --all
domstate [domain]
start [domain]
destroy [domain]

localhost

Multiple VNC screen sessions can run on the same machine. By default each session starts at port 5900+session_number. So if you are running just one VNC screem it will usually be mapped to port 5900; the next one will be mapped to 5901; and the next one 5902 and so on.

ssh -N -f -L 5900:192.168.1.13:5900 username@gateway.example.com
vncviewer AutoSelect=0 FullColor=1 localhost

Or like this to view VNC session 0 on the machine 192.168.1.13.

vncviewer AutoSelect=0 FullColor=1 -via username@gateway.example.com 192.168.1.13:0

session 1 on the machine 192.168.1.13:

vncviewer AutoSelect=0 FullColor=1 -via username@gateway.example.com 192.168.1.13:1

Note that when you use via the names and addresses are from the point of view of the gateway machine. So machine 192.168.1.13 on the LAN visible to the gateway machine. You could also just say localhost if you want to connect to a VNC session running on the gateway machine itself.

vncviewer AutoSelect=0 FullColor=1 -via username@gateway.example.com localhost

So why use via at all in that case? Why not just do this?

vncviewer AutoSelect=0 FullColor=1 username@gateway.example.com

Remember that we may still be going through a firewall. Firewalls rarely allow the VNC ports 5900 through. The via option says to go through SSH (port 22), which most firewalls will allow -- plus this adds SSH encryption to the session.

remote KVM server

sudo virt-install --connect qemu:///system --name ubuntu910 --force --ram 512 --file ubuntu910.qcow2 --file-size 12 --cdrom ubuntu-9.10-desktop-i386.iso --vnc --noautoconsole --accelerate --os-type linux --os-variant generic26

Error: Rect too big

This is a bug in the vncviewer. Add these options to the command-line:

AutoSelect=0 FullColor=1
vncviewer AutoSelect=0 FullColor=1 -via username@gateway.example.com localhost:0