[PATCH v3 2/4] libxl: adopt to VIR_DRV_SUPPORTS_FEATURE return -1

Nikolay Shirokovskiy posted 4 patches 5 years, 1 month ago
[PATCH v3 2/4] libxl: adopt to VIR_DRV_SUPPORTS_FEATURE return -1
Posted by Nikolay Shirokovskiy 5 years, 1 month ago
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>
---
 src/libxl/libxl_migration.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 6dc6812..2925aaa 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -1146,7 +1146,7 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivatePtr driver,
                                   unsigned int flags)
 {
     int ret = -1;
-    bool useParams;
+    int useParams;
     virConnectPtr dconn = NULL;
     virErrorPtr orig_err = NULL;
     libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
@@ -1171,9 +1171,11 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivatePtr driver,
                                          VIR_DRV_FEATURE_MIGRATION_PARAMS);
     virObjectLock(vm);
 
-    if (!useParams) {
-        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                       _("Destination libvirt does not support migration with extensible parameters"));
+    if (useParams <= 0) {
+        if (useParams == 0)
+            virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                           _("Destination libvirt does not support migration"
+                             " with extensible parameters"));
         goto cleanup;
     }
 
-- 
1.8.3.1

Re: [PATCH v3 2/4] libxl: adopt to VIR_DRV_SUPPORTS_FEATURE return -1
Posted by Daniel P. Berrangé 5 years, 1 month ago
On Fri, Dec 18, 2020 at 09:56:46AM +0300, Nikolay Shirokovskiy wrote:
> 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>
> ---
>  src/libxl/libxl_migration.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|