1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

libxl: add API wrapper for libxl_domain_create_restore

Upcoming changes will use different LIBXL_API_VERSION variants.

Prepare libxl_domain_create_restore, which got a new parameter
"send_back_fd" in Xen 4.7. libvirt does not use this parameter.

No functional change intended.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Olaf Hering 2021-03-25 17:26:01 +01:00 committed by Jim Fehlig
parent ad3d6438fa
commit f2332e8f78
2 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,44 @@
/*
* libxl_api_wrapper.h: handle various libxl API variants
*
* Copyright (C) 2021 SUSE LLC
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <libxl.h>
static inline int
libxlDomainCreateRestoreWrapper(libxl_ctx *ctx,
libxl_domain_config *d_config,
uint32_t *domid,
int restore_fd,
const libxl_domain_restore_params *params,
const libxl_asyncprogress_how *aop_console_how)
{
int ret;
#if LIBXL_API_VERSION < 0x040700
ret = libxl_domain_create_restore(ctx, d_config, domid, restore_fd, params,
NULL, aop_console_how);
#else
ret = libxl_domain_create_restore(ctx, d_config, domid, restore_fd, -1,
params, NULL, aop_console_how);
#endif
return ret;
}

View File

@ -22,6 +22,7 @@
#include <fcntl.h>
#include "libxl_api_wrapper.h"
#include "libxl_domain.h"
#include "libxl_capabilities.h"
@ -1396,8 +1397,8 @@ libxlDomainStart(libxlDriverPrivatePtr driver,
#ifdef LIBXL_HAVE_SRM_V2
params.stream_version = restore_ver;
#endif
ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid,
restore_fd, &params, NULL,
ret = libxlDomainCreateRestoreWrapper(cfg->ctx, &d_config, &domid,
restore_fd, &params,
&aop_console_how);
libxl_domain_restore_params_dispose(&params);
}