Using rvirsh (command line)

Managing guests on a remote KVM host can be awkward using the standard virsh tool as you have to remember the correct --connect incantation. A local wrapper rvirsh to virsh has been written to simply things.

rvirsh <hostname> [virsh command]

Specify . for to run the virsh command on the local host. If you omit the virsh command, a virsh shell will be created on the specified KVM server.

The following assume that your guest is on the KVM host circle :-

Starting a guest (and connect to serial console)
rvirsh circle start <guest> --console

Connect to guest's serial console
rvirsh circle console <guest>

Clean shutdown
rvirsh circle shutdown <guest>

Kill a guest
rvirsh circle destroy <guest>

Modify boot order to network,hd
kvmtool setbootorder --name <guest> --host circle --bootorder network,hd

Deleting a guest
kvmtool delete --name <guest> --host circle
Note that the guest's disk image will not be deleted: add -purge if you want to delete the disk image.

Emergency reboot of a stuck guest
  • rvirsh circle send-key <guest> KEY_LEFTALT KEY_SYSRQ KEY_S
  • rvirsh circle send-key <guest> KEY_LEFTALT KEY_SYSRQ KEY_U
  • rvirsh circle send-key <guest> KEY_LEFTALT KEY_SYSRQ KEY_B

Note that kvmtool defaults to the system hypervisor regardless of whether it is called as a normal user or root. It also accepts the shortcut --host as a way of accessing the system hypervisor on a remote host.

-- AlastairScobie - 13 Mar 2012 -- ChrisCooke - 6 Jul 2012

Topic revision: r2 - 06 Jul 2012 - 09:53:35 - ChrisCooke
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies