From nobody Fri Dec 19 04:17:25 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=1571415127; cv=none; d=zoho.com; s=zohoarc; b=fXjdjrA+x0PyxbXj3fBvZPsWADL7w6r4Q441mFUXOlwmOMRGT5WPwUxgpRPcubBQcwS3Q5mlQuGHr4Rj2YbIrBZk/FfpLJuGCjAZb+toZW6eZXLlKaGboFM47FQ2zEmuHhlVHDME+S1PGERosD0XMNlflJNymDMSTz74P06pqw0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571415127; 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=1EobUcMZYRafaWIkltocvkXTn7XhjelVFJPnpqR0LoQ=; b=PIcqKvi3WRI38H4CicdYl/9UmIcpIip5+Glz+feF35r4VKXXtH6dxU4j0yRKDjLAB5y+MSTWRP0AAVsHhMfRbGszvvKo9jgIP75l4EMZAmibwW0/u/69nzbyFvXpKgbOIk6OiJ99FkY7V1Mnely3ftq4s/46NgMlGHKcDyYuBOY= 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 1571415127178477.0949635079512; Fri, 18 Oct 2019 09:12:07 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 8D163C024AEE; Fri, 18 Oct 2019 16:12:05 +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 5724A60BFB; Fri, 18 Oct 2019 16:12:05 +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 F10BD1803B48; Fri, 18 Oct 2019 16:12:04 +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 x9IGBwNr004825 for ; Fri, 18 Oct 2019 12:11:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 545DF6012A; Fri, 18 Oct 2019 16:11:58 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAD71600C1; Fri, 18 Oct 2019 16:11:57 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 18:11:10 +0200 Message-Id: <65fa8f4bdbb21b4cef23f23627abd9ec58ff4cd0.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 25/40] qemu: monitor: Add helper for generating data for block bitmap merging 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 18 Oct 2019 16:12:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Introduce qemuMonitorTransactionBitmapMergeSourceAddBitmap which adds the appropriate entry into a virJSONValue array to be used with qemuMonitorTransactionBitmapMerge. Bitmap merging supports two possible formats and this new helper implements the more universal one specifying also the source node name. In addition use the new helper in the testQemuMonitorJSONTransaction test. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 9 +++++++++ src/qemu/qemu_monitor.h | 4 ++++ src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 5 +++++ tests/qemumonitorjsontest.c | 4 ++-- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 8de386817b..57229a68c0 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4551,6 +4551,15 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr ac= tions, } +int +qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources, + const char *sourcenode, + const char *sourcebitmap) +{ + return qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(sources, s= ourcenode, sourcebitmap); +} + + int qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions, const char *device, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 45f2a5a7d2..a1c980e40e 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1364,6 +1364,10 @@ qemuMonitorTransactionBitmapMerge(virJSONValuePtr ac= tions, const char *node, const char *target, virJSONValuePtr *sources); +int +qemuMonitorTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sources, + const char *sourcenode, + const char *sourcebitmap); int qemuMonitorTransactionSnapshotLegacy(virJSONValuePtr actions, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0062816e3e..545911069e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9199,6 +9199,27 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePt= r actions, } +int +qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sourc= es, + const char *sourcenod= e, + const char *sourcebit= map) +{ + g_autoptr(virJSONValue) sourceobj =3D NULL; + + if (virJSONValueObjectCreate(&sourceobj, + "s:node", sourcenode, + "s:name", sourcebitmap, + NULL) < 0) + return -1; + + if (virJSONValueArrayAppend(sources, sourceobj) < 0) + return -1; + + sourceobj =3D NULL; + return 0; +} + + int qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions, const char *device, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index d74ef91b83..6617783797 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -652,6 +652,11 @@ qemuMonitorJSONTransactionBitmapMerge(virJSONValuePtr = actions, const char *target, virJSONValuePtr *sources); +int +qemuMonitorJSONTransactionBitmapMergeSourceAddBitmap(virJSONValuePtr sourc= es, + const char *sourcenod= e, + const char *sourcebit= map); + int qemuMonitorJSONTransactionSnapshotLegacy(virJSONValuePtr actions, const char *device, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 4f15d231f9..cefa0f08cf 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2982,8 +2982,8 @@ testQemuMonitorJSONTransaction(const void *opaque) !(mergebitmaps =3D virJSONValueNewArray())) return -1; - if (virJSONValueArrayAppendString(mergebitmaps, "mergemap1") < 0 || - virJSONValueArrayAppendString(mergebitmaps, "mergemap2") < 0) + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "no= de1", "bitmap1") < 0 || + qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "no= de2", "bitmap2") < 0) return -1; if (qemuMonitorTransactionBitmapAdd(actions, "node1", "bitmap1", true,= true) < 0 || --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list