[libvirt PATCH] Partially revert "qemu: fix missing error reports in capabilities probing"

Daniel P. Berrangé posted 1 patch 3 years, 9 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200715150831.222155-1-berrange@redhat.com
src/qemu/qemu_capabilities.c | 5 -----
src/qemu/qemu_domain.c       | 4 +---
2 files changed, 1 insertion(+), 8 deletions(-)
[libvirt PATCH] Partially revert "qemu: fix missing error reports in capabilities probing"
Posted by Daniel P. Berrangé 3 years, 9 months ago
This partially reverts commit 5331c4804f4f419b9e75741084f926e52413d3a1.

The original commit mistakenly thought virFileCacheLookup did not set
an error. In fact the only case it doesn't set an error for is when
the cache key is NULL. This in fact the fault of the caller for passing
an invalid cache key, so doesn't need to be handled.

This caller bug was fixed by checking for a NULL binary in the
virQEMUCapsCacheLookupDefault method.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/qemu/qemu_capabilities.c | 5 -----
 src/qemu/qemu_domain.c       | 4 +---
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b27a5e5c81..7264fe300f 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5636,11 +5636,6 @@ virQEMUCapsCacheLookup(virFileCachePtr cache,
     priv->microcodeVersion = virHostCPUGetMicrocodeVersion();
 
     ret = virFileCacheLookup(cache, binary);
-    if (!ret) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("no capabilities available for %s"), binary);
-        return NULL;
-    }
 
     VIR_DEBUG("Returning caps %p for %s", ret, binary);
     return ret;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4a2daffc0a..6147333381 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5256,10 +5256,8 @@ qemuDomainPostParseDataAlloc(const virDomainDef *def,
     virQEMUDriverPtr driver = opaque;
 
     if (!(*parseOpaque = virQEMUCapsCacheLookup(driver->qemuCapsCache,
-                                                def->emulator))) {
-        virResetLastError();
+                                                def->emulator)))
         return 1;
-    }
 
     return 0;
 }
-- 
2.26.2

Re: [libvirt PATCH] Partially revert "qemu: fix missing error reports in capabilities probing"
Posted by Michal Prívozník 3 years, 9 months ago
On 7/15/20 5:08 PM, Daniel P. Berrangé wrote:
> This partially reverts commit 5331c4804f4f419b9e75741084f926e52413d3a1.
> 
> The original commit mistakenly thought virFileCacheLookup did not set
> an error. In fact the only case it doesn't set an error for is when
> the cache key is NULL. This in fact the fault of the caller for passing
> an invalid cache key, so doesn't need to be handled.
> 
> This caller bug was fixed by checking for a NULL binary in the
> virQEMUCapsCacheLookupDefault method.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   src/qemu/qemu_capabilities.c | 5 -----
>   src/qemu/qemu_domain.c       | 4 +---
>   2 files changed, 1 insertion(+), 8 deletions(-)
> 


Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal