From nobody Mon Feb 9 11:47:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1585646339; cv=none; d=zohomail.com; s=zohoarc; b=hFioVwfgRhdNMjT6uS64HvB7Hix2pnIw1OYPWiEMYMNfGTQI+Otd0CLgUZyqz/hgkFvQGNcG3EiBg5KXWCydu7QovXMU/f6YEaSoBQ1m0lt6XMS6bzqiT1fa2Folruojny5OBRVYlJrt3qgfO6jIgwqr3KlJuIQTP8G9pBSR4h0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585646339; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kAb4CEMN8j7WGF1cszxJbAX00wmk4WH7JkGFVoM8ziw=; b=PgVpQZ7qJsBA/ZfebIfj31RBy0TxPES+T0sdf5dDlzScIWlavaHemYPLQTXmNgAEaoTT6ccNaiIipU1ppCAhsyxENY4gzYPBikbxH73LS//JOpauMm/EATn1+1pXcLmRZGUl8846H4LXnxSTHrCSxPkgazM7bioY/ZC/pRFBSa0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1585646339263318.758826770012; Tue, 31 Mar 2020 02:18:59 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-b3sGglq-PJijfQAwkaT3KA-1; Tue, 31 Mar 2020 05:18:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 671F18018A4; Tue, 31 Mar 2020 09:18:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35526D7692; Tue, 31 Mar 2020 09:18:49 +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 DDD1886BFF; Tue, 31 Mar 2020 09:18:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02V9IbM6024672 for ; Tue, 31 Mar 2020 05:18:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 96E1996B6C; Tue, 31 Mar 2020 09:18:37 +0000 (UTC) Received: from ibm-p8-15-fsp.mgmt.pnr.lab.eng.rdu2.redhat.com (unknown [10.40.195.245]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3DD06EF9F; Tue, 31 Mar 2020 09:18:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585646338; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kAb4CEMN8j7WGF1cszxJbAX00wmk4WH7JkGFVoM8ziw=; b=AALhngYJWekqdaWIhl5yo0PlyDxlDDG7h6ltHQDrjDH9K5bIMlX1jw+cr95Bn5W5SLmKqq EComeL98X+Y0rqgHl2+GmGmws7ukI2/xR6lhziUFJ4HGRdR423XIh57K8/SOQfuI4UIUC5 5mYs1fmBXJbRahmIuPBtIbF71KX7TDU= X-MC-Unique: b3sGglq-PJijfQAwkaT3KA-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] qemu: block: factor implementation out of qemuDomainBlockJobAbort() Date: Tue, 31 Mar 2020 11:18:28 +0200 Message-Id: <20200331091829.521427-3-pmores@redhat.com> In-Reply-To: <20200331091829.521427-1-pmores@redhat.com> References: <20200331091829.521427-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As with the previous commit, this should primarily make qemuDomainBlockJobAbort() callable from within the QEMU driver. Signed-off-by: Pavel Mores --- src/qemu/qemu_driver.c | 62 ++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f94636f651..b981745ecf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -163,6 +163,12 @@ qemuDomainBlockCommitImpl(virDomainObjPtr vm, unsigned long bandwidth, unsigned int flags); =20 +static int +qemuDomainBlockJobAbortImpl(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *path, + unsigned int flags); + /* Looks up the domain object from snapshot and unlocks the * driver. The returned domain object is locked and ref'd and the * caller must call virDomainObjEndAPI() on it. */ @@ -17440,45 +17446,31 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, return ret; } =20 - static int -qemuDomainBlockJobAbort(virDomainPtr dom, - const char *path, - unsigned int flags) +qemuDomainBlockJobAbortImpl(virQEMUDriverPtr driver, + virDomainObjPtr vm, + const char *path, + unsigned int flags) { - virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainDiskDefPtr disk =3D NULL; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); bool pivot =3D !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT); bool async =3D !!(flags & VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC); g_autoptr(qemuBlockJobData) job =3D NULL; - virDomainObjPtr vm; qemuDomainObjPrivatePtr priv =3D NULL; bool blockdev =3D false; int ret =3D -1; =20 - virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC | - VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT, -1); - - if (!(vm =3D qemuDomainObjFromDomain(dom))) - return -1; - - if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0) - goto cleanup; - - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) - goto cleanup; - if (virDomainObjCheckActive(vm) < 0) - goto endjob; + return -1; =20 if (!(disk =3D qemuDomainDiskByName(vm->def, path))) - goto endjob; + return -1; =20 if (!(job =3D qemuBlockJobDiskGetJob(disk))) { virReportError(VIR_ERR_INVALID_ARG, _("disk %s does not have an active block job"), dis= k->dst); - goto endjob; + return -1; } =20 priv =3D vm->privateData; @@ -17549,6 +17541,34 @@ qemuDomainBlockJobAbort(virDomainPtr dom, endjob: if (job && !async) qemuBlockJobSyncEnd(vm, job, QEMU_ASYNC_JOB_NONE); + + return ret; +} + + +static int +qemuDomainBlockJobAbort(virDomainPtr dom, + const char *path, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC | + VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT, -1); + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainBlockJobAbortEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + ret =3D qemuDomainBlockJobAbortImpl(driver, vm, path, flags); + qemuDomainObjEndJob(driver, vm); =20 cleanup: --=20 2.24.1