[PATCH v2 05/14] libxl: turn libxl_get_physinfo() to void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libxl_get_physinfo() always returns 0.

Signed-off-by: Dmitry Frolov <frolov@xxxxxxxxx>
---
 src/libxl/libxl_capabilities.c |  6 +-----
 src/libxl/libxl_conf.c         | 20 +++++---------------
 src/libxl/libxl_driver.c       |  6 +-----
 tests/libxlmock.c              |  5 +----
 4 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
index 836f46341a..e141873775 100644
--- a/src/libxl/libxl_capabilities.c
+++ b/src/libxl/libxl_capabilities.c
@@ -170,11 +170,7 @@ libxlCapsInitHost(libxl_ctx *ctx, virCaps *caps)
     int ret = -1;
 
     libxl_physinfo_init(&phy_info);
-    if (libxl_get_physinfo(ctx, &phy_info) != 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Failed to get node physical info from libxenlight"));
-        goto cleanup;
-    }
+    libxl_get_physinfo(ctx, &phy_info);
 
     if (libxlCapsInitCPU(caps, &phy_info) < 0)
         goto cleanup;
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 62e1be6672..82f4dd80a2 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -856,12 +856,8 @@ libxlMakeVnumaList(virDomainDef *def,
         return 0;
 
     libxl_physinfo_init(&physinfo);
-    if (libxl_get_physinfo(ctx, &physinfo) < 0) {
-        libxl_physinfo_dispose(&physinfo);
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libxl_get_physinfo_info failed"));
-        return -1;
-    }
+    libxl_get_physinfo(ctx, &physinfo);
+
     nr_nodes = physinfo.nr_nodes;
     libxl_physinfo_dispose(&physinfo);
 
@@ -1927,10 +1923,8 @@ libxlDriverGetDom0MaxmemConf(libxlDriverConfig *cfg,
  physmem:
     /* No 'max' specified in dom0_mem, so dom0 can use all physical memory */
     libxl_physinfo_init(&physinfo);
-    if (libxl_get_physinfo(cfg->ctx, &physinfo)) {
-        VIR_WARN("libxl_get_physinfo failed");
-        return -1;
-    }
+    libxl_get_physinfo(cfg->ctx, &physinfo);
+
     *maxmem = (physinfo.total_pages * cfg->verInfo->pagesize) / 1024;
     libxl_physinfo_dispose(&physinfo);
     return 0;
@@ -2405,11 +2399,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivate *driver, virNodeInfoPtr info)
     int ret = -1;
 
     libxl_physinfo_init(&phy_info);
-    if (libxl_get_physinfo(cfg->ctx, &phy_info)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libxl_get_physinfo_info failed"));
-        goto cleanup;
-    }
+    libxl_get_physinfo(cfg->ctx, &phy_info);
 
     if (virStrcpyStatic(info->model, virArchToString(hostarch)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c98d2d737a..d218cc63dc 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4489,11 +4489,7 @@ libxlNodeGetFreeMemory(virConnectPtr conn)
     if (virNodeGetFreeMemoryEnsureACL(conn) < 0)
         goto cleanup;
 
-    if (libxl_get_physinfo(cfg->ctx, &phy_info)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libxl_get_physinfo_info failed"));
-        goto cleanup;
-    }
+    libxl_get_physinfo(cfg->ctx, &phy_info);
 
     ret = phy_info.free_pages * cfg->verInfo->pagesize;
 
diff --git a/tests/libxlmock.c b/tests/libxlmock.c
index f564a0ef72..87796e780d 100644
--- a/tests/libxlmock.c
+++ b/tests/libxlmock.c
@@ -68,8 +68,7 @@ VIR_MOCK_IMPL_RET_ARGS(libxl_get_version_info,
     return &info;
 }
 
-VIR_MOCK_IMPL_RET_ARGS(libxl_get_physinfo,
-                       int,
+VIR_MOCK_IMPL_VOID_ARGS(libxl_get_physinfo,
                        libxl_ctx *, ctx,
                        libxl_physinfo *, physinfo)
 {
@@ -79,8 +78,6 @@ VIR_MOCK_IMPL_RET_ARGS(libxl_get_physinfo,
     /* silence gcc warning about unused function */
     if (0)
         real_libxl_get_physinfo(ctx, physinfo);
-
-    return 0;
 }
 
 VIR_MOCK_STUB_RET_ARGS(libxl_get_free_memory,
-- 
2.34.1
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux