If you run KVM with enabled monitor management console, you can do some pretty powerful internal stuff while the KVM guest is running.
In order to have a KVM-Qemu management console, you should start KVM with something like:
-monitor telnet:127.0.0.1:3010,server,nowait,ipv4
See the official documentation of Qemu for more details and also the man page of qemu-kvm (unofficial mirror).
Once you have it set up, you can then telnet to the management console and review the available commands:
famzah@famzahpc:~$ telnet localhost 3010 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. QEMU 0.11.0 monitor - type 'help' for more information (qemu) help
Changing the ISO image of a virtual CDROM drive is quite easy:
- First review what the current status of the drives is:
(qemu) info block virtio0: type=hd removable=0 file=/dev/sdb-vol/win7 ro=0 drv=host_device encrypted=0 ide0-cd0: type=cdrom removable=1 locked=0 file=/shared/win7-eval.iso ro=0 drv=raw encrypted=0 ide1-cd0: type=cdrom removable=1 locked=0 [not inserted]
- Then change the mounted ISO image in the CDROM drive on the fly:
(qemu) change ide1-cd0 /shared/win-virtio-drivers.iso
- Double-check that the changes took effect. KVM-Qemu will not issue an error message in case something went wrong (duh!):
(qemu) info block virtio0: type=hd removable=0 file=/dev/sdb-vol/win7 ro=0 drv=host_device encrypted=0 ide0-cd0: type=cdrom removable=1 locked=0 file=/shared/win7-eval.iso ro=0 drv=raw encrypted=0 ide1-cd0: type=cdrom removable=1 locked=0 file=/shared/win-virtio-drivers.iso ro=1 drv=raw encrypted=0
Use the “help” command to review the other powerful commands which you can use to tune and debug your running KVM guest (“info”, “migrate” and “system_reset” seem like interesting candidates).