Change CD-ROM via virsh

Add CDROM:

attach-disk guest01 /root/disc1.iso hdc --driver file --type cdrom
--mode readonly

Change CDROM:

attach-disk guest01 /root/disc2.iso hdc --driver file --type cdrom
--mode readonly

Remove CDROM:

 attach-disk guest01 " " hdc --driver file --type cdrom
 --mode readonly

In libvirt 0.9.12 and maybe earlier, a command change-media exists:

change-media <domain> <path> [<source>] [--eject] [--insert] [--update] [--current] [--live] [--config] [--force]

Change CD:

change-media guest01 hdb /pool/disc.iso

Eject CD:

change-media guest01 hdb --eject

Tags:

Linux Kvm