diff options
author | Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com> | 2020-12-17 15:20:57 +0300 |
---|---|---|
committer | Nick Shyrokovskiy <nshyrokovskiy@gmail.com> | 2021-01-06 17:10:01 +0300 |
commit | d4439a6b83206f7fb0a11eee7a2c7848d3397385 (patch) | |
tree | 7a181a508e94f63021dee485f66ea31643d986d1 /src/libvirt-host.c | |
parent | 1dd607cd9cc1af35415fd15e24d1761214db6d09 (diff) | |
download | libvirt-d4439a6b83206f7fb0a11eee7a2c7848d3397385.tar.gz |
src: adopt to VIR_DRV_SUPPORTS_FEATURE return -1
Otherwise in some places we can mistakenly report 'unsupported' error instead
of root cause. So let's handle root cause explicitly from the macro.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'src/libvirt-host.c')
-rw-r--r-- | src/libvirt-host.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 58622d415d..8e680cb9f9 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -772,6 +772,8 @@ virNodeGetMemoryParameters(virConnectPtr conn, int *nparams, unsigned int flags) { + int rc; + VIR_DEBUG("conn=%p, params=%p, nparams=%p, flags=0x%x", conn, params, nparams, flags); @@ -783,8 +785,11 @@ virNodeGetMemoryParameters(virConnectPtr conn, if (*nparams != 0) virCheckNonNullArgGoto(params, error); - if (VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, - VIR_DRV_FEATURE_TYPED_PARAM_STRING)) + rc = VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, + VIR_DRV_FEATURE_TYPED_PARAM_STRING); + if (rc < 0) + goto error; + if (rc) flags |= VIR_TYPED_PARAM_STRING_OKAY; if (conn->driver->nodeGetMemoryParameters) { @@ -1724,6 +1729,8 @@ virNodeGetSEVInfo(virConnectPtr conn, int *nparams, unsigned int flags) { + int rc; + VIR_DEBUG("conn=%p, params=%p, nparams=%p, flags=0x%x", conn, params, nparams, flags); @@ -1734,8 +1741,11 @@ virNodeGetSEVInfo(virConnectPtr conn, virCheckNonNegativeArgGoto(*nparams, error); virCheckReadOnlyGoto(conn->flags, error); - if (VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, - VIR_DRV_FEATURE_TYPED_PARAM_STRING)) + rc = VIR_DRV_SUPPORTS_FEATURE(conn->driver, conn, + VIR_DRV_FEATURE_TYPED_PARAM_STRING); + if (rc < 0) + goto error; + if (rc) flags |= VIR_TYPED_PARAM_STRING_OKAY; if (conn->driver->nodeGetSEVInfo) { |