libvirt/c89a6e78-libxl-physinfo-cleanup.patch
James Fehlig f167ba3466 Accepting request 456194 from home:jfehlig:branches:Virtualization
- apparmor: don't fail on non-apparmor <seclabel>
  apparmor-errormsg-fix.patch, apparmor-alt-seclabel.patch
  bsc#1023436

- libxl: fix reporting of domain maximum memory
  ff225538-libxl-autoballoon-setting.patch,
  c89a6e78-libxl-physinfo-cleanup.patch,
  d2b77608-libxl-maxmem-fix.patch,
  79692c38-libxl-dom0-maxmem.patch
  bsc#1017762

- libxl: set disk format to raw if not specified and fix disk
  detach
  321a28c6-libxl-default-disk-format.patch,
  bd116810-libxl-fix-disk-detach.patch
  bsc#1003379

- libxl: fix timer configurations
  6e4759d0-libxl-timer-fix.patch,
  87df87e0-libxl-timer-tsc-emulate.patch,
  b4386fda-xenconfig-timer-fix.patch, d3970925-timer-tests.patch
  bsc#1019969

OBS-URL: https://build.opensuse.org/request/show/456194
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=583
2017-02-10 23:01:12 +00:00

104 lines
3.2 KiB
Diff

commit c89a6e7878e630718cce0af940e9c070c132ce30
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Jan 31 20:07:30 2017 -0700
libxl: use init and dispose functions with libxl_physinfo
The typical pattern when calling libxl functions that populate a
structure is
libxl_foo foo;
libxl_foo_init(&foo);
libxl_get_foo(ctx, &foo);
...
libxl_foo_dispose(&foo);
Fix several instances of libxl_physinfo missing the init and
dispose calls.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Index: libvirt-3.0.0/src/libxl/libxl_capabilities.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_capabilities.c
+++ libvirt-3.0.0/src/libxl/libxl_capabilities.c
@@ -211,27 +211,33 @@ libxlCapsInitHost(libxl_ctx *ctx, virCap
const libxl_version_info *ver_info;
enum libxlHwcapVersion version;
libxl_physinfo phy_info;
+ 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"));
- return -1;
+ goto cleanup;
}
if ((ver_info = libxl_get_version_info(ctx)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to get version info from libxenlight"));
- return -1;
+ goto cleanup;
}
version = (ver_info->xen_version_minor >= 7);
if (libxlCapsInitCPU(caps, &phy_info, version) < 0)
- return -1;
+ goto cleanup;
if (virCapabilitiesSetNetPrefix(caps, LIBXL_GENERATED_PREFIX_XEN) < 0)
- return -1;
+ goto cleanup;
- return 0;
+ ret = 0;
+
+ cleanup:
+ libxl_physinfo_dispose(&phy_info);
+ return ret;
}
static int
Index: libvirt-3.0.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_conf.c
+++ libvirt-3.0.0/src/libxl/libxl_conf.c
@@ -1969,6 +1969,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivat
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
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"));
@@ -1993,6 +1994,7 @@ libxlDriverNodeGetInfo(libxlDriverPrivat
ret = 0;
cleanup:
+ libxl_physinfo_dispose(&phy_info);
virObjectUnref(cfg);
return ret;
}
Index: libvirt-3.0.0/src/libxl/libxl_driver.c
===================================================================
--- libvirt-3.0.0.orig/src/libxl/libxl_driver.c
+++ libvirt-3.0.0/src/libxl/libxl_driver.c
@@ -4284,6 +4284,7 @@ libxlNodeGetFreeMemory(virConnectPtr con
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
unsigned long long ret = 0;
+ libxl_physinfo_init(&phy_info);
if (virNodeGetFreeMemoryEnsureACL(conn) < 0)
goto cleanup;
@@ -4296,6 +4297,7 @@ libxlNodeGetFreeMemory(virConnectPtr con
ret = phy_info.free_pages * cfg->verInfo->pagesize;
cleanup:
+ libxl_physinfo_dispose(&phy_info);
virObjectUnref(cfg);
return ret;
}