libxl: detect support for save and restore

libxl does not support save, restore, or migrate on all architectures,
notably ARM.  Detect whether libxl supports these operations using
LIBXL_HAVE_NO_SUSPEND_RESUME.  If not supported, drop advertisement of
<migration_features>.

Found by Ian Campbell while improving Xen's OSSTEST infrastructure

http://lists.xen.org/archives/html/xen-devel/2014-06/msg02171.html
This commit is contained in:
Jim Fehlig 2014-06-24 11:10:49 -06:00
parent 39931f5ee8
commit 1d37a4c46b
2 changed files with 39 additions and 0 deletions

View File

@ -1340,7 +1340,11 @@ libxlMakeCapabilities(libxl_ctx *ctx)
{
virCapsPtr caps;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
if ((caps = virCapabilitiesNew(virArchFromHost(), 0, 0)) == NULL)
#else
if ((caps = virCapabilitiesNew(virArchFromHost(), 1, 1)) == NULL)
#endif
return NULL;
if (libxlCapsInitHost(ctx, caps) < 0)

View File

@ -1379,6 +1379,11 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
int ret = -1;
bool remove_dom = false;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return -1;
#endif
virCheckFlags(0, -1);
if (dxml) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@ -1440,6 +1445,11 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
int fd = -1;
int ret = -1;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return -1;
#endif
virCheckFlags(VIR_DOMAIN_SAVE_PAUSED, -1);
if (dxml) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@ -4351,6 +4361,11 @@ libxlDomainMigrateBegin3Params(virDomainPtr domain,
const char *xmlin = NULL;
virDomainObjPtr vm = NULL;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return NULL;
#endif
virCheckFlags(LIBXL_MIGRATION_FLAGS, NULL);
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
return NULL;
@ -4395,6 +4410,11 @@ libxlDomainMigratePrepare3Params(virConnectPtr dconn,
const char *dname = NULL;
const char *uri_in = NULL;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return -1;
#endif
virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
goto error;
@ -4445,6 +4465,11 @@ libxlDomainMigratePerform3Params(virDomainPtr dom,
const char *uri = NULL;
int ret = -1;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return -1;
#endif
virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
goto cleanup;
@ -4497,6 +4522,11 @@ libxlDomainMigrateFinish3Params(virConnectPtr dconn,
virDomainObjPtr vm = NULL;
const char *dname = NULL;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return NULL;
#endif
virCheckFlags(LIBXL_MIGRATION_FLAGS, NULL);
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
return NULL;
@ -4545,6 +4575,11 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,
libxlDriverPrivatePtr driver = domain->conn->privateData;
virDomainObjPtr vm = NULL;
#ifdef LIBXL_HAVE_NO_SUSPEND_RESUME
virReportUnsupportedError();
return -1;
#endif
virCheckFlags(LIBXL_MIGRATION_FLAGS, -1);
if (virTypedParamsValidate(params, nparams, LIBXL_MIGRATION_PARAMETERS) < 0)
return -1;