[libvirt-users] correct way to hot-add cdrom ?

Daniel P. Berrange berrange at redhat.com
Thu Dec 5 11:33:41 UTC 2013


On Thu, Dec 05, 2013 at 01:28:07PM +0200, Alexandr Gluzskiy wrote:
> Alexandr писал 2013-12-02 09:36:
> >Good day to all. i have problems with cdrom hot adding code. currently
> >i using virDomainAttachDevice with type=file, device=cdrom, dev=hdc,
> >this code works for machine with one ide hdd and one ide cdrom, but
> >this not work for machine with only one ide hdd, and i looking for
> >solution to hot add cdrom to machine independent of existing devices
> >or i need way to determinate which target device can be attached to
> >vm. thanks in advance for any help.

There is no way to hotplug a CDROM device - only disk devices can be
hotplugged.

For CDROM/Floppy devices it is looking for an existing device with the
given name, and then trying to change the removable media in that device.
The error you're getting shows that there is no such CDROM device with the
name 'vda' in the guest already.

> i have tested following
> 
> evil-desktop sss # virsh -d 0 attach-disk fuck
> /home/sss/cd/mhdd32ver4.6.iso vdb --type cdrom
> attach-disk: domain(optdata): fuck
> attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso
> attach-disk: target(optdata): vdb
> attach-disk: type(optdata): cdrom
> attach-disk: found option <domain>: fuck
> attach-disk: <domain> trying as domain NAME
> error: Failed to attach disk
> error: internal error: No device with bus 'virtio' and target 'vdb'

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvirt-users mailing list