For everyone's viewing (and critiquing, I guess) pleasure, I present
my version of a kvmctl script.
>From the usage output (looks best viewed with a monospace font):
kvmctl is a management and control script for KVM-based virtual machines.
Usage: kvmctl start host - start the named VM
kvmctl startvnc host - start the named VM, and then connect
to console via VNC
kvmctl stop host - stop the named VM (only use if the
guest is hung)
kvmctl restart host - stop and then start the named VM
(only use if the guest is hung)
kvmctl vnc host - connect via VNC to the console of the named VM
kvmctl whichvnc host - show which VNC display port is
assigned to the named VM
kvmctl killvnc host - kills any running vncviewer
processes attached to the named VM
kvmctl edit host - open config file for host using
$EDITOR, or create a new config file based on a template
kvmctl status - show the names of all running VMs
kvmctl status kvm - show full details for all running
kvm processes
kvmctl status host - show full details for the named kvm process
kvmctl help - show this usage blurb
** Using stop is the same as pulling the power cord on a physical
system. Use with caution.
A couple of assumptions are made:
- the host is configured with a bridge device
- /etc/kvm/kvm-ifup is configured to use that bridge device by name
- all VMs will use bridged networking
- you want to use VNC for the console for all VMs (and have a
vncviewer installed on the host)
The script can be run as a normal user, as it will use sudo where
needed. However, this causes all the VMs to be run as root (this is
developed on Debian where they've added that annoying "feature" of not
being able to create/use tun/tap devices as non-root users). If
anyone knows how to unbreak Debian to allow non-root users to create
tun/tap devices, I'm all ears.
There's a simple init.d/ script included in the tarball to autostart
any VMs who have their config files linked to /etc/kvm/auto/ (modelled
after Xen). The auto-stop feature just kills the kvm processes, so
use with caution, or just link to the start function.
There's a simple README in the tarball, along with a sample interfaces
file for creating a kvmbr0 bridge (for Debian-based systems).
The only thing I haven't been able to figure out, is how to send a
"shutdown" command from the host OS to the guest OS, such that the
guest OS will do a proper shutdown sequence. You have to switch to
the VM console and manually tell it to shutdown. :(
It's released under the BSD License, so do with it as you wish. :)
Patches and suggestions are always welcome, of course.
http://www.sd73.bc.ca/downloads/kvmctl-2.0.0.tbz
--
Freddie Cash
[EMAIL PROTECTED]
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html