From nobody Fri Dec 19 02:51:01 2025 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571415160; cv=none; d=zoho.com; s=zohoarc; b=kzvwLBRuv9cONxf/rHRhumZ+0Cvx7fBKUDLS13Nb3MCaOWr3CI87S6FJ+mHYr46J8UiroA/V2PLnb/sgHZYpHN2pcOHjiBmxuhuR9PL+ognriIQP9m3bUrdLLQLi3Lb1A1yuPEm1tOw7yegCUziAkSpowvP9H/xXNsIW+bi/oiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571415160; 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=AjQQXfH4kbJ104mY+xmRkPd2nTty5X1JSBp/TVe2K2A=; b=cx7wx3nuWGIREvTLOBEAonHIcM48Qq8R+gL3+1E1FlcLfEvBlGcBZ+WzeEvEREXwQ83DWjaurs7qV6lINy4bEvgQ3YnkZ41IibNWXF6fVHagtXC90rxwkX4dvGjwGvW5IMOwoS7+8Y7WHDOHPfLCDxvX/ygCtaLBMSSZ7Kdlvkw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571415160318137.59494622865395; Fri, 18 Oct 2019 09:12:40 -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 9B982307C65B; Fri, 18 Oct 2019 16:12:38 +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 6A98361378; Fri, 18 Oct 2019 16:12:38 +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 20B7F3FB62; Fri, 18 Oct 2019 16:12:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IGCaTP005550 for ; Fri, 18 Oct 2019 12:12:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 90270601B3; Fri, 18 Oct 2019 16:12:36 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5F8660167; Fri, 18 Oct 2019 16:12:35 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 18:11:25 +0200 Message-Id: <17596d07cd532f823e1c22083f6a9897bea37f14.1571414890.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC 40/40] qemu: blockjob: Implement concluded blockjob handler for backup blockjobs 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: , 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.42]); Fri, 18 Oct 2019 16:12:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" After the individual sub-blockjobs of a backup libvirt job finish we must detect it and notify the parent job, so that it can be properly terminated. Signed-off-by: Peter Krempa --- src/qemu/qemu_blockjob.c | 45 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_monitor_json.c | 4 ++++ 2 files changed, 49 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 6f190b3485..acfc07638b 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -27,6 +27,7 @@ #include "qemu_block.h" #include "qemu_domain.h" #include "qemu_alias.h" +#include "qemu_backup.h" #include "conf/domain_conf.h" #include "conf/domain_event.h" @@ -1282,6 +1283,49 @@ qemuBlockJobProcessEventConcludedCreate(virQEMUDrive= rPtr driver, } +static void +qemuBlockJobProcessEventConcludedBackup(virQEMUDriverPtr driver, + virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob, + qemuBlockjobState newstate) +{ + g_autoptr(qemuBlockStorageSourceAttachData) backend =3D NULL; + g_autoptr(virJSONValue) actions =3D NULL; + + qemuBackupNotifyBlockjobEnd(vm, job->data.backup.jobid, job->disk, new= state); + + if (job->data.backup.store && + !(backend =3D qemuBlockStorageSourceDetachPrepare(job->data.backup= .store, NULL))) + return; + + if (job->data.backup.bitmap) { + if (!(actions =3D virJSONValueNewArray())) + return; + + if (qemuMonitorTransactionBitmapRemove(actions, + job->disk->src->nodeformat, + job->data.backup.bitmap) < = 0) + return; + } + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return; + + if (backend) + qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), bac= kend); + + if (actions) + qemuMonitorTransaction(qemuDomainGetMonitor(vm), &actions); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + return; + + if (job->data.backup.store) + qemuDomainStorageSourceAccessRevoke(driver, vm, job->data.backup.s= tore); +} + + static void qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job, virQEMUDriverPtr driver, @@ -1320,6 +1364,7 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlock= JobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_BACKUP: + qemuBlockJobProcessEventConcludedBackup(driver, vm, job, asyncJob,= job->newstate); case QEMU_BLOCKJOB_TYPE_NONE: case QEMU_BLOCKJOB_TYPE_INTERNAL: case QEMU_BLOCKJOB_TYPE_LAST: diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 51603d2631..e4f1db284d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1152,6 +1152,8 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon, type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT; else if (STREQ(type_str, "mirror")) type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; + else if (STREQ(type_str, "backup")) + type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP; switch ((virConnectDomainEventBlockJobStatus) event) { case VIR_DOMAIN_BLOCK_JOB_COMPLETED: @@ -4858,6 +4860,8 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr bloc= kJobs, info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT; else if (STREQ(type, "mirror")) info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY; + else if (STREQ(type, "backup")) + info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP; else info->type =3D VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list