[ovirt-users] Ovirt 4.1 USB Api problems
Adolfo
agomez at virtualcable.es
Thu Mar 16 10:38:35 UTC 2017
Hi,
I don't know if this is the correct place for this question (i hope it
is ;-) ).
We are trying to make "enable USB support" work with a machine created
from python ovirtsdk4 api,
here is the code:
cluster = ovirt.types.Cluster(id=six.binary_type(clusterId))
template = ovirt.types.Template(id=six.binary_type(templateId))
if usbType in ('native', 'legacy'):
usb = ovirt.types.Usb(enabled=True,
type=ovirt.types.UsbType.NATIVE if usbType == 'native' else
ovirt.types.UsbType.LEGACY)
else:
usb = ovirt.types.Usb(enabled=False)
memoryPolicy =
ovirt.types.MemoryPolicy(guaranteed=guaranteedMB * 1024 * 1024)
par = ovirt.types.Vm(name=name, cluster=cluster,
template=template, description=comments,
type=ovirt.types.VmType.DESKTOP, memory=memoryMB * 1024 * 1024,
memory_policy=memoryPolicy,
usb=usb) # display=display,
return api.system_service().vms_service().add(par).id
The cuestion is that the machines gets correctly created, but when we
try to start the machine, we get an this error (extract from vdsm):
Traceback (most recent call last):
File "/usr/share/vdsm/virt/vm.py", line 552, in _startUnderlyingVm
self._run()
File "/usr/share/vdsm/virt/vm.py", line 1994, in _run
self._connection.createXML(domxml, flags),
File "/usr/lib/python2.7/site-packages/vdsm/libvirtconnection.py",
line 123, in wrapper
ret = f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/vdsm/utils.py", line 941, in
wrapper
return func(inst, *args, **kwargs)
File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3784, in
createXML
if ret is None:raise libvirtError('virDomainCreateXML() failed',
conn=self)
libvirtError: Error XML: Duplicate USB controllers with index 0
The question is, that if to this machine we have created, from
administration interface, remove an add support for usb, the machine
works, and the generated XML differs:
This is the difference we have found:
< <controller index="0" model="piix3-uhci" type="usb">
< <address bus="0x00" domain="0x0000" function="0x2"
slot="0x01" type="pci" />
< </controller>
40a38
> <address bus="0x00" domain="0x0000" function="0x0"
slot="0x02" type="pci" />
The "<" are from the non working (created from API call), and the ">"
are same machine after disabling and enabling again "usb support".
Is this a bug?, if not, ¿How is supposed to be enabled USB support from
API on VM Creation?,
By the way, the equivalent code for oVirt 3.x was working without
problems, the problems arises from 4.0 onwards.
Sorry for the inconveniences, and thank in advance for any help,
Adolfo Gómez
More information about the Users
mailing list