From nobody Tue Dec 16 11:09:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1673027548; cv=none; d=zohomail.com; s=zohoarc; b=ZplMAJEZ5xiq1NX8BA1BJwRUd2nsnX7RBCSQsPljD1nTqmcfk3jQjKB7OLeBiWMNyyNRMLWyO701qMpE3MqFtSdZWZegp3PeSG8NW9DaKmsfbLwQ8TdLKHQLFhZC9g5TUZ8BvX1J0HUlbIRaSTptxFmQUJiEIcpd4susPf7Tiac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673027548; h=Content-Type:Content-Transfer-Encoding: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=r+a8T1KNaFS/VkkotGecRAoJ8WoxZgc5wrQtQCovLzc=; b=VYu2mtGIgUNJMAsJWbEmfLC4uqx63vwBKz/P23sPmMrKpA5iFoap+fHgLBhwX3k+2m4Rw8e5ITGGez9pyTU+M3BrSOK2GqkuiRe0+sPjgeg+t7QqKRb2eZIHDLsn942tlBIGjSqnxvAEbh4Z+nJikh1Fd1bSR25YXA6IDB5PoqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1673027548146895.0343795405478; Fri, 6 Jan 2023 09:52:28 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-EJrxzTRCPH-KMPE7Nfm7xA-1; Fri, 06 Jan 2023 12:52:25 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7D52803499; Fri, 6 Jan 2023 17:52:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96E53111F3BB; Fri, 6 Jan 2023 17:52:21 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6CFE319459CA; Fri, 6 Jan 2023 17:52:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BAEA31946586 for ; Fri, 6 Jan 2023 17:52:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AAE9F40C2004; Fri, 6 Jan 2023 17:52:20 +0000 (UTC) Received: from antique-work.redhat.com (ovpn-193-172.brq.redhat.com [10.40.193.172]) by smtp.corp.redhat.com (Postfix) with ESMTP id 497A140C2064 for ; Fri, 6 Jan 2023 17:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673027546; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=r+a8T1KNaFS/VkkotGecRAoJ8WoxZgc5wrQtQCovLzc=; b=ieytmJBK8STKSy70C1aLUeBfHc9qbx6YHKj6ryQD9aAGT7SgVRxsCauQ6k2HhJb6pPRlK4 x2jJgp+yqDq5dG5QixxCc0l69pKLYyB5ec06PWHitSkH0iwz+alrgQEtRCDHwXwc7PzPXD HDQwtSQAEuWOT3kanoB0f8VTIQO2NSY= X-MC-Unique: EJrxzTRCPH-KMPE7Nfm7xA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v3 09/32] qemu_block: introduce qemuBlockFinalize Date: Fri, 6 Jan 2023 18:51:44 +0100 Message-Id: <3c0f93122be6afd09648ca6a4a4f31696e715d21.1673027206.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1673027549012100004 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_block.c | 32 ++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index da3a1e8557..70811aa861 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -3525,3 +3525,35 @@ qemuBlockPivot(virDomainObj *vm, =20 return ret; } + + +/** + * qemuBlockFinalize: + * @vm: domain object + * @job: qemu block job data object + * @asyncJob: qemu async job type + * + * When qemu job is started with autofinalize disabled it will wait in pen= ding + * state for block job finalize to be called manually in order to finish t= he + * job. This is useful when we are running jobs on multiple disks to make + * a synchronization point before we finish. + * + * Return -1 on error, 0 on success. + */ +int +qemuBlockFinalize(virDomainObj *vm, + qemuBlockJobData *job, + virDomainAsyncJob asyncJob) +{ + int ret; + qemuDomainObjPrivate *priv =3D vm->privateData; + + if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) + return -1; + + ret =3D qemuMonitorJobFinalize(priv->mon, job->name); + + qemuDomainObjExitMonitor(vm); + + return ret; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 7b6aec2a7d..c169432d9c 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -293,3 +293,8 @@ qemuBlockPivot(virDomainObj *vm, qemuBlockJobData *job, virDomainAsyncJob asyncJob, virDomainDiskDef *disk); + +int +qemuBlockFinalize(virDomainObj *vm, + qemuBlockJobData *job, + virDomainAsyncJob asyncJob); --=20 2.39.0