From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 1636622150451756.6716401505481; Thu, 11 Nov 2021 01:15:50 -0800 (PST) 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-86-1gfTYlN1O6ePsW04JxXG3A-1; Thu, 11 Nov 2021 04:15:45 -0500 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 8A13818A0F3D; Thu, 11 Nov 2021 09:15:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C25967841; Thu, 11 Nov 2021 09:15:40 +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 3E1041800FDD; Thu, 11 Nov 2021 09:15:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9BxmU027423 for ; Thu, 11 Nov 2021 04:11:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5F802404727C; Thu, 11 Nov 2021 09:11:59 +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 5BF5B4047279 for ; Thu, 11 Nov 2021 09:11:59 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 433538001EA for ; Thu, 11 Nov 2021 09:11:59 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-A8n1gFTXMWKONBMXcCXkaQ-1; Thu, 11 Nov 2021 04:11:57 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-BV for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: 1gfTYlN1O6ePsW04JxXG3A-1 X-MC-Unique: A8n1gFTXMWKONBMXcCXkaQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 1/9] qemu: make snap possibility check before pausing CPUS Date: Thu, 11 Nov 2021 11:55:46 +0300 Message-Id: <20211111085554.14685-2-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.84 on 10.11.54.2 X-loop: libvir-list@redhat.com 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 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: 1636622151314100001 Content-Type: text/plain; charset="utf-8" This way we won't unnecessaryly pause VMs. Looks like pausing does not afect qemuMigrationSrcIsAllowed checks so we can check without pausing. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index d105eead27..007c55b82a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1363,6 +1363,10 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driv= er, virQEMUSaveData *data =3D NULL; g_autoptr(GHashTable) blockNamedNodeData =3D NULL; =20 + /* check if migration is possible */ + if (memory && !qemuMigrationSrcIsAllowed(driver, vm, false, 0)) + return -1; + /* If quiesce was requested, then issue a freeze command, and a * counterpart thaw command when it is actually sent to agent. * The command will fail if the guest is paused or the guest agent @@ -1423,10 +1427,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driv= er, =20 /* do the memory snapshot if necessary */ if (memory) { - /* check if migration is possible */ - if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) - goto cleanup; - priv->job.current->statsType =3D QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDU= MP; =20 /* allow the migration job to be cancelled or the domain to be pau= sed */ --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 1636622115330284.78548086831574; Thu, 11 Nov 2021 01:15:15 -0800 (PST) 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-422-KBnDkXriON-vcjGArM1E1w-1; Thu, 11 Nov 2021 04:15:12 -0500 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 DFAFB19067EF; Thu, 11 Nov 2021 09:15:07 +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 A2F9F7B6DA; Thu, 11 Nov 2021 09:15:04 +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 B06B24E9F4; Thu, 11 Nov 2021 09:15:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9CFkW027520 for ; Thu, 11 Nov 2021 04:12:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4035A404727D; Thu, 11 Nov 2021 09:12:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CAD64047279 for ; Thu, 11 Nov 2021 09:12:15 +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 253061066682 for ; Thu, 11 Nov 2021 09:12:15 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-KWoucqBzPSiIKCA4jZYvvQ-1; Thu, 11 Nov 2021 04:12:13 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-DF for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: KBnDkXriON-vcjGArM1E1w-1 X-MC-Unique: KWoucqBzPSiIKCA4jZYvvQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 2/9] qemu: snapshot: remove redundant flag setting Date: Thu, 11 Nov 2021 11:55:47 +0300 Message-Id: <20211111085554.14685-3-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.84 on 10.11.54.2 X-loop: libvir-list@redhat.com 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 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: 1636622116374100001 Content-Type: text/plain; charset="utf-8" It is already set above. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_snapshot.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 007c55b82a..aa9b2ebbd9 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1413,8 +1413,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, _("guest unexpectedly quit")); goto cleanup; } - - resume =3D true; } } =20 --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 1636621934640248.1998095659144; Thu, 11 Nov 2021 01:12:14 -0800 (PST) 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-524-G_59KZ4mP4ugsa7TRaEgVw-1; Thu, 11 Nov 2021 04:12:10 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 79241871254; Thu, 11 Nov 2021 09:12:04 +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 466C61973B; Thu, 11 Nov 2021 09:12:04 +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 290AE4A703; Thu, 11 Nov 2021 09:12:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9BxQ4027424 for ; Thu, 11 Nov 2021 04:11:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8F2B951E3; Thu, 11 Nov 2021 09:11:59 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89C8051E2 for ; Thu, 11 Nov 2021 09:11:56 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 A4412811E7F for ; Thu, 11 Nov 2021 09:11:56 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-ezB4EA7CPB2tFj1KJcCBgQ-1; Thu, 11 Nov 2021 04:11:54 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-G8 for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: G_59KZ4mP4ugsa7TRaEgVw-1 X-MC-Unique: ezB4EA7CPB2tFj1KJcCBgQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 3/9] qemu: don't bother saving ret code from qemuDomainSaveMemory Date: Thu, 11 Nov 2021 11:55:48 +0300 Message-Id: <20211111085554.14685-4-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.23 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: 1636621936195100001 Content-Type: text/plain; charset="utf-8" It does not make a difference. qemuDomainSaveMemory ret code is either 0 or -1. If it is -1 then ret is already set to -1. If it is 0 then it is overwritten by qemuSnapshotCreateActiveExternalDisks anyway. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index aa9b2ebbd9..8656affa25 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1451,9 +1451,9 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, =20 memory_existing =3D virFileExists(snapdef->memorysnapshotfile); =20 - if ((ret =3D qemuSaveImageCreate(driver, vm, snapdef->memorysnapsh= otfile, - data, compressor, 0, - QEMU_ASYNC_JOB_SNAPSHOT)) < 0) + if (qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile, + data, compressor, 0, + QEMU_ASYNC_JOB_SNAPSHOT) < 0) goto cleanup; =20 /* the memory image was created, remove it on errors */ --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636622153686262.4935695216932; Thu, 11 Nov 2021 01:15:53 -0800 (PST) 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-479-mh00JWPjOJyZjP2kLwbM4g-1; Thu, 11 Nov 2021 04:15:49 -0500 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 69EDC87D56C; Thu, 11 Nov 2021 09:15:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C44D4180; Thu, 11 Nov 2021 09:15:43 +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 20CBC181A1D1; Thu, 11 Nov 2021 09:15:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9C4Fh027451 for ; Thu, 11 Nov 2021 04:12:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F50B112131B; Thu, 11 Nov 2021 09:12:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A6821121314 for ; Thu, 11 Nov 2021 09:12:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 C4C968027FB for ; Thu, 11 Nov 2021 09:12:03 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-338-tZgUhWB1NaCYd8-h8e-7tg-1; Thu, 11 Nov 2021 04:12:02 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-Ik for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: mh00JWPjOJyZjP2kLwbM4g-1 X-MC-Unique: tZgUhWB1NaCYd8-h8e-7tg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 4/9] qemu: move virQEMUSaveDataFree auto decl to header Date: Thu, 11 Nov 2021 11:55:49 +0300 Message-Id: <20211111085554.14685-5-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com 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 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: 1636622155532100001 Content-Type: text/plain; charset="utf-8" In order to use it in qemu_driver.c which has of plenty of virQEMUSaveDataFree calls. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_saveimage.c | 1 - src/qemu/qemu_saveimage.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index e14e2987f1..e03b79c303 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -88,7 +88,6 @@ virQEMUSaveDataFree(virQEMUSaveData *data) g_free(data); } =20 -G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUSaveData, virQEMUSaveDataFree); =20 /** * This function steals @domXML on success. diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h index 45c5f35e11..0710426742 100644 --- a/src/qemu/qemu_saveimage.h +++ b/src/qemu/qemu_saveimage.h @@ -112,3 +112,4 @@ virQEMUSaveDataNew(char *domXML, =20 void virQEMUSaveDataFree(virQEMUSaveData *data); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUSaveData, virQEMUSaveDataFree); --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1636622207463552.7138676009437; Thu, 11 Nov 2021 01:16:47 -0800 (PST) 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-477-yQ2fIeOSPtmnPTTUP7Rrug-1; Thu, 11 Nov 2021 04:16:44 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38BE2100CFAF; Thu, 11 Nov 2021 09:16:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C69A5BAE2; Thu, 11 Nov 2021 09:16:39 +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 E43391832DD7; Thu, 11 Nov 2021 09:16:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9CFPp027529 for ; Thu, 11 Nov 2021 04:12:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id A5F472026D5D; Thu, 11 Nov 2021 09:12:15 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A16692026D48 for ; Thu, 11 Nov 2021 09:12:10 +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 8FD45181B7A0 for ; Thu, 11 Nov 2021 09:12:10 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-163-Y0vQFDYdOZOnxBBe6j17UA-1; Thu, 11 Nov 2021 04:12:08 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-Lo for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: yQ2fIeOSPtmnPTTUP7Rrug-1 X-MC-Unique: Y0vQFDYdOZOnxBBe6j17UA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 5/9] qemu: factor out qemuDomainSnapshotSaveMemory Date: Thu, 11 Nov 2021 11:55:50 +0300 Message-Id: <20211111085554.14685-6-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.78 on 10.11.54.4 X-loop: libvir-list@redhat.com 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.13 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: 1636622208611100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_snapshot.c | 83 ++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 34 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 8656affa25..7e4dadb876 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1339,6 +1339,54 @@ qemuSnapshotCreateActiveExternalDisks(virDomainObj *= vm, return 0; } =20 +static int +qemuSnapshotSaveMemory(virQEMUDriver *driver, + virDomainObj *vm, + virDomainSnapshotDef *snapdef, + bool running, + virQEMUDriverConfig *cfg) +{ + qemuDomainObjPrivate *priv =3D vm->privateData; + g_autoptr(virCommand) compressor =3D NULL; + g_autoptr(virQEMUSaveData) data =3D NULL; + g_autofree char *xml =3D NULL; + int compressed; + + priv->job.current->statsType =3D QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDUMP; + + /* allow the migration job to be cancelled or the domain to be paused = */ + qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK | + JOB_MASK(QEMU_JOB_SUSPEND) | + JOB_MASK(QEMU_JOB_MIGRATION_OP))); + + if ((compressed =3D qemuSaveImageGetCompressionProgram(cfg->snapshotIm= ageFormat, + &compressor, + "snapshot", false= )) < 0) + return -1; + + if (!(xml =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, + vm->def, priv->origCPU, + true, true)) || + !(snapdef->cookie =3D (virObject *) qemuDomainSaveCookieNew(vm))) + return -1; + + if (!(data =3D virQEMUSaveDataNew(xml, + (qemuDomainSaveCookie *) snapdef->cook= ie, + running, compressed, driver->xmlopt))) + return -1; + xml =3D NULL; + + if (qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile, + data, compressor, 0, + QEMU_ASYNC_JOB_SNAPSHOT) < 0) + return -1; + + /* forbid any further manipulation */ + qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK); + + return 0; +} + =20 static int qemuSnapshotCreateActiveExternal(virQEMUDriver *driver, @@ -1351,16 +1399,12 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *dri= ver, bool resume =3D false; int ret =3D -1; qemuDomainObjPrivate *priv =3D vm->privateData; - g_autofree char *xml =3D NULL; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); bool memory =3D snapdef->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EX= TERNAL; bool memory_unlink =3D false; bool memory_existing =3D false; bool thaw =3D false; bool pmsuspended =3D false; - int compressed; - g_autoptr(virCommand) compressor =3D NULL; - virQEMUSaveData *data =3D NULL; g_autoptr(GHashTable) blockNamedNodeData =3D NULL; =20 /* check if migration is possible */ @@ -1425,43 +1469,15 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *dri= ver, =20 /* do the memory snapshot if necessary */ if (memory) { - priv->job.current->statsType =3D QEMU_DOMAIN_JOB_STATS_TYPE_SAVEDU= MP; - - /* allow the migration job to be cancelled or the domain to be pau= sed */ - qemuDomainObjSetAsyncJobMask(vm, (QEMU_JOB_DEFAULT_MASK | - JOB_MASK(QEMU_JOB_SUSPEND) | - JOB_MASK(QEMU_JOB_MIGRATION_OP))= ); - - if ((compressed =3D qemuSaveImageGetCompressionProgram(cfg->snapsh= otImageFormat, - &compressor, - "snapshot", f= alse)) < 0) - goto cleanup; - - if (!(xml =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, - vm->def, priv->origCPU, - true, true)) || - !(snapdef->cookie =3D (virObject *) qemuDomainSaveCookieNew(vm= ))) - goto cleanup; - - if (!(data =3D virQEMUSaveDataNew(xml, - (qemuDomainSaveCookie *) snapdef->= cookie, - resume, compressed, driver->xmlopt= ))) - goto cleanup; - xml =3D NULL; - memory_existing =3D virFileExists(snapdef->memorysnapshotfile); =20 - if (qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile, - data, compressor, 0, - QEMU_ASYNC_JOB_SNAPSHOT) < 0) + if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, cfg) < 0) goto cleanup; =20 /* the memory image was created, remove it on errors */ if (!memory_existing) memory_unlink =3D true; =20 - /* forbid any further manipulation */ - qemuDomainObjSetAsyncJobMask(vm, QEMU_JOB_DEFAULT_MASK); } =20 /* the domain is now paused if a memory snapshot was requested */ @@ -1521,7 +1537,6 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, qemuDomainObjEndAgentJob(vm); } =20 - virQEMUSaveDataFree(data); if (memory_unlink && ret < 0) unlink(snapdef->memorysnapshotfile); =20 --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163662210950844.13660178212808; Thu, 11 Nov 2021 01:15:09 -0800 (PST) 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-83-nVJB-3sPM2ybraC3OPOidQ-1; Thu, 11 Nov 2021 04:15:04 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75D7A18A074B; Thu, 11 Nov 2021 09:14:59 +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 930166107E; Thu, 11 Nov 2021 09:14: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 3F9DF4A704; Thu, 11 Nov 2021 09:14:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9C6fO027474 for ; Thu, 11 Nov 2021 04:12:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 23A66404727C; Thu, 11 Nov 2021 09:12:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2024D4047279 for ; Thu, 11 Nov 2021 09:12:06 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 08C35185A7B2 for ; Thu, 11 Nov 2021 09:12:06 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-FlaPReQ5O_2kuhjihh9XTA-1; Thu, 11 Nov 2021 04:12:04 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-OQ for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: nVJB-3sPM2ybraC3OPOidQ-1 X-MC-Unique: FlaPReQ5O_2kuhjihh9XTA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 6/9] qemu: introduce qemuMigrationParamsSetCapability Date: Thu, 11 Nov 2021 11:55:51 +0300 Message-Id: <20211111085554.14685-7-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.84 on 10.11.54.2 X-loop: libvir-list@redhat.com 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.12 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: 1636622111676100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_migration_params.c | 12 ++++++++++++ src/qemu/qemu_migration_params.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index b6c582aaca..11081dc11c 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1125,6 +1125,18 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migPa= rams, } =20 =20 +void +qemuMigrationParamsSetCapability(qemuMigrationParams *migParams, + qemuMigrationCapability cap, + bool value) +{ + if (value) + ignore_value(virBitmapSetBit(migParams->caps, cap)); + else + ignore_value(virBitmapClearBit(migParams->caps, cap)); +} + + /** * qemuMigrationParamsCheck: * diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index f770bd2576..5ca171226f 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -133,6 +133,10 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migPara= ms, unsigned long long *value); =20 void +qemuMigrationParamsSetCapability(qemuMigrationParams *migParams, + qemuMigrationCapability cap, + bool value); +void qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParams *migPara= ms, virJSONValue **params); =20 --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 163662219739442.333567033213626; Thu, 11 Nov 2021 01:16:37 -0800 (PST) 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-74-gn996VPdOfSChmTqFurxTw-1; Thu, 11 Nov 2021 04:16:34 -0500 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 E0CBE19057A2; Thu, 11 Nov 2021 09:16:29 +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 C265918A8F; Thu, 11 Nov 2021 09:16:29 +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 7E06A4EA2A; Thu, 11 Nov 2021 09:16:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9C4v4027452 for ; Thu, 11 Nov 2021 04:12:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F15B1121319; Thu, 11 Nov 2021 09:12:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A6CE1121318 for ; Thu, 11 Nov 2021 09:12:01 +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 7E53C1066681 for ; Thu, 11 Nov 2021 09:12:01 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-417-DcajHqz5Pw2xZfWRbcLYRg-1; Thu, 11 Nov 2021 04:11:59 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-Pl for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: gn996VPdOfSChmTqFurxTw-1 X-MC-Unique: DcajHqz5Pw2xZfWRbcLYRg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 7/9] qemu: support instant mode in qemuMigrationSrcToFile Date: Thu, 11 Nov 2021 11:55:52 +0300 Message-Id: <20211111085554.14685-8-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.78 on 10.11.54.3 X-loop: libvir-list@redhat.com 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 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: 1636622198116100001 Content-Type: text/plain; charset="utf-8" We only need to turn QEMU_MIGRATION_CAP_BACKGROUND_SNAPSHOT migration capabiliti for this. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration.c | 20 +++++++++++++++----- src/qemu/qemu_migration.h | 1 + src/qemu/qemu_migration_params.c | 1 + src/qemu/qemu_migration_params.h | 1 + src/qemu/qemu_saveimage.c | 3 ++- src/qemu/qemu_saveimage.h | 1 + src/qemu/qemu_snapshot.c | 5 +++-- 8 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6a77d9f513..8edc38d343 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2855,7 +2855,7 @@ qemuDomainSaveInternal(virQEMUDriver *driver, xml =3D NULL; =20 ret =3D qemuSaveImageCreate(driver, vm, path, data, compressor, - flags, QEMU_ASYNC_JOB_SAVE); + flags, false, QEMU_ASYNC_JOB_SAVE); if (ret < 0) goto endjob; =20 @@ -3238,7 +3238,7 @@ doCoreDump(virQEMUDriver *driver, if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0)) goto cleanup; =20 - rc =3D qemuMigrationSrcToFile(driver, vm, fd, compressor, + rc =3D qemuMigrationSrcToFile(driver, vm, fd, compressor, false, QEMU_ASYNC_JOB_DUMP); } =20 diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 9729041846..18a01df3d0 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5898,6 +5898,7 @@ int qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, int fd, virCommand *compressor, + bool instant, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -5924,6 +5925,11 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDom= ainObj *vm, QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024= * 1024) < 0) return -1; =20 + if (instant) + qemuMigrationParamsSetCapability(migParams, + QEMU_MIGRATION_CAP_BACKGROUND= _SNAPSHOT, + true); + if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0) return -1; =20 @@ -6018,11 +6024,15 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDo= mainObj *vm, /* Restore max migration bandwidth */ if (virDomainObjIsActive(vm)) { if (bwParam) { - if (qemuMigrationParamsSetULL(migParams, - QEMU_MIGRATION_PARAM_MAX_BANDWID= TH, - saveMigBandwidth * 1024 * 1024) = =3D=3D 0) - ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob, - migParams)); + qemuMigrationParamsSetULL(migParams, + QEMU_MIGRATION_PARAM_MAX_BANDWIDTH, + saveMigBandwidth * 1024 * 1024); + if (instant) + qemuMigrationParamsSetCapability(migParams, + QEMU_MIGRATION_CAP_BACKGR= OUND_SNAPSHOT, + false); + ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob, + migParams)); } else { if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) =3D= =3D 0) { qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth); diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h index dd74f8bc88..9d91fbc882 100644 --- a/src/qemu/qemu_migration.h +++ b/src/qemu/qemu_migration.h @@ -209,6 +209,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm, int fd, virCommand *compressor, + bool instant, qemuDomainAsyncJob asyncJob) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index 11081dc11c..148aa2d12d 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -90,6 +90,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, "late-block-activate", "multifd", "dirty-bitmaps", + "background-snapshot", ); =20 =20 diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_par= ams.h index 5ca171226f..844ebf92eb 100644 --- a/src/qemu/qemu_migration_params.h +++ b/src/qemu/qemu_migration_params.h @@ -40,6 +40,7 @@ typedef enum { QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE, QEMU_MIGRATION_CAP_MULTIFD, QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS, + QEMU_MIGRATION_CAP_BACKGROUND_SNAPSHOT, =20 QEMU_MIGRATION_CAP_LAST } qemuMigrationCapability; diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index e03b79c303..b2b48610e6 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -258,6 +258,7 @@ qemuSaveImageCreate(virQEMUDriver *driver, virQEMUSaveData *data, virCommand *compressor, unsigned int flags, + bool instant, qemuDomainAsyncJob asyncJob) { g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); @@ -295,7 +296,7 @@ qemuSaveImageCreate(virQEMUDriver *driver, goto cleanup; =20 /* Perform the migration */ - if (qemuMigrationSrcToFile(driver, vm, fd, compressor, asyncJob) < 0) + if (qemuMigrationSrcToFile(driver, vm, fd, compressor, instant, asyncJ= ob) < 0) goto cleanup; =20 /* Touch up file header to mark image complete. */ diff --git a/src/qemu/qemu_saveimage.h b/src/qemu/qemu_saveimage.h index 0710426742..2e87d6485a 100644 --- a/src/qemu/qemu_saveimage.h +++ b/src/qemu/qemu_saveimage.h @@ -96,6 +96,7 @@ qemuSaveImageCreate(virQEMUDriver *driver, virQEMUSaveData *data, virCommand *compressor, unsigned int flags, + bool instant, qemuDomainAsyncJob asyncJob); =20 int diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 7e4dadb876..b521634f2a 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1344,6 +1344,7 @@ qemuSnapshotSaveMemory(virQEMUDriver *driver, virDomainObj *vm, virDomainSnapshotDef *snapdef, bool running, + bool instant, virQEMUDriverConfig *cfg) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -1377,7 +1378,7 @@ qemuSnapshotSaveMemory(virQEMUDriver *driver, xml =3D NULL; =20 if (qemuSaveImageCreate(driver, vm, snapdef->memorysnapshotfile, - data, compressor, 0, + data, compressor, 0, instant, QEMU_ASYNC_JOB_SNAPSHOT) < 0) return -1; =20 @@ -1471,7 +1472,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, if (memory) { memory_existing =3D virFileExists(snapdef->memorysnapshotfile); =20 - if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, cfg) < 0) + if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, false, cfg= ) < 0) goto cleanup; =20 /* the memory image was created, remove it on errors */ --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 1636622203398245.167409471047; Thu, 11 Nov 2021 01:16:43 -0800 (PST) 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-100-F0oao-g-PO65u2NTtmk4Jg-1; Thu, 11 Nov 2021 04:16:38 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45E78804148; Thu, 11 Nov 2021 09:16:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2688960CCC; Thu, 11 Nov 2021 09:16:34 +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 EDAC21819AC1; Thu, 11 Nov 2021 09:16:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9C9fo027498 for ; Thu, 11 Nov 2021 04:12:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 929AE51E3; Thu, 11 Nov 2021 09:12:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D1E751E2 for ; Thu, 11 Nov 2021 09:12:08 +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 73BA3801212 for ; Thu, 11 Nov 2021 09:12:08 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-0YhCx8icOaCrxghtV7wC0A-1; Thu, 11 Nov 2021 04:12:06 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-Sd for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:55 +0300 X-MC-Unique: F0oao-g-PO65u2NTtmk4Jg-1 X-MC-Unique: 0YhCx8icOaCrxghtV7wC0A-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 8/9] qemu: support instant snapshots Date: Thu, 11 Nov 2021 11:55:53 +0300 Message-Id: <20211111085554.14685-9-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com 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.12 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: 1636622204319100001 Content-Type: text/plain; charset="utf-8" Usual snapshot with memory of a running domain with first saves domain memory to disk and then make a disk snapshot. As result we get snapshot at moment in time much later then client asked for snapshot if domain memory is large. So basically you need to wait several minutes or even several tens of minutes before making guest unsafe changes. This patch adds instant mode to snapshot with memory of a running domain. In this mode snapshot is done almost at the moment of client request. It does not depends of domain memory size. So client can proceed with unsafe changes immediately (We need an event to notify client though as snapshot API itself is still synchronous and API will finish when domain memory will be stored to disk). I dared to call this snapshot mode instant instead of background as it named in QEMU. IMHO in case of libvirt API name background be confused with asynchronous snapshot API which is not true. Instant mode basically just stops guest CPUs, makes disks snapshot and then start QEMU's background memory snapshot. Background here means if guest writes some region in memory then this memory first is written to disk so that eventually domain memory written to disk corresponds to moment of starting background snapshot. Note that background snapshot starts guest CPUs right after snapshot start and do not stop CPUs after snapshot is finished unlikely to usual memory snapshots or migration. Nevertheless qemuSnapshotCreateActiveExternal calls qemuProcessStartCPUs in instant mode in order to lock domain images and other tasks we do not do in resume handler. Signed-off-by: Nikolay Shirokovskiy --- include/libvirt/libvirt-domain-snapshot.h | 2 + src/qemu/qemu_snapshot.c | 68 ++++++++++++++++++----- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/include/libvirt/libvirt-domain-snapshot.h b/include/libvirt/li= bvirt-domain-snapshot.h index 90673ed0fb..2661ba2556 100644 --- a/include/libvirt/libvirt-domain-snapshot.h +++ b/include/libvirt/libvirt-domain-snapshot.h @@ -73,6 +73,8 @@ typedef enum { running */ VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE =3D (1 << 9), /* validate the X= ML against the sche= ma */ + VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT =3D (1 << 10),/* snapshot at th= e moment + of call */ } virDomainSnapshotCreateFlags; =20 /* Take a snapshot of the current VM state */ diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index b521634f2a..14c4a64d52 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1398,6 +1398,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, { virObjectEvent *event; bool resume =3D false; + bool instant =3D false; int ret =3D -1; qemuDomainObjPrivate *priv =3D vm->privateData; virDomainSnapshotDef *snapdef =3D virDomainSnapshotObjGetDef(snap); @@ -1442,13 +1443,25 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *dri= ver, if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_PMSUSPENDED) { pmsuspended =3D true; } else if (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { + if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT) { + if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_BACKGROUND_SN= APSHOT)) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("Migration option 'background-snapshot'" + " is not supported by QEMU binary")); + goto cleanup; + } + + instant =3D true; + } + /* For full system external snapshots (those with memory), the gue= st * must pause (either by libvirt up front, or by qemu after * _LIVE converges). */ if (memory) resume =3D true; =20 - if (memory && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE)) { + if (memory && + (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_LIVE) || instant)) { if (qemuProcessStopCPUs(driver, vm, VIR_DOMAIN_PAUSED_SNAPSHOT, QEMU_ASYNC_JOB_SNAPSHOT) < 0) goto cleanup; @@ -1472,21 +1485,39 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *dri= ver, if (memory) { memory_existing =3D virFileExists(snapdef->memorysnapshotfile); =20 - if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, false, cfg= ) < 0) - goto cleanup; + if (instant) { + if ((ret =3D qemuSnapshotCreateActiveExternalDisks(vm, snap, + blockNamedNod= eData, flags, + QEMU_ASYNC_JO= B_SNAPSHOT)) < 0) + goto cleanup; =20 - /* the memory image was created, remove it on errors */ - if (!memory_existing) - memory_unlink =3D true; + if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, true, = cfg) < 0) + goto cleanup; =20 - } + /* the memory image was created, remove it on errors */ + if (!memory_existing) + memory_unlink =3D true; + } else { + if (qemuSnapshotSaveMemory(driver, vm, snapdef, resume, false,= cfg) < 0) + goto cleanup; =20 - /* the domain is now paused if a memory snapshot was requested */ + /* the memory image was created, remove it on errors */ + if (!memory_existing) + memory_unlink =3D true; =20 - if ((ret =3D qemuSnapshotCreateActiveExternalDisks(vm, snap, - blockNamedNodeData, f= lags, - QEMU_ASYNC_JOB_SNAPSH= OT)) < 0) - goto cleanup; + /* the domain is now paused if a memory snapshot was requested= */ + if ((ret =3D qemuSnapshotCreateActiveExternalDisks(vm, snap, + blockNamedNod= eData, flags, + QEMU_ASYNC_JO= B_SNAPSHOT)) < 0) + goto cleanup; + } + } else { + /* the domain is now paused if a memory snapshot was requested */ + if ((ret =3D qemuSnapshotCreateActiveExternalDisks(vm, snap, + blockNamedNodeDat= a, flags, + QEMU_ASYNC_JOB_SN= APSHOT)) < 0) + goto cleanup; + } =20 /* the snapshot is complete now */ if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_HALT) { @@ -1575,7 +1606,8 @@ qemuSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE | VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC | VIR_DOMAIN_SNAPSHOT_CREATE_LIVE | - VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE, NULL); + VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE | + VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT, NULL); =20 VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE, VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, @@ -1584,6 +1616,16 @@ qemuSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, NULL); =20 + VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT, + VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY, + NULL); + VIR_EXCLUSIVE_FLAGS_RET(VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT, + VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE, + NULL); + VIR_REQUIRE_FLAG_RET(VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT, + VIR_DOMAIN_SNAPSHOT_CREATE_LIVE, + NULL); + if ((redefine && !(flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) || (flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) update_current =3D false; --=20 2.27.0 From nobody Tue Apr 30 04:36:04 2024 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=quarantine dis=quarantine) header.from=virtuozzo.com 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 1636621933682927.0356742100948; Thu, 11 Nov 2021 01:12:13 -0800 (PST) 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-520-GQV-FhUWMVeampRQG5LlrQ-1; Thu, 11 Nov 2021 04:12:09 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4E3E802B78; Thu, 11 Nov 2021 09:12:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B0701048127; Thu, 11 Nov 2021 09:12:02 +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 B99081819AC1; Thu, 11 Nov 2021 09:11:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AB9Bu57027405 for ; Thu, 11 Nov 2021 04:11:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 64A4B2026D5D; Thu, 11 Nov 2021 09:11:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6020A2026D48 for ; Thu, 11 Nov 2021 09:11:53 +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 5CD46811E81 for ; Thu, 11 Nov 2021 09:11:53 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-EePV1YAWMAal8BAUucFPAA-1; Thu, 11 Nov 2021 04:11:50 -0500 Received: from [10.28.15.237] (helo=vz8.sw.ru) by relay.sw.ru with esmtp (Exim 4.94.2) (envelope-from ) id 1ml5sB-008xIO-VW for libvir-list@redhat.com; Thu, 11 Nov 2021 11:55:56 +0300 X-MC-Unique: GQV-FhUWMVeampRQG5LlrQ-1 X-MC-Unique: EePV1YAWMAal8BAUucFPAA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 9/9] virsh: add --instant flag to snapshot-create Date: Thu, 11 Nov 2021 11:55:54 +0300 Message-Id: <20211111085554.14685-10-nshirokovskiy@virtuozzo.com> In-Reply-To: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> References: <20211111085554.14685-1-nshirokovskiy@virtuozzo.com> 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.78 on 10.11.54.4 X-loop: libvir-list@redhat.com 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.84 on 10.5.11.22 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: 1636621936196100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- docs/manpages/virsh.rst | 8 +++++++- tools/virsh-snapshot.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 5f5ccfeafe..64f0eec4a2 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -6948,7 +6948,7 @@ snapshot-create =20 snapshot-create domain [xmlfile] {[--redefine [--current]] | [--no-metadata] [--halt] [--disk-only] [--reuse-external] - [--quiesce] [--atomic] [--live]} [--validate] + [--quiesce] [--atomic] [--live]} [--validate] [--instant] =20 Create a snapshot for domain *domain* with the properties specified in *xmlfile*. Optionally, the *--validate* option can be passed to @@ -7010,6 +7010,12 @@ the guest is running. Both disk snapshot and domain = memory snapshot are taken. This increases the size of the memory image of the external snapshot. This is currently supported only for full system external snapsh= ots. =20 +If *--instant* is specified then snapshot will be at the moment the +snapshot is called. Ordinary snapshot is done at the moment the call +is finished. The time difference can be significant if domain memory +is large. The flag only makes sense in case of snapshots with memory. + + Existence of snapshot metadata will prevent attempts to ``undefine`` a persistent guest. However, for transient domains, snapshot metadata is silently lost when the domain quits running (whether diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 154e82b48b..72ed1b2a52 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -152,6 +152,10 @@ static const vshCmdOptDef opts_snapshot_create[] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("validate the XML against the schema"), }, + {.name =3D "instant", + .type =3D VSH_OT_BOOL, + .help =3D N_("snapshot at the moment of call"), + }, {.name =3D NULL} }; =20 @@ -183,6 +187,8 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_LIVE; if (vshCommandOptBool(cmd, "validate")) flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE; + if (vshCommandOptBool(cmd, "instant")) + flags |=3D VIR_DOMAIN_SNAPSHOT_CREATE_INSTANT; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; --=20 2.27.0