From patchwork Wed Jan 20 19:00:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joao Martins X-Patchwork-Id: 8073621 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 95B1FBEEE5 for ; Wed, 20 Jan 2016 19:04:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 88EC520511 for ; Wed, 20 Jan 2016 19:04:02 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9194A204E2 for ; Wed, 20 Jan 2016 19:04:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLy06-00012G-MW; Wed, 20 Jan 2016 19:01:02 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLy06-00011y-8Q for xen-devel@lists.xen.org; Wed, 20 Jan 2016 19:01:02 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 66/CD-31122-D69DF965; Wed, 20 Jan 2016 19:01:01 +0000 X-Env-Sender: joao.m.martins@oracle.com X-Msg-Ref: server-4.tower-21.messagelabs.com!1453316459!11171269!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57503 invoked from network); 20 Jan 2016 19:01:00 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-4.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Jan 2016 19:01:00 -0000 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u0KJ0x8l027908 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 20 Jan 2016 19:00:59 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u0KJ0ww9023243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 20 Jan 2016 19:00:59 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u0KJ0wFB025766; Wed, 20 Jan 2016 19:00:58 GMT Received: from localhost.localdomain (/87.196.251.223) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Jan 2016 11:00:58 -0800 From: Joao Martins To: libvir-list@redhat.com, jfehlig@suse.com Date: Wed, 20 Jan 2016 19:00:07 +0000 Message-Id: <1453316408-30373-3-git-send-email-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453316408-30373-1-git-send-email-joao.m.martins@oracle.com> References: <1453316408-30373-1-git-send-email-joao.m.martins@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Cc: Joao Martins , xen-devel@lists.xen.org Subject: [Xen-devel] [PATCH v3 2/3] libxl: move begin phase job handling X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP . 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 --- 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;