From nobody Mon Feb 9 11:07:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1578594119; cv=none; d=zohomail.com; s=zohoarc; b=YgtJSWaT17bhvXCmfKKCOuANkOPt4ERiYplLPJArh+9is9sIo48K3c5YyPkYRSTh2Icq5y0BcE5qK5di2BnziCg2s5EW6cC+OyJJwTSV4q9SLxZV75utrz/yE0a6gmTe6T7Q3FZgh9uibl4YT9SZPzC9VXcmDzly9gLyqezzTSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594119; 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=1ydfC1gQtROtpFlQ3aiKuHsLiVOfvRPWWKYn1X5RCtg=; b=gsip84HJKf6Gz7AJWZ6+XSYSo0Ynj7DHBB6Ew9fePOkR4hj5c5VwwOaMamf/szGpNeVMbF0FoMNRUDporisspMO/dkdwBP+35ZUgPN4RnB3h6xq/hcEovuIyIMoDR3erT5ssNXqwW+YyswE6siSpHoUNZtjP4EEwLqhHEsKkA+I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1578594119868638.5572030012617; Thu, 9 Jan 2020 10:21:59 -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-434-GAGFthwqN7iMrYWLVcODjQ-1; Thu, 09 Jan 2020 13:21:56 -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 4602B104ECDD; Thu, 9 Jan 2020 18:21:49 +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 1C40560FC2; Thu, 9 Jan 2020 18:21:49 +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 D593B180612F; Thu, 9 Jan 2020 18:21:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 009ILdCl018318 for ; Thu, 9 Jan 2020 13:21:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 096C97C3D1; Thu, 9 Jan 2020 18:21:39 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DFB29A84; Thu, 9 Jan 2020 18:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594118; 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=1ydfC1gQtROtpFlQ3aiKuHsLiVOfvRPWWKYn1X5RCtg=; b=OK2w01OIvgQbiCy8XkioBKmO0D2Wk/ft0KhWVAYUwJSj0/ZrxXOMffSbOZN5qRfsmVVWGM MI6YAZiD1L1hQjOsrX1zvp2c3SyOvgLMsFr8T2aJG4OOAyYWqFlOYDQvb3ttN86KtnIkU4 uK1aOlUUYvm5Z7CV/GIc37Keo5cWSqo= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:16 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 10/16] tests: qemublock: Add test for checkpoint deletion bitmap merge 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 X-MC-Unique: GAGFthwqN7iMrYWLVcODjQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add test infrastructure and a basic test for bitmap deletion. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 59 +++++++++++++++++++ .../checkpointdelete/basic-noparent-out.json | 9 +++ 2 files changed, 68 insertions(+) create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-noparent= -out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3e9edb85f0..3ed2486ad2 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -27,6 +27,7 @@ #include "qemu/qemu_qapi.h" #include "qemu/qemu_monitor_json.h" #include "qemu/qemu_backup.h" +#include "qemu/qemu_checkpoint.h" #include "qemu/qemu_command.h" @@ -696,6 +697,50 @@ testQemuBackupIncrementalBitmapCalculate(const void *o= paque) } +static const char *checkpointDeletePrefix =3D "qemublocktestdata/checkpoin= tdelete/"; + +struct testQemuCheckpointDeleteMergeData { + const char *name; + virStorageSourcePtr chain; + const char *deletebitmap; + const char *parentbitmap; +}; + + +static int +testQemuCheckpointDeleteMerge(const void *opaque) +{ + const struct testQemuCheckpointDeleteMergeData *data =3D opaque; + g_autofree char *actual =3D NULL; + g_autofree char *expectpath =3D NULL; + g_autoptr(virJSONValue) actions =3D NULL; + bool currentcheckpoint; + + expectpath =3D g_strdup_printf("%s/%s%s-out.json", abs_srcdir, + checkpointDeletePrefix, data->name); + + if (!(actions =3D virJSONValueNewArray())) + return -1; + + /* hack to get the 'current' state until the function stops accepting = it */ + currentcheckpoint =3D STREQ("current", data->deletebitmap); + + if (qemuCheckpointDiscardDiskBitmaps(data->chain, + data->deletebitmap, + data->parentbitmap, + currentcheckpoint, + actions) < 0) { + VIR_TEST_VERBOSE("failed to generate checkpoint delete transaction= \n"); + return -1; + } + + if (!(actual =3D virJSONValueToString(actions, true))) + return -1; + + return virTestCompareToFile(actual, expectpath); +} + + static int mymain(void) { @@ -705,6 +750,7 @@ mymain(void) struct testQemuDiskXMLToJSONData diskxmljsondata; struct testQemuImageCreateData imagecreatedata; struct testQemuBackupIncrementalBitmapCalculateData backupbitmapcalcda= ta; + struct testQemuCheckpointDeleteMergeData checkpointdeletedata; char *capslatest_x86_64 =3D NULL; virQEMUCapsPtr caps_x86_64 =3D NULL; g_autoptr(virStorageSource) bitmapSourceChain =3D NULL; @@ -941,6 +987,19 @@ mymain(void) TEST_BACKUP_BITMAP_CALCULATE("snapshot-intermediate", bitmapSourceChai= n, "d", "snapshots"); TEST_BACKUP_BITMAP_CALCULATE("snapshot-deep", bitmapSourceChain, "a", = "snapshots"); +#define TEST_CHECKPOINT_DELETE_MERGE(testname, delbmp, parbmp) \ + do { \ + checkpointdeletedata.name =3D testname; \ + checkpointdeletedata.chain =3D bitmapSourceChain; \ + checkpointdeletedata.deletebitmap =3D delbmp; \ + checkpointdeletedata.parentbitmap =3D parbmp; \ + if (virTestRun("checkpoint delete " testname, \ + testQemuCheckpointDeleteMerge, &checkpointdeletedat= a) < 0) \ + ret =3D -1; \ + } while (0) + + TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/checkpointdelete/basic-noparent-out.js= on b/tests/qemublocktestdata/checkpointdelete/basic-noparent-out.json new file mode 100644 index 0000000000..e87382fdb4 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/basic-noparent-out.json @@ -0,0 +1,9 @@ +[ + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "a" + } + } +] --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list