[libvirt] [PATCH 6/6] qemu: Make save/restore with USB devices usable

Jiri Denemark jdenemar at redhat.com
Thu Oct 11 09:42:50 UTC 2012


On Wed, Oct 10, 2012 at 16:40:59 +0100, Daniel P. Berrange wrote:
> On Tue, Oct 09, 2012 at 02:13:27PM +0200, Jiri Denemark wrote:
> > @@ -12072,6 +12079,9 @@ virDomainHostdevSourceFormat(virBufferPtr buf,
> >          policy = virDomainStartupPolicyTypeToString(def->startupPolicy);
> >          virBufferAsprintf(buf, " startupPolicy='%s'", policy);
> >      }
> > +    if (def->source.subsys.u.usb.autoAddress &&
> > +        (flags & VIR_DOMAIN_XML_MIGRATABLE))
> > +        virBufferAddLit(buf, " autoAddress='yes'");
> >      virBufferAddLit(buf, ">\n");
> >  
> >      virBufferAdjustIndent(buf, 2);
> 
> Do we really need to add a new attribute for this. IMHO if the user
> has specified a vendor+product, then it is always auto-address, even
> if they have also given a dev+address.

We do need it. If both vendor/product and bus/dev are specified, the code
doesn't try to find the device at different address. See the following code
snippet from usbDeviceSearch:

        if ((flags & USB_DEVICE_FIND_BY_VENDOR) &&
            (found_prod != product || found_vend != vendor))
            continue;

        if (flags & USB_DEVICE_FIND_BY_BUS) {
            if (found_bus != bus || found_devno != devno)
                continue;
            found = true;
        }

And it also make sense because if there are more devices with the same
vendor/product id, we require bus/dev to be configured so that we can assign
the right device and don't mess with other similar devices. However, if the
address was autofilled by libvirt, we can try to look at other addresses if
the device cannot be found at its original address (i.e., it was unplugged and
plugged again).

Jirka




More information about the libvir-list mailing list