
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