From f3d838237d55ee636163825c1e4ee573d8437968 Mon Sep 17 00:00:00 2001 From: Erik Skultety Date: Fri, 3 Jul 2020 14:26:13 +0200 Subject: [PATCH] qemu: Use virQEMUCapsCacheLookupDefault instead of lookup by arch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Firstly, SEV is present only on AMD, so we can safely assume x86. Secondly, the problem with looking up capabilities in the cache by arch is that it's using virHashSearch with a callback to find the right capabilities and get the binary name from it as well, but since the cache is empty, it will return NULL and we won't get the corresponding binary name out of the lookup either. Then, during the cache validation we try to create a new cache entry for the emulator, but since we don't have the binary name, nothing gets created. Therefore, virQEMUCapsCacheLookupDefault is used to fix this issue, because it doesn't rely on the capabilities cache to construct the emulator binary name. https://bugzilla.redhat.com/show_bug.cgi?id=1852311 Signed-off-by: Erik Skultety Reviewed-by: Daniel P. Berrangé --- src/qemu/qemu_driver.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a5b38b3d24..cd8d7ffb56 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -22823,8 +22823,10 @@ qemuNodeGetSEVInfo(virConnectPtr conn, if (virNodeGetSevInfoEnsureACL(conn) < 0) return -1; - qemucaps = virQEMUCapsCacheLookupByArch(driver->qemuCapsCache, - virArchFromHost()); + qemucaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL); + if (!qemucaps) return -1;