Description of problem: libvirt is not able to update a cdrom device on VirtualBox driver. I wanted to change the source of the cdrom for a specific VM in VirtualBox using virsh. Here is the new XML for the device : <disk type='file' device='cdrom' > <source file='/tmp/myiso' /> <target dev='hdc' bus='ide' /> </disk> I used virsh to update the device : $ virsh -c 'vbox:///session' update-device myvm device.xml Version-Release number of selected component (if applicable): How reproducible: always. Steps to Reproduce: 1. create an empty VM in VirtualBox 2. try to update the cdrom device 3. get the error 'Unsupported device type' Actual results: error :Failed to update device from device.xml error :argument unsupported: Unsupported device type 1 Expected results: success Additional info:
What version of libvirt is this? What distro are you on? What virtualbox version is this? Please also provide the full VM XML as well
Hi, sorry for this late reply, but when i tried to reproduce the bug, i could not use libvirt and virtualbox together : when i run $ virsh -c vbox:///session i get this error : error: failed to connect to the hypervisor error: internal error: unable to initialize VirtualBox driver API so i ran libvirtd in verbose mode and i noticed these error messages : error : dummyConnectOpen:90 : internal error: unable to initialize VirtualBox driver API and virNetSocketReadWire:1609 : End of file while reading data: Input/output error I really would like to help you with the original bug that i reported, but i have to know why my libvirt is not working anymore. I already looked at some resources on internet, but nothing works here. Could you help me with this ? Thanks ! What version of libvirt is this? libvirtd (libvirt) 1.2.18.2 What distro are you on? Fedora 23 What virtualbox version is this? VirtualBox 5.0.16
Is libvirt-daemon-driver-vbox.x86_64 ? If you're still having issues, maybe try grabbing latest libvirt packages from fedora virt preview repo, maybe it's a libvirt issue that was fixed: https://fedoraproject.org/wiki/Virtualization_Preview_Repository
yes, i installed both libvirt-daemon-driver-vbox.x86_64 and libvirt-daemon-vbox.x86_64. I also tried to install VirtualBox from the Oracle repository. And I updated my libvirt components to the one provided by the preview repository that you gave me. But it doesn't work... Could help me to debug this issue first ? Thanks !
I poked at it, seems the issue is that libvirt doesn't have any virtualbox 5 API support :/ I sent a patch upstream to at least give a warning in this case: http://www.redhat.com/archives/libvir-list/2016-April/msg01593.html But unfortunately the larger issue of lack of vbox 5 API support will need someone else to fix, sorry
ok so i reinstalled VirtualBox 4 (and removed VirtualBox 5), to be able to reproduce the bug. Basically, my script is trying to find a specific VM, look for the cdrom and update its source file : #!/usr/bin/env python3 """ Usage: vm_get_filesystem.py <vm_name> Options: -h --help Display this message """ from docopt import docopt import os import sys import re import subprocess import libvirt import tempfile import xml.etree.ElementTree as ET __SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0])) MYISO = os.path.join(__SCRIPT_DIR, 'live.iso') if __name__ == '__main__': args = docopt(__doc__) # connect to VBox con = libvirt.open('vbox:///session') if con == None: print('Failed to connect to the Hypervisor !') sys.exit(1) # search vm vm = con.lookupByName(args['<vm_name>']) # get xml and list devices xml = vm.XMLDesc() print(xml) root = ET.fromstring(xml) # get all devices xml devices = root.find('devices') # do we have a disk ? for d in devices.iter('disk'): if d.get('device') == 'cdrom': # cdrom cdrom = d # change source # -> type = file cdrom.set('type', 'file') # -> source = 'myiso' try: # set cdrom.find('source').set('file', MYISO) except: # insert ET.SubElement(cdrom, 'source', {'file': MYISO}) new_device_xml = ET.tostring(cdrom).decode('utf-8') print(new_device_xml) vm.updateDeviceFlags(new_device_xml) And i don't understand why, at the last line, it raised an error when it calls vm.updateDeviceFlags(), whith a string that should look like : <disk device="cdrom" type="file"> <source file="/tmp/live.iso" /> <target bus="ide" dev="hdc" /> </disk> Did i made a mistake when i called vm.updateDeviceFlags ? Or is it something else ? Thank !
According to the code, we apparently only support disk media change for vbox API < 3.1 :( The error message again sucks here Unfortunately the virtualbox driver is barely maintained so I don't think this will be fixed any time soon, unless you want to try providing a patch yourself
Thank you for reporting this issue to the libvirt project. Unfortunately we have been unable to resolve this issue due to insufficient maintainer capacity and it will now be closed. This is not a reflection on the possible validity of the issue, merely the lack of resources to investigate and address it, for which we apologise. If you none the less feel the issue is still important, you may choose to report it again at the new project issue tracker https://gitlab.com/libvirt/libvirt/-/issues The project also welcomes contribution from anyone who believes they can provide a solution.