libvirtからkvm上のCD-ROMドライブのディスク交換

$ virsh attach-disk <domain> <source> <target> --type cdrom
例:
$ virsh attach-disk DomainU1 /path/to/newdisk.iso hdc --type cdrom

ポイントが二つ

  • --type cdromをつけないと"エラー: this function is not supported by the hypervisor: only SCSI or virtio disk device can be detached dynamically"と怒られる。
  • はフルパスで書かなければならない。