[PATCH v1 2/4] libxl: remove obsolete check for result of xc_get_max_cpus

Olaf Hering olaf at aepfle.de
Mon May 3 10:56:11 UTC 2021


xc_get_max_cpus from Xen version 4.3 may return 0 in case xc_physinfo
fails. This has been fixed in Xen 4.4. Remove the obsolete result check
from libvirt. Just convert libxl error codes to plain -1.

Signed-off-by: Olaf Hering <olaf at aepfle.de>
---
 src/libxl/libxl_driver.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index cf3ee4db3d..99a170ff2a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -972,11 +972,7 @@ libxlConnectGetMaxVcpus(virConnectPtr conn, const char *type G_GNUC_UNUSED)
 
     cfg = libxlDriverConfigGet(driver);
     ret = libxl_get_max_cpus(cfg->ctx);
-    /* On failure, libxl_get_max_cpus() will return ERROR_FAIL from Xen 4.4
-     * onward, but it ever returning 0 is obviously wrong too (and it is
-     * what happens, on failure, on Xen 4.3 and earlier). Therefore, a 'less
-     * or equal' is the catchall we want. */
-    if (ret <= 0)
+    if (ret < 0)
         ret = -1;
 
     virObjectUnref(cfg);




More information about the libvir-list mailing list