mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
libxl: add API wrapper for libxl_domain_need_memory
Upcoming changes will use different LIBXL_API_VERSION variants. Prepare libxl_domain_need_memory, which changed the storage size of "need_memkb" in Xen 4.8. With Xen 4.12 the libxl_domain_config parameter was changed No functional change intended. Signed-off-by: Olaf Hering <olaf@aepfle.de> Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
9960337cd6
commit
0acd258e2e
@ -114,3 +114,27 @@ libxlDomainUnpauseWrapper(libxl_ctx *ctx, uint32_t domid)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define INVALID_DOMID ~0
|
||||
static inline int
|
||||
libxlDomainNeedMemoryWrapper(libxl_ctx *ctx,
|
||||
libxl_domain_config *d_config,
|
||||
uint64_t *need_memkb)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if LIBXL_API_VERSION < 0x040800
|
||||
{
|
||||
uint32_t val32 = 0;
|
||||
|
||||
ret = libxl_domain_need_memory(ctx, &d_config->b_info, &val32);
|
||||
*need_memkb = val32;
|
||||
}
|
||||
#elif LIBXL_API_VERSION < 0x041300
|
||||
ret = libxl_domain_need_memory(ctx, &d_config->b_info, need_memkb);
|
||||
#else
|
||||
ret = libxl_domain_need_memory(ctx, d_config, INVALID_DOMID, need_memkb);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -1008,13 +1008,13 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, virDomainObjPtr vm)
|
||||
static int
|
||||
libxlDomainFreeMem(libxl_ctx *ctx, libxl_domain_config *d_config)
|
||||
{
|
||||
uint32_t needed_mem;
|
||||
uint64_t needed_mem;
|
||||
uint32_t free_mem;
|
||||
int32_t target_mem;
|
||||
int tries = 3;
|
||||
int wait_secs = 10;
|
||||
|
||||
if (libxl_domain_need_memory(ctx, &d_config->b_info, &needed_mem) < 0)
|
||||
if (libxlDomainNeedMemoryWrapper(ctx, d_config, &needed_mem) < 0)
|
||||
goto error;
|
||||
|
||||
do {
|
||||
|
Loading…
Reference in New Issue
Block a user