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.
Alexandr Gluzskiy
2013-Dec-05 11:28 UTC
Re: [libvirt-users] correct way to hot-add cdrom ?
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. > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-usersi 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' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso vda --type cdrom attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): vda 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 'vda' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso sda --type cdrom attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): sda 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 'scsi' and target 'sda' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso sda --type cdrom --mode readonly attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): sda attach-disk: type(optdata): cdrom attach-disk: mode(optdata): readonly 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 'scsi' and target 'sda' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso vda --type cdrom --mode readonly attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): vda attach-disk: type(optdata): cdrom attach-disk: mode(optdata): readonly 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 'vda' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso hda --type cdrom --mode readonly attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): hda attach-disk: type(optdata): cdrom attach-disk: mode(optdata): readonly attach-disk: found option <domain>: fuck attach-disk: <domain> trying as domain NAME error: Failed to attach disk error: internal error: Removable media not supported for cdrom device evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso hdb --type cdrom --mode readonly attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): hdb attach-disk: type(optdata): cdrom attach-disk: mode(optdata): readonly 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 'ide' and target 'hdb' evil-desktop sss # virsh -d 0 attach-disk fuck /home/sss/cd/mhdd32ver4.6.iso hdc --type cdrom --mode readonly attach-disk: domain(optdata): fuck attach-disk: source(optdata): /home/sss/cd/mhdd32ver4.6.iso attach-disk: target(optdata): hdc attach-disk: type(optdata): cdrom attach-disk: mode(optdata): readonly attach-disk: found option <domain>: fuck attach-disk: <domain> trying as domain NAME Disk attached successfully with no luck...
Daniel P. Berrange
2013-Dec-05 11:33 UTC
Re: [libvirt-users] correct way to hot-add cdrom ?
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 :|