[libvirt] [PATCH 2/2] qemu: Update next usable PCI slot on domain reconnect

Daniel P. Berrange berrange at redhat.com
Tue Aug 17 15:18:50 UTC 2010


On Tue, Aug 17, 2010 at 09:11:30AM -0600, Eric Blake wrote:
> On 08/16/2010 11:08 AM, Jiri Denemark wrote:
> > +void
> > +qemuDomainPCIAddressSetUpdate(qemuDomainPCIAddressSetPtr addrs)
> > +{
> > +
> > +    if (!addrs)
> > +        return;
> > +
> > +    virHashForEach(addrs->used, qemuDomainPCIAddressSetUpdateIter, addrs);
> 
> Does virHashForEach visit the hash table in the same order in which
> entries were inserted, or does it visit in random order based on how the
> hashes map to buckets?  If the latter, then how are you guaranteeing
> that you are setting nextslot to the right value, if you don't know if
> you are visiting the correct table entry last?

The hash iterator visits in an unpredictable order. It shouldn't matter
because for this usage, all that is important is that 'nextslot' eventually
ends up with the largest slot ID + 1.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list