From nobody Tue Feb 10 20:48:09 2026 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=openvz.org 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 1648725594908365.19896329015694; Thu, 31 Mar 2022 04:19:54 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-134-CBA3Y1g-OvmSyhKUHEVdxw-1; Thu, 31 Mar 2022 07:19:52 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76E892803592; Thu, 31 Mar 2022 11:19:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30FB9401E67; Thu, 31 Mar 2022 11:19:49 +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 EAD041947BBB; Thu, 31 Mar 2022 11:19:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 95BAC19451F3 for ; Thu, 31 Mar 2022 11:19:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8B0685B158F; Thu, 31 Mar 2022 11:19:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 873B05B158B for ; Thu, 31 Mar 2022 11:19:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6E84F82A682 for ; Thu, 31 Mar 2022 11:19:46 +0000 (UTC) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-583-XHjp728WNEOz8JuaQxFzZA-1; Thu, 31 Mar 2022 07:19:44 -0400 Received: by mail-lf1-f43.google.com with SMTP id t25so40869964lfg.7 for ; Thu, 31 Mar 2022 04:19:44 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id b24-20020a196458000000b0044ab702b6acsm695653lfj.238.2022.03.31.04.19.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 04:19:42 -0700 (PDT) X-MC-Unique: CBA3Y1g-OvmSyhKUHEVdxw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: XHjp728WNEOz8JuaQxFzZA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AXIZl9qsh06EPXXp7rTaWCYLGqd8QhGF96p2Qupqxio=; b=z8T1ZXI2UW2fizkcnhqYUeGcgPp8ufOQwhOPxcSYieM6xY0rIn0+kBoqawuVSQwIjf TPjULRhoEl0mQT4nHtNgV3uoQTVTvgY5fCQybB5IvcDu1/A4XGBdVsMwkXrrWHdLjyDU cQObUNG9FsFPBFXL+2tZwHmcmDxqu1hWo2whjV5yuIz2QbqhPDaIsP5gAPPHkbmEgXBB 7sDNbwK/A1QdCFL34ebL+TpA7bgsTEFQ8/uH79EwPjLZCl75MA+dYkH5ubefzEYjuGqH HCE9vlG4cOGd7Q2meD6wqUpZ9a76ik4OmENXbN/tCurC/W9B+GWVdoIOmsxuplSm9KMt dVbA== X-Gm-Message-State: AOAM532g8Lon/zxH47ICgBa4QMbubO/I1wVqKp/OyTR1jDXwXcaSZBTL amLKs43FC/2PO+SpDHTnzkr7O4mikh9v7g== X-Google-Smtp-Source: ABdhPJzLCijnKvGuTNuons8BLtzUG9K//1tRpPOlXDYd4Xac/PNb7jsvXcOwA5ztP5zp59EFfOaxTQ== X-Received: by 2002:a05:6512:3e0f:b0:44a:4c09:d506 with SMTP id i15-20020a0565123e0f00b0044a4c09d506mr10614296lfv.598.1648725582650; Thu, 31 Mar 2022 04:19:42 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 05/11] qemu: snapshot: prepare for async snapshot deletion Date: Thu, 31 Mar 2022 14:19:15 +0300 Message-Id: <20220331111921.450496-6-nikolay.shirokovskiy@openvz.org> In-Reply-To: <20220331111921.450496-1-nikolay.shirokovskiy@openvz.org> References: <20220331111921.450496-1-nikolay.shirokovskiy@openvz.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1648725596629100006 Content-Type: text/plain; charset="utf-8"; x-default="true" Use async job instead of regular one as we are going to use async job harness to wait for snapshot-delete job completion in QEMU. We can use VIR_DOMAIN_JOB_OPERATION_UNKNOWN because it is used only when reporting job progress and getting job progress is disabled now for snapshot deletion. It is not clear whether we should add VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_DELETE and report job progress in future as snapshot-deletion should not take much time I guess. Yet using VIR_DOMAIN_JOB_OPERATION_UNKNOWN seems to be brittle. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 878a0abb34..579d744c60 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -177,10 +177,12 @@ qemuSnapshotDiscard(virQEMUDriver *driver, return -1; } else { priv =3D vm->privateData; - qemuDomainObjEnterMonitor(driver, vm); - /* we continue on even in the face of error */ - qemuMonitorDeleteSnapshot(priv->mon, snap->def->name); - qemuDomainObjExitMonitor(vm); + if (qemuDomainObjEnterMonitorAsync(driver, vm, + VIR_ASYNC_JOB_SNAPSHOT) =3D= =3D 0) { + /* we continue on even in the face of error */ + qemuMonitorDeleteSnapshot(priv->mon, snap->def->name); + qemuDomainObjExitMonitor(vm); + } } } =20 @@ -2551,8 +2553,14 @@ qemuSnapshotDelete(virDomainObj *vm, VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY | VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY, -1); =20 - if (qemuDomainObjBeginJob(driver, vm, VIR_JOB_MODIFY) < 0) + /* + * For snapshot deletion quering stats/aborting is not supported yet + * thus disable any parallels jobs. + */ + if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_SNAPSHOT_DELE= TE, + VIR_DOMAIN_JOB_OPERATION_UNKNOWN, flags= ) < 0) return -1; + qemuDomainObjSetAsyncJobMask(vm, VIR_JOB_NONE); =20 if (!(snap =3D qemuSnapObjFromSnapshot(vm, snapshot))) goto endjob; @@ -2624,7 +2632,7 @@ qemuSnapshotDelete(virDomainObj *vm, } =20 endjob: - qemuDomainObjEndJob(vm); + qemuDomainObjEndAsyncJob(vm); =20 return ret; } --=20 2.35.1