[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 2/3] libxl: move begin phase job handling
. From libxlMigrationBegin to libxlDomainMigrateBegin3Params(). This is a preparatory patch to be able to begin a job in the perform phase. Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> --- src/libxl/libxl_driver.c | 18 +++++++++++++++++- src/libxl/libxl_migration.c | 16 +++------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index d34f843..28220b2 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5187,6 +5187,8 @@ libxlDomainMigrateBegin3Params(virDomainPtr domain, { const char *xmlin = NULL; virDomainObjPtr vm = NULL; + libxlDriverPrivatePtr driver; + char *ret; #ifdef LIBXL_HAVE_NO_SUSPEND_RESUME virReportUnsupportedError(); @@ -5223,7 +5225,21 @@ libxlDomainMigrateBegin3Params(virDomainPtr domain, return NULL; } - return libxlDomainMigrationBegin(domain->conn, vm, xmlin); + driver = domain->conn->privateData; + if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) { + virObjectUnlock(vm); + return NULL; + } + + ret = libxlDomainMigrationBegin(domain->conn, vm, xmlin); + + if (!libxlDomainObjEndJob(driver, vm)) + vm = NULL; + + if (vm) + virObjectUnlock(vm); + + return ret; } static int diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index 28445fc..e3c7914 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -235,17 +235,14 @@ libxlDomainMigrationBegin(virConnectPtr conn, virDomainDefPtr def; char *xml = NULL; - if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) - goto cleanup; - if (xmlin) { if (!(tmpdef = virDomainDefParseString(xmlin, cfg->caps, driver->xmlopt, VIR_DOMAIN_DEF_PARSE_INACTIVE))) - goto endjob; + goto cleanup; if (!libxlDomainDefCheckABIStability(driver, vm->def, tmpdef)) - goto endjob; + goto cleanup; def = tmpdef; } else { @@ -253,18 +250,11 @@ libxlDomainMigrationBegin(virConnectPtr conn, } if (!libxlDomainMigrationIsAllowed(def)) - goto endjob; + goto cleanup; xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE); - endjob: - if (!libxlDomainObjEndJob(driver, vm)) - vm = NULL; - cleanup: - if (vm) - virObjectUnlock(vm); - virDomainDefFree(tmpdef); virObjectUnref(cfg); return xml; -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |