From nobody Tue Feb 10 01:23:07 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=1588765446; cv=none; d=zohomail.com; s=zohoarc; b=mw7G+FHBV4pQ0cHwpXkHDT5DBwewHk31b6wf22Fhar50/1nVlyrQB9tKk2g+mLLalYetF8jUT1w2OohiutSABl4AsM1iRCkBYFIvWE2kTPyZfnMc1uOgt1xkw/KGrlszkHm6ls3ne4y/LKsWd1YYGQL4LxL/gQCvF+C8mDqwjjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588765446; 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=CSQUJPuShq6WMAsZ5pwLwISBDjh8EsKOFOIkzVg8Yqg=; b=d/+VEQ0AXuzTSUM70CNHciRoCb6yN70JFW9rkHzJ8dVcCaFkLnJqFB4QcsnMPrsErrmLPFYvhCOrE3ZRLTK+PXsqchX6kwXNF+w7Er20a7Spkx0uXQbzrAzTUxgqOjIF3Y2JCZcH6GPc2XrIzSk+RiW0fZvlVIb2/Em2+/pyAdA= 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 1588765446013728.4356138896504; Wed, 6 May 2020 04:44:06 -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-270-cX36qWV5PIOkzGSziKmN8g-1; Wed, 06 May 2020 07:44:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 483D98064D8; Wed, 6 May 2020 11:43:57 +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 2480E5C1BD; Wed, 6 May 2020 11:43:57 +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 D2EA74CAA0; Wed, 6 May 2020 11:43:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 046BgT89026736 for ; Wed, 6 May 2020 07:42:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 833201002389; Wed, 6 May 2020 11:42:29 +0000 (UTC) Received: from ibm-p8-15-fsp.mgmt.pnr.lab.eng.rdu2.redhat.com (unknown [10.40.195.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id C223710013D9; Wed, 6 May 2020 11:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588765444; 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=CSQUJPuShq6WMAsZ5pwLwISBDjh8EsKOFOIkzVg8Yqg=; b=HmcvJDRzl87pWwalBUB51FuXNo/ucUNKB4WIcCSLTd5KKhyvuSTzdN4kG3osUOITmUvkQz 4J103Dpppi9pccuAWYWzhD4NNO2ePKy7IkFASOHBvm8yoiuCsdsIstnMm2Q2WcFnPLFyaD WSsoVhcy5VP5/kwzZVvjxqyqXKNZ8Zw= X-MC-Unique: cX36qWV5PIOkzGSziKmN8g-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH v2 01/10] qemu: block: factor implementation out of qemuDomainBlockCommit() Date: Wed, 6 May 2020 13:42:17 +0200 Message-Id: <20200506114226.2538196-2-pmores@redhat.com> In-Reply-To: <20200506114226.2538196-1-pmores@redhat.com> References: <20200506114226.2538196-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.16 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" We'll need blockcommit to be callable from within the QEMU driver where we have no virDomain instance available, just virDomainObj. Signed-off-by: Pavel Mores --- src/qemu/qemu_driver.c | 78 ++++++++++++++++++++++++++++-------------- 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1c7c87128d..b642b24fa2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -154,6 +154,15 @@ static int qemuOpenFileAs(uid_t fallback_uid, gid_t fa= llback_gid, =20 static virQEMUDriverPtr qemu_driver; =20 +static int +qemuDomainBlockCommitImpl(virDomainObjPtr vm, + virQEMUDriverPtr driver, + const char *path, + const char *base, + const char *top, + unsigned long bandwidth, + 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. */ @@ -18431,18 +18440,16 @@ qemuDomainBlockPull(virDomainPtr dom, const char = *path, unsigned long bandwidth, return qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags); } =20 - static int -qemuDomainBlockCommit(virDomainPtr dom, - const char *path, - const char *base, - const char *top, - unsigned long bandwidth, - unsigned int flags) +qemuDomainBlockCommitImpl(virDomainObjPtr vm, + virQEMUDriverPtr driver, + const char *path, + const char *base, + const char *top, + unsigned long bandwidth, + unsigned int flags) { - virQEMUDriverPtr driver =3D dom->conn->privateData; - qemuDomainObjPrivatePtr priv; - virDomainObjPtr vm =3D NULL; + qemuDomainObjPrivatePtr priv =3D vm->privateData; const char *device =3D NULL; const char *jobname =3D NULL; int ret =3D -1; @@ -18466,22 +18473,6 @@ qemuDomainBlockCommit(virDomainPtr dom, g_autoptr(virJSONValue) bitmapDisableActions =3D NULL; VIR_AUTOSTRINGLIST bitmapDisableList =3D NULL; =20 - virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | - VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | - VIR_DOMAIN_BLOCK_COMMIT_RELATIVE | - VIR_DOMAIN_BLOCK_COMMIT_DELETE | - VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, -1); - - if (!(vm =3D qemuDomainObjFromDomain(dom))) - goto cleanup; - priv =3D vm->privateData; - - if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) - goto cleanup; - - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) - goto cleanup; - if (virDomainObjCheckActive(vm) < 0) goto endjob; =20 @@ -18730,6 +18721,40 @@ qemuDomainBlockCommit(virDomainPtr dom, virErrorRestore(&orig_err); } qemuBlockJobStartupFinalize(vm, job); + + return ret; +} + + +static int +qemuDomainBlockCommit(virDomainPtr dom, + const char *path, + const char *base, + const char *top, + unsigned long bandwidth, + unsigned int flags) +{ + virQEMUDriverPtr driver =3D dom->conn->privateData; + virDomainObjPtr vm =3D NULL; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | + VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | + VIR_DOMAIN_BLOCK_COMMIT_RELATIVE | + VIR_DOMAIN_BLOCK_COMMIT_DELETE | + VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES, -1); + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + goto cleanup; + + if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + ret =3D qemuDomainBlockCommitImpl(vm, driver, path, base, top, bandwid= th, flags); + qemuDomainObjEndJob(driver, vm); =20 cleanup: @@ -18737,6 +18762,7 @@ qemuDomainBlockCommit(virDomainPtr dom, return ret; } =20 + static int qemuDomainOpenGraphics(virDomainPtr dom, unsigned int idx, --=20 2.24.1