[libvirt] [PATCH v2] qemu: Fix using guest architecture as lookup key
Andrea Bolognani
abologna at redhat.com
Wed Sep 16 07:17:58 UTC 2015
On Tue, 2015-09-15 at 17:34 +0100, Daniel P. Berrange wrote:
> > + /* Second attempt: use some arch-specific rules */
> > + archstr =
> > virQEMUCapsArchToString(virQEMUCapsFindTarget(hostarch,
> > +
> > guestarch));
>
> Nitpick, we could avoid the second search if virQEMUCapsFindTarget()
> returns a value that == the original guestarch.
> > + if (!ret) {
> > + /* If the first attempt at findind capabilities has
> > failed, try
> > + * again using the QEMU target as lookup key instead */
> > + data.arch = virQEMUCapsFindTarget(virArchFromHost(),
> > data.arch);
> > + ret = virHashSearch(cache->binaries,
> > virQEMUCapsCompareArch, &data);
> > + }
>
> Here too, skip the hash search if data.arch == data.arch from before.
Good idea! After all, the definition of insanity is looking up
using the same key twice and expecting a result the second time
around :)
I've just posted a new version[1] that implements your suggestion.
Cheers.
[1] https://www.redhat.com/archives/libvir-list/2015-September/msg00489
.html
--
Andrea Bolognani
Software Engineer - Virtualization Team
More information about the libvir-list
mailing list