[libvirt] [PATCH] Fix usb master startport parsing

Daniel P. Berrange berrange at redhat.com
Thu Apr 25 11:11:49 UTC 2013


On Thu, Apr 25, 2013 at 01:05:49PM +0200, Martin Kletzander wrote:
> When all usb controllers connected to the same bus have <master
> startport='x'/> specified, none of them have 'id=usb' assigned and
> thus qemu fails due to invalid masterport specification (we use 'usb'
> for that purpose).  Adding a check that at least one of the
> controllers is specified without <master startport='x'/> and in case
> this happens, don't error out, just emit a warning and fix it within
> the first such controller found.  This makes UX better by not forcing
> them to fix controller definition after removing the only non-master
> usb controller.

No, using VIR_WARN in the parser is a really bad. This is a broken
configuration  and should be reported as such. It is not the responsibility
of libvirt to workaround apps generating broken configs. if the user
removes the master controller, then the app should be removing any
non-master controllers that depend on it.


> new file mode 100644
> index 0000000..895d932
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-no-companion.xml
> @@ -0,0 +1,21 @@
> +<domain type='qemu'>
> +  <name>QEMUGuest1</name>
> +  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
> +  <memory unit='KiB'>219136</memory>
> +  <currentMemory unit='KiB'>219136</currentMemory>
> +  <vcpu placement='static'>1</vcpu>
> +  <os>
> +    <type arch='i686' machine='pc'>hvm</type>
> +    <boot dev='hd'/>
> +  </os>
> +  <devices>
> +    <emulator>/usr/bin/qemu</emulator>
> +    <controller type='usb' index='0' model='ich9-uhci2'>
> +      <master startport='2'/>
> +      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0'/>
> +    </controller>

This is just a broken configuration since there is no master controller
to assocated with the companion with.

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 libvir-list mailing list