From nobody Tue Feb 10 00:40:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536182925779253.80598026768098; Wed, 5 Sep 2018 14:28:45 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F50186666; Wed, 5 Sep 2018 21:28:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3328B600C5; Wed, 5 Sep 2018 21:28:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E6CBA181A12E; Wed, 5 Sep 2018 21:28:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w85LSMJc029546 for ; Wed, 5 Sep 2018 17:28:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 329C860922; Wed, 5 Sep 2018 21:28:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A36F611B2 for ; Wed, 5 Sep 2018 21:28:18 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B0296308FB8D for ; Wed, 5 Sep 2018 21:28:17 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Wed, 05 Sep 2018 15:28:15 -0600 From: Jim Fehlig To: libvir-list@redhat.com Date: Wed, 5 Sep 2018 15:28:02 -0600 Message-Id: <20180905212804.10587-4-jfehlig@suse.com> In-Reply-To: <20180905212804.10587-1-jfehlig@suse.com> References: <20180905212804.10587-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Sep 2018 21:28:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Sep 2018 21:28:18 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: xen-devel@lists.xenproject.org Subject: [libvirt] [PATCH 3/5] libxl: fix job handling across migration phases on src X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 05 Sep 2018 21:28:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The libxlDomainMigrationSrc* functions are a bit flawed in their handling of modify jobs. A job begins at the start of the begin phase but ends before the phase completes. No job is running for the remaining phases of migration on the source host. Change the logic to keep the job running after a successful begin phase, and end the job in the confirm phase. The job must also end in the perform phase in the case of error since confirm phase would not be executed. Signed-off-by: Jim Fehlig --- src/libxl/libxl_migration.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index e4f2895690..191973edeb 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -399,6 +399,11 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn, virDomainDefPtr def; char *xml =3D NULL; =20 + /* + * In the case of successful migration, a job is started here and + * terminated in the confirm phase. Errors in the begin or perform + * phase will also terminate the job. + */ if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto cleanup; =20 @@ -428,6 +433,9 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn, goto endjob; =20 xml =3D virDomainDefFormat(def, cfg->caps, VIR_DOMAIN_DEF_FORMAT_SECUR= E); + /* Valid xml means success! EndJob in the confirm phase */ + if (xml) + goto cleanup; =20 endjob: libxlDomainObjEndJob(driver, vm); @@ -1169,6 +1177,14 @@ libxlDomainMigrationSrcPerformP2P(libxlDriverPrivate= Ptr driver, ret =3D libxlDoMigrateSrcP2P(driver, vm, sconn, xmlin, dconn, dconnuri, dname, uri_str, flags); =20 + if (ret < 0) { + /* + * Confirm phase will not be executed if perform fails. End the + * job started in begin phase. + */ + libxlDomainObjEndJob(driver, vm); + } + cleanup: orig_err =3D virSaveLastError(); virObjectUnlock(vm); @@ -1232,11 +1248,17 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivatePt= r driver, ret =3D libxlDoMigrateSrcSend(driver, vm, flags, sockfd); virObjectLock(vm); =20 - if (ret < 0) + if (ret < 0) { virDomainLockProcessResume(driver->lockManager, "xen:///system", vm, priv->lockState); + /* + * Confirm phase will not be executed if perform fails. End the + * job started in begin phase. + */ + libxlDomainObjEndJob(driver, vm); + } =20 cleanup: VIR_FORCE_CLOSE(sockfd); @@ -1386,6 +1408,8 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivatePtr = driver, ret =3D 0; =20 cleanup: + /* EndJob for corresponding BeginJob in begin phase */ + libxlDomainObjEndJob(driver, vm); virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); return ret; --=20 2.18.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list