From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594099; cv=none; d=zohomail.com; s=zohoarc; b=M5y797eQ8YMYv66CWywKINU8Lj2nAfBUh9l2s/FKb1OvaDU57BKkCzCq79ktpUqwQjdfADQB7xXJ+8or7WLf7GFFIJj4lBPP5LnBF5O5H327YaNTLZG8xA0U2c+4+6DRP8xmY1Sa8Z/mHDkndlbxnA1JMMbvVv/ZaDA3oMfJlus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594099; 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=g8Uv40oLi1nKnFmoup+CO2m6IfhfZ/hKfvu2NHj4mq0=; b=ieX3AbqxHDMCXu4M+8V4APh1tHCMxH8oHI7wANJA1Z7nlFPLVLXSq21o4mMJtECA83sQm1MPOaomfNmLC5suuQWh7MCON3QElNEjTsEN9AO+CwAMSMR+xcqUNwxadO6gcs3wt8+FVsEmeolMIGGjRYuQ4LYObBO7vD2TzN7X5eo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594099245552.7526830603283; Thu, 9 Jan 2020 10:21:39 -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-346-ov4wd-HpNz6IEKclfgPvXg-1; Thu, 09 Jan 2020 13:21:36 -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 129588014CD; Thu, 9 Jan 2020 18:21:31 +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 DCDDE691AD; Thu, 9 Jan 2020 18:21:30 +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 5A1F818089CD; Thu, 9 Jan 2020 18:21:30 +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 009ILR6j018222 for ; Thu, 9 Jan 2020 13:21:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id DAEE97C382; Thu, 9 Jan 2020 18:21:27 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C11A9A84; Thu, 9 Jan 2020 18:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594098; 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=g8Uv40oLi1nKnFmoup+CO2m6IfhfZ/hKfvu2NHj4mq0=; b=MomO0X5inuIyC7hDDSN4JOdIPGJ4Pk4j1rlV4pkoe76GkfCkztfI6nyTTvkxnlWYNxJ9eg ai8Rg4Ovp7t6iT5J/jOqIsYa+iuPukNdWahXjsXdYXlpIdatM6XHnETtevTvFnVTBc1wUf Bs+vShr0C0q255Cx00U3LRUWlG4vPMw= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:07 +0100 Message-Id: <66256edc9cc479b3cce8e0cbed372f4dbccc5231.1578593859.git.pkrempa@redhat.com> 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 01/16] qemu: checkpoint: Store whether deleted checkpoint is current in a variable 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 X-MC-Unique: ov4wd-HpNz6IEKclfgPvXg-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" Avoid two computations by using a boolean. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 2fa5c1ae00..d13d4c2a37 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -117,6 +117,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, size_t i, j; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *chkFile =3D NULL; + bool chkcurrent =3D chk =3D=3D virDomainCheckpointGetCurrent(vm->check= points); if (!metadata_only && !virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", @@ -172,7 +173,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(a= rr, node, disk->bitmap) < 0) return -1; - if (chk =3D=3D virDomainCheckpointGetCurrent(vm->check= points)) { + if (chkcurrent) { if (qemuMonitorTransactionBitmapEnable(actions, no= de, disk2->bitmap) < 0) return -1; } @@ -192,7 +193,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, return -1; } - if (chk =3D=3D virDomainCheckpointGetCurrent(vm->checkpoints)) { + if (chkcurrent) { virDomainCheckpointSetCurrent(vm->checkpoints, NULL); if (update_parent && parent) { virDomainCheckpointSetCurrent(vm->checkpoints, parent); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594099; cv=none; d=zohomail.com; s=zohoarc; b=TeS07xy0EvKploonbU4dSuQ6+JxfMUycBnlcUvGOqYOYpm9KneZPbNYW6cFREl59HnPH0j7hAiQp+MEG8YcWpsVpJoDkcBKY4HzxTTkazxrB+29gq3AdtBAnRZoK3XqiCAPqDowWhZNDkrBfj7dHP7azISmqthf07QXDzMX3KB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594099; 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=h7s4iAcFv5I5InV2yJMkbC7BqGC6TNzLyh/DoOHsLeA=; b=kGdyRZ6L4fmP7Qe63Ro8GIXT0nTq4K3ZDreTFW/Oo9+lcKKVJWrlS0wFY2zNE1OcdzVQ36ee/8+sRvsOp7iqSN/HefvC7Rq3G+OS9dcZDBVaFOfSxawIbOBokm40EjP5gJVadnHiVUrqqhnXRZR/HuTkYUYLoXCkd9z8b9EqP6E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594099327326.3440066967287; Thu, 9 Jan 2020 10:21:39 -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-232-RPNUgINrOja9qANGudObkg-1; Thu, 09 Jan 2020 13:21:36 -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 EDA9A10513C7; Thu, 9 Jan 2020 18:21:30 +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 9917F5C541; Thu, 9 Jan 2020 18:21:30 +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 0B68F18089C8; Thu, 9 Jan 2020 18:21:30 +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 009ILSPD018230 for ; Thu, 9 Jan 2020 13:21:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id D33F27C382; Thu, 9 Jan 2020 18:21:28 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3459F7C015; Thu, 9 Jan 2020 18:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594098; 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=h7s4iAcFv5I5InV2yJMkbC7BqGC6TNzLyh/DoOHsLeA=; b=NsUmB1zVYtamhTZLxr9Dvv65XPvWF1Dg380ANo25pgl7m8n7lh+7FuyQBFmftZDWqDLogC BB0YT4tSNpPBZwgJRwNLSowVIQdAIVo9ByQ3pMiZZjeA8wS6e+SgEQnMX+7II6QVsZLccC ud/plI+9oOnc/6sm99j9TzymGloutCI= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:08 +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 02/16] qemu: checkpoint: split out checkpoint deletion bitmaps 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 X-MC-Unique: RPNUgINrOja9qANGudObkg-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" qemuCheckpointDiscard is a massive function that can be separated into smaller bits. Extract the part that actually modifies the disk from the metadata handling. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 137 ++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 61 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index d13d4c2a37..9ff3129570 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -104,6 +104,81 @@ qemuCheckpointWriteMetadata(virDomainObjPtr vm, } +static int +qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, + virDomainCheckpointDefPtr chkdef, + bool chkcurrent, + virDomainMomentObjPtr parent) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virQEMUDriverPtr driver =3D priv->driver; + virDomainMomentObjPtr moment; + virDomainCheckpointDefPtr parentdef =3D NULL; + bool search_parents; + int rc; + g_autoptr(virJSONValue) actions =3D NULL; + size_t i; + size_t j; + + if (!(actions =3D virJSONValueNewArray())) + return -1; + + for (i =3D 0; i < chkdef->ndisks; i++) { + virDomainCheckpointDiskDef *disk =3D &chkdef->disks[i]; + const char *node; + + if (disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + continue; + + node =3D qemuDomainDiskNodeFormatLookup(vm, disk->name); + /* If any ancestor checkpoint has a bitmap for the same + * disk, then this bitmap must be merged to the + * ancestor. */ + search_parents =3D true; + for (moment =3D parent; + search_parents && moment; + moment =3D virDomainCheckpointFindByName(vm->checkpoints, + parentdef->parent.pare= nt_name)) { + parentdef =3D virDomainCheckpointObjGetDef(moment); + for (j =3D 0; j < parentdef->ndisks; j++) { + virDomainCheckpointDiskDef *disk2; + g_autoptr(virJSONValue) arr =3D NULL; + + disk2 =3D &parentdef->disks[j]; + if (STRNEQ(disk->name, disk2->name) || + disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + continue; + search_parents =3D false; + + if (!(arr =3D virJSONValueNewArray())) + return -1; + + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, = node, disk->bitmap) < 0) + return -1; + + if (chkcurrent) { + if (qemuMonitorTransactionBitmapEnable(actions, node, = disk2->bitmap) < 0) + return -1; + } + + if (qemuMonitorTransactionBitmapMerge(actions, node, disk2= ->bitmap, &arr) < 0) + return -1; + } + } + + if (qemuMonitorTransactionBitmapRemove(actions, node, disk->bitmap= ) < 0) + return -1; + } + + qemuDomainObjEnterMonitor(driver, vm); + rc =3D qemuMonitorTransaction(priv->mon, &actions); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; + + return 0; +} + + static int qemuCheckpointDiscard(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -112,9 +187,6 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, bool metadata_only) { virDomainMomentObjPtr parent =3D NULL; - virDomainMomentObjPtr moment; - virDomainCheckpointDefPtr parentdef =3D NULL; - size_t i, j; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *chkFile =3D NULL; bool chkcurrent =3D chk =3D=3D virDomainCheckpointGetCurrent(vm->check= points); @@ -129,67 +201,10 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, chk->def->name); if (!metadata_only) { - qemuDomainObjPrivatePtr priv =3D vm->privateData; - bool search_parents; virDomainCheckpointDefPtr chkdef =3D virDomainCheckpointObjGetDef(= chk); - int rc; - g_autoptr(virJSONValue) actions =3D NULL; - - if (!(actions =3D virJSONValueNewArray())) - return -1; - parent =3D virDomainCheckpointFindByName(vm->checkpoints, chk->def->parent_name); - for (i =3D 0; i < chkdef->ndisks; i++) { - virDomainCheckpointDiskDef *disk =3D &chkdef->disks[i]; - const char *node; - - if (disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) - continue; - - node =3D qemuDomainDiskNodeFormatLookup(vm, disk->name); - /* If any ancestor checkpoint has a bitmap for the same - * disk, then this bitmap must be merged to the - * ancestor. */ - search_parents =3D true; - for (moment =3D parent; - search_parents && moment; - moment =3D virDomainCheckpointFindByName(vm->checkpoints, - parentdef->parent.= parent_name)) { - parentdef =3D virDomainCheckpointObjGetDef(moment); - for (j =3D 0; j < parentdef->ndisks; j++) { - virDomainCheckpointDiskDef *disk2; - g_autoptr(virJSONValue) arr =3D NULL; - - disk2 =3D &parentdef->disks[j]; - if (STRNEQ(disk->name, disk2->name) || - disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) - continue; - search_parents =3D false; - - if (!(arr =3D virJSONValueNewArray())) - return -1; - - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(a= rr, node, disk->bitmap) < 0) - return -1; - - if (chkcurrent) { - if (qemuMonitorTransactionBitmapEnable(actions, no= de, disk2->bitmap) < 0) - return -1; - } - - if (qemuMonitorTransactionBitmapMerge(actions, node, d= isk2->bitmap, &arr) < 0) - return -1; - } - } - - if (qemuMonitorTransactionBitmapRemove(actions, node, disk->bi= tmap) < 0) - return -1; - } - - qemuDomainObjEnterMonitor(driver, vm); - rc =3D qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuCheckpointDiscardBitmaps(vm, chkdef, chkcurrent, parent) <= 0) return -1; } --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594107; cv=none; d=zohomail.com; s=zohoarc; b=PHUe+5yMRCuGbv9e5MH2CpmI0+2JP7hL0FeEbfNygLElCEJ4TvJsJxI5fuvUhMliU9L82vXkioXsy9J9DNjb8rcc3+9TVoUwTiZB4aTxkVMRRMsg2nTEKSk1RXZnDR+9HTV1diGKAA0u+QgqW1BQqv2i3492wgnNBjHPRTAabd0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594107; 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=qnYUfQBYa4vFgPDhmCAzTSWXFMOK3RNFMDZrmweOuPM=; b=iiGCPhxFR6ak3sbakWK0JTKqltSk7rQYKfNHM9yhZwrOq3PXvM0yeh3r4iKM6Ug1xpa17cmj0At7w5+4ZZm4sSsZP2mJMufDXNZcge4RTs11ZDNFexfI89cVZV0dXNLdpHKD+D1Hm5j3WX1fcGE2Jne0/1RNNJeN4f12Qvrz9ak= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594107086341.6851468760823; Thu, 9 Jan 2020 10:21: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-176-4f2kAibDOOaKFMCdLjXGeg-1; Thu, 09 Jan 2020 13:21:44 -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 BAEC6104ED03; Thu, 9 Jan 2020 18:21: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 923C860FC2; Thu, 9 Jan 2020 18:21: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 4C9E2503C7; Thu, 9 Jan 2020 18:21:38 +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 009ILW1l018249 for ; Thu, 9 Jan 2020 13:21:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3C11D7C382; Thu, 9 Jan 2020 18:21:32 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F21B9A84; Thu, 9 Jan 2020 18:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594106; 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=qnYUfQBYa4vFgPDhmCAzTSWXFMOK3RNFMDZrmweOuPM=; b=JM62lldkEvXgehUKdw7fXcOgcnGibPX0Pap8ReZRh629g2ZMFo8WS+QsHBL9ulkmJuQAN+ IrRazLVCd3+an7HEr3JqHBrlAIz+msYRbol3Nn3beVx2hnDhP8bM1wZrV45mgE7WueMhkr 4zkWmSjVpK2l+qtkoPiAWOxiYRET1t4= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:09 +0100 Message-Id: <935723b9785c3ce9bc82bc76dfa124ade97c557e.1578593859.git.pkrempa@redhat.com> 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 03/16] qemu: checkpoint: rename disk->chkdisk in qemuCheckpointDiscardBitmaps 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: 4f2kAibDOOaKFMCdLjXGeg-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" Upcomming patches will also use the domain diks definition. Rename disk to chkdisk for clarity. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 9ff3129570..d347b8fc6c 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -124,13 +124,13 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, return -1; for (i =3D 0; i < chkdef->ndisks; i++) { - virDomainCheckpointDiskDef *disk =3D &chkdef->disks[i]; + virDomainCheckpointDiskDef *chkdisk =3D &chkdef->disks[i]; const char *node; - if (disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + if (chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; - node =3D qemuDomainDiskNodeFormatLookup(vm, disk->name); + node =3D qemuDomainDiskNodeFormatLookup(vm, chkdisk->name); /* If any ancestor checkpoint has a bitmap for the same * disk, then this bitmap must be merged to the * ancestor. */ @@ -145,7 +145,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, g_autoptr(virJSONValue) arr =3D NULL; disk2 =3D &parentdef->disks[j]; - if (STRNEQ(disk->name, disk2->name) || + if (STRNEQ(chkdisk->name, disk2->name) || disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; search_parents =3D false; @@ -153,7 +153,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, if (!(arr =3D virJSONValueNewArray())) return -1; - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, = node, disk->bitmap) < 0) + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, = node, chkdisk->bitmap) < 0) return -1; if (chkcurrent) { @@ -166,7 +166,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, } } - if (qemuMonitorTransactionBitmapRemove(actions, node, disk->bitmap= ) < 0) + if (qemuMonitorTransactionBitmapRemove(actions, node, chkdisk->bit= map) < 0) return -1; } --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1578594113; cv=none; d=zohomail.com; s=zohoarc; b=BlysI6xIs+R5ae9RY81EqWS2jcBD5xgq0eTtwOesnwKCP7AxIZOUWZDWLusre/cWALK8shLTX+k7BQaWNaz11qyfeLtWuaJNeNWKCg9s44+Gg4LrMjoLR4B11QZ4cXn56ut7hORqHhnxXBFZLd6gPY5q3XTSkYIJ//lda5DCdjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594113; 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=1yL+3q2HQDm396iQUNI9Hg/G8/vTPTewMDWR5a/Ybu4=; b=AfEEWd4VKSIv5UWHRA4zbQdxsSwPHDMqsiBvBnHwKZZSEM2PQk+5cmuTaVe5O4MWtOuAP7mcb2x5zb3Ydcbj3Hutla5Rdn+WznulhAAtjUuJ2Ku8Di97SKslchEPtKOqs9LbFJSRbknrQTZhmEGAb8F5Z5cdh5Y83AFYh84dcfA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578594113143892.3531658855474; Thu, 9 Jan 2020 10:21: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-27-l8MzqGfiMSC3ZA-ISS3ofA-1; Thu, 09 Jan 2020 13:21:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 936BC104ED19; Thu, 9 Jan 2020 18:21:41 +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 587AB5DA66; Thu, 9 Jan 2020 18:21:41 +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 16E3E18089D5; Thu, 9 Jan 2020 18:21:41 +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 009ILX33018259 for ; Thu, 9 Jan 2020 13:21:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 325FE7C015; Thu, 9 Jan 2020 18:21:33 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87F289A84; Thu, 9 Jan 2020 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594112; 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=1yL+3q2HQDm396iQUNI9Hg/G8/vTPTewMDWR5a/Ybu4=; b=Vu5BLFVdmiWmN7fWKML7leNnKv4FGxzU9dAbJ+7q2vE4QpSm28cZwmOYGj2p3vX947pBv/ t1+88fpWNoA40YWp+QrELcmvMedo6zNSO3plwZI94zAtH4UeAO0guFcZNOKnFLcOuHF8aw xC7QUya+2HY594uYhrQ6lq1Hl5QPoP4= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:10 +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 04/16] qemu: checkpoint: rename disk->chkdisk in qemuCheckpointAddActions 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.14 X-MC-Unique: l8MzqGfiMSC3ZA-ISS3ofA-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" Upcomming patches will also use the domain diks definition. Rename disk to chkdisk for clarity. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index d347b8fc6c..0aa854324b 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -319,13 +319,13 @@ qemuCheckpointAddActions(virDomainObjPtr vm, bool search_parents; for (i =3D 0; i < def->ndisks; i++) { - virDomainCheckpointDiskDef *disk =3D &def->disks[i]; + virDomainCheckpointDiskDef *chkdisk =3D &def->disks[i]; const char *node; - if (disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + if (chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; - node =3D qemuDomainDiskNodeFormatLookup(vm, disk->name); - if (qemuMonitorTransactionBitmapAdd(actions, node, disk->bitmap, t= rue, false, 0) < 0) + node =3D qemuDomainDiskNodeFormatLookup(vm, chkdisk->name); + if (qemuMonitorTransactionBitmapAdd(actions, node, chkdisk->bitmap= , true, false, 0) < 0) return -1; /* We only want one active bitmap for a disk along the @@ -345,7 +345,7 @@ qemuCheckpointAddActions(virDomainObjPtr vm, virDomainCheckpointDiskDef *disk2; disk2 =3D &olddef->disks[j]; - if (STRNEQ(disk->name, disk2->name) || + if (STRNEQ(chkdisk->name, disk2->name) || disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; if (qemuMonitorTransactionBitmapDisable(actions, node, dis= k2->bitmap) < 0) --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1578594115; cv=none; d=zohomail.com; s=zohoarc; b=n37fHRuPbB7ff0LN4GPwJinsTiLLvUezskso6F8gqp/vdPNKHsLsKEl0mry+RVxdYrKqTb1SF4crQo49N2gktKMt84xQfYHFVhbQKYsE/6kerxEdUOiscTBz8LShAipnyWu5LkvT9/DND03wefSt9SQT+hN2Q/xg4N2OPCU2JaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594115; 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=rB4E2ZEDlT8dmflVL05iuYIhuY1OH9VVwLYA2oieakk=; b=Dplf1N1opZ5I4iGyV2O6wIopnNi0prLg/YhZHSyv9bEm3p/uequuHnucNZZ4wS7EuHk8AYdNBwoo9Un5lC59yg7U+URVzgBU110C3sCL/QSyWL66TlExniYocpXlFxavDg6L6Msi1zpNV7Iw+SkYeNfGVGTMN3J7qbYTHVcWEk0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1578594115743101.45647896300625; Thu, 9 Jan 2020 10:21:55 -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-385-J4SN8W78NsWcdPRQUJzEBw-1; Thu, 09 Jan 2020 13:21:52 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EFFE1902EC8; Thu, 9 Jan 2020 18:21:45 +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 EAE147C3D1; Thu, 9 Jan 2020 18:21:44 +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 AD485180880B; Thu, 9 Jan 2020 18:21:44 +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 009ILYMd018266 for ; Thu, 9 Jan 2020 13:21:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2B40A7C3D0; Thu, 9 Jan 2020 18:21:34 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 800F09A84; Thu, 9 Jan 2020 18:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594114; 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=rB4E2ZEDlT8dmflVL05iuYIhuY1OH9VVwLYA2oieakk=; b=SkzY5LpTqEC9xpl4H7Xw6bAxge9ng6MjiturKlfLspTE6aVpLYd+iuhi+S0s7Llhg8pUMp dtb5Bo7B1qWM9cXy/ZVLkaFLUo2dQzg9Wqrv3fA1DR+mfypzSHrjWK2stlxwvotdmVC7c7 b6exOsWn2E/c1RVZIbh6gLURUpQiH/k= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:11 +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 05/16] qemu: checkpoint: Use disk definition directly when creating checkpoint 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.15 X-MC-Unique: J4SN8W78NsWcdPRQUJzEBw-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" Lookup the whole disk definition rather than just the node name. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 0aa854324b..03a8321135 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -320,12 +320,16 @@ qemuCheckpointAddActions(virDomainObjPtr vm, for (i =3D 0; i < def->ndisks; i++) { virDomainCheckpointDiskDef *chkdisk =3D &def->disks[i]; - const char *node; + virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); - if (chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + /* checkpoint definition validator mandates that the corresponding + * domdisk should exist */ + if (!domdisk || + chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; - node =3D qemuDomainDiskNodeFormatLookup(vm, chkdisk->name); - if (qemuMonitorTransactionBitmapAdd(actions, node, chkdisk->bitmap= , true, false, 0) < 0) + + if (qemuMonitorTransactionBitmapAdd(actions, domdisk->src->nodefor= mat, + chkdisk->bitmap, true, false, = 0) < 0) return -1; /* We only want one active bitmap for a disk along the @@ -348,7 +352,9 @@ qemuCheckpointAddActions(virDomainObjPtr vm, if (STRNEQ(chkdisk->name, disk2->name) || disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; - if (qemuMonitorTransactionBitmapDisable(actions, node, dis= k2->bitmap) < 0) + if (qemuMonitorTransactionBitmapDisable(actions, + domdisk->src->node= format, + disk2->bitmap) < 0) return -1; search_parents =3D false; break; --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1578594113; cv=none; d=zohomail.com; s=zohoarc; b=myKFmQoB/27tAVSCjYnoUocXycAhcO2f5p3XCaEmJSx1IzQXw71SsYNI5ajJ7QBqo3Z2j+XUuL0yZQPHXoLaMd2xZRMC4G/LVIgxJ2A16HpjDLyiEcpQEdp1io17q6h4y408obn9d0LxDuIcbTNGVD/A7gnEs9XnWZnfURgRaJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594113; 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=fEj9ApAvTQP05YQ4GqHNF2MxS/GdNN64kpWsOrCtrK4=; b=IM+7BsJu5BYKHMdQ/nN5L3rFLmwRRxDX/fx6rJFjevVRfi3HkTr3fCkRHh/FHvVnut6SJPcWbJmXoYjfocaww2jYj1DiUfNkgZMvnivLrX48JWH1ks7YhXZSarJY06rJXZq0DfKntwyhp+gGdjMTk1H0xKXmv4iZt5bLinxvreA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578594113703516.9634678127076; Thu, 9 Jan 2020 10:21: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-295-1GErLTcZMAe64D3tkLrnQw-1; Thu, 09 Jan 2020 13:21:49 -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 73C15104ED28; Thu, 9 Jan 2020 18:21:42 +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 4FBE35C557; Thu, 9 Jan 2020 18:21:42 +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 F192318089D6; Thu, 9 Jan 2020 18:21:41 +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 009ILZNA018277 for ; Thu, 9 Jan 2020 13:21:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 254939A84; Thu, 9 Jan 2020 18:21:35 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7972D7C3D0; Thu, 9 Jan 2020 18:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594112; 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=fEj9ApAvTQP05YQ4GqHNF2MxS/GdNN64kpWsOrCtrK4=; b=MqW5ylJrzSiAC3/PnJJ82hKA8m3B2ogy9vkAyW5lekIaiLdVkhI3dHzc5Ohgfh9dgDujw5 iHzZvsiWe5rifU07oKHmg+49/Y3O5o8S4hAj1qJKvep3zk6ll564542BIur3UTJwLD7roM hDb+DxunkNWsrv4WLZSzK/finujuBEQ= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:12 +0100 Message-Id: <357e0a069bff33c75dce458399949118d8ab21d8.1578593859.git.pkrempa@redhat.com> 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 06/16] qemu: checkpoint: tolerate missing disks on checkpoint deletion 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 X-MC-Unique: 1GErLTcZMAe64D3tkLrnQw-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" If a disk is unplugged and then the user tries to delete a checkpoint the code would try to use NULL node name as it was not checked. Fix this by fetching the whole disk definition object and verifying it was found. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 03a8321135..326707e098 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -125,12 +125,15 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDef *chkdisk =3D &chkdef->disks[i]; - const char *node; + virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); + + /* domdisk can be missing e.g. when it was unplugged */ + if (!domdisk) + continue; if (chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; - node =3D qemuDomainDiskNodeFormatLookup(vm, chkdisk->name); /* If any ancestor checkpoint has a bitmap for the same * disk, then this bitmap must be merged to the * ancestor. */ @@ -153,20 +156,28 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, if (!(arr =3D virJSONValueNewArray())) return -1; - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, = node, chkdisk->bitmap) < 0) + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, + domdi= sk->src->nodeformat, + chkdi= sk->bitmap) < 0) return -1; if (chkcurrent) { - if (qemuMonitorTransactionBitmapEnable(actions, node, = disk2->bitmap) < 0) + if (qemuMonitorTransactionBitmapEnable(actions, + domdisk->src->n= odeformat, + disk2->bitmap) = < 0) return -1; } - if (qemuMonitorTransactionBitmapMerge(actions, node, disk2= ->bitmap, &arr) < 0) + if (qemuMonitorTransactionBitmapMerge(actions, + domdisk->src->nodefo= rmat, + disk2->bitmap, &arr)= < 0) return -1; } } - if (qemuMonitorTransactionBitmapRemove(actions, node, chkdisk->bit= map) < 0) + if (qemuMonitorTransactionBitmapRemove(actions, + domdisk->src->nodeformat, + chkdisk->bitmap) < 0) return -1; } --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1578594120; cv=none; d=zohomail.com; s=zohoarc; b=WrTNLLu254lUzf0qnEpNh5T8pHy6d0gZ8jnV7/L95F0o5/ToTKiUzIsLJIgK0TpNOdpcXeg1rCojyV7Chf0qWp9HvRv/boQXflJYfu/Ulh6QWILROfIzx4YZAqXr8y+GwxEbKchkBprgvRD1GOZrneznCYOzn1s0U9ytb1lWQag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594120; 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=pPo6k5IqAWSIpYo1mKKfEBqj2qioqTVusaHsSXgN1Dk=; b=DSMw5IcEZ43SY2+/CmajeKv76WEViARkMW3loO8pwontXmd77bKKI+vNpZOg6U+L8vIJ0fOmOPHEZhm+U1CTMEk0Kiep30riRsNvcbIen6jdnHN+NwVlYZatdLSPRu58zYnC603aJ4PA7y965Rc+tBbd1dq3WGF05sd6Yqx1JZ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 157859412041034.35732701164284; Thu, 9 Jan 2020 10:22:00 -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-237-v-s6SrjnM5utdpBDOy5C5w-1; Thu, 09 Jan 2020 13:21:57 -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 8ED701902ECF; Thu, 9 Jan 2020 18:21:48 +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 6C58C691AD; Thu, 9 Jan 2020 18:21:48 +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 2C727503C9; 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 009ILar0018285 for ; Thu, 9 Jan 2020 13:21:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F5A19A84; Thu, 9 Jan 2020 18:21:36 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7331A7C3D1; Thu, 9 Jan 2020 18:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594119; 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=pPo6k5IqAWSIpYo1mKKfEBqj2qioqTVusaHsSXgN1Dk=; b=Y/2RaBkKVO9VtcMHZa+gdmJa2QKQDjj4hEisMMUfwrZ6U3NZ//nFAYyCxfve5O9s6PQ6Sq vRs9ZSnh9Bh40Tc1NK2wkwC8wKhvc7R0kWG4Q1jVhChPca5OaNC+uu/fYPOnGc5nXSQivS WjXJBZPbSFZ7P4VGVxexu5xGOkUeuHk= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:13 +0100 Message-Id: <851790a87dee8f5762a77af57140da21a25dbe9c.1578593859.git.pkrempa@redhat.com> 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 07/16] qemu: domain: Remove unused qemuDomainDiskNodeFormatLookup 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 X-MC-Unique: v-s6SrjnM5utdpBDOy5C5w-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" The function has no users now and there's no need for it as the common pattern is to look up the whole disk object anyways. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_domain.c | 14 -------------- src/qemu/qemu_domain.h | 3 --- 2 files changed, 17 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 24e84a5966..4966f5ef36 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12048,20 +12048,6 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr = disk, } -/* Return the format node name for a given disk of an online guest */ -const char * -qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm, - const char *disk) -{ - size_t i; - - for (i =3D 0; i < vm->def->ndisks; i++) { - if (STREQ(vm->def->disks[i]->dst, disk)) - return vm->def->disks[i]->src->nodeformat; - } - return NULL; -} - bool qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index c6afc484f6..4e2ddf6880 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -864,9 +864,6 @@ int qemuDomainDetermineDiskChain(virQEMUDriverPtr drive= r, bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk, virDomainDiskDefPtr orig_disk); -const char *qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm, - const char *disk); - void qemuDomainGetImageIds(virQEMUDriverConfigPtr cfg, virDomainObjPtr vm, virStorageSourcePtr src, --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1578594116; cv=none; d=zohomail.com; s=zohoarc; b=P4FLn9yjRJmvWnlsx7LaFu+kHa785gEJXUnifXdrzh7ic2FoE23UBbcpJRKRt+cQfzVctWIU6+033HSgJ3e/B6KWVlLsH8lHq/r88hAyWq8vEpKG/FoLeVblordxQKYzuVnHN45kKotVAfWka8athu4hlLIfRnIzCI5UtJBpwbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594116; 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=za6Ic+jazUMjWG5ATjODbGvzkqrqeMbIgVPFJNAS3bY=; b=QMXqCDqmrz848d7GiHOe2X6pNS1bD47WrlXqnd5idF3WimI/e20hqH4feekCSuFYybkWLHTogImwYqXIDH91YKm5O+HRegRDkvwtY7qmjA+p1x/AnCdKl3FhdCzp5GQgec6xPk9+H+m+7tAxkuzD6fpdX9MjpIjOSevwfLSHuv8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578594116334772.6187101730159; Thu, 9 Jan 2020 10:21:56 -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-345-jAIbUlGWNOmov-tcYJ3aEg-1; Thu, 09 Jan 2020 13:21:52 -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 C88E3100552A; Thu, 9 Jan 2020 18:21:45 +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 A2EE186CC2; Thu, 9 Jan 2020 18:21:45 +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 6167E503A0; Thu, 9 Jan 2020 18:21:45 +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 009ILbnk018297 for ; Thu, 9 Jan 2020 13:21:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 16E827C3D8; Thu, 9 Jan 2020 18:21:37 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BC6F9A84; Thu, 9 Jan 2020 18:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594115; 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=za6Ic+jazUMjWG5ATjODbGvzkqrqeMbIgVPFJNAS3bY=; b=UyWaUIzlov16pqn4Nk758t0FCMqk4gsjy0mSU0XuJfb3PO160uZCT7EQ0Zgc+UargAFbWy F+40QFZprmGMevEiSa0ZsA3Po0Re50Wp45elJjTFUZR9GWA8mGFSKY4j69XpZppDrhZ8Nw pxbDZOQWKCjljiPnC7o9GPeuLJbxuik= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:14 +0100 Message-Id: <94e8f37f19e86f07ed53fdebd047325708174011.1578593859.git.pkrempa@redhat.com> 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 08/16] qemu: checkpoint: Introduce helper to find checkpoint disk definition in parents 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 X-MC-Unique: jAIbUlGWNOmov-tcYJ3aEg-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" The algorithm is used in two places to find the parent checkpoint object which contains given disk and then uses data from the disk. Additionally the code is written in a very non-obvious way. Factor out the lookup of the disk into a function which also simplifies the callers. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 129 ++++++++++++++++++++----------------- 1 file changed, 71 insertions(+), 58 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 326707e098..1100f6e744 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -104,6 +104,50 @@ qemuCheckpointWriteMetadata(virDomainObjPtr vm, } +/** + * qemuCheckpointFindActiveDiskInParent: + * @vm: domain object + * @from: starting moment object + * @diskname: name (target) of the disk to find + * + * Find the first checkpoint starting from @from continuing through parents + * of the checkpoint which describes disk @diskname. Return the pointer to= the + * definition of the disk. + */ +static virDomainCheckpointDiskDef * +qemuCheckpointFindActiveDiskInParent(virDomainObjPtr vm, + virDomainMomentObjPtr from, + const char *diskname) +{ + virDomainMomentObjPtr parent =3D from; + virDomainCheckpointDefPtr parentdef =3D NULL; + size_t i; + + while (parent) { + parentdef =3D virDomainCheckpointObjGetDef(parent); + + for (i =3D 0; i < parentdef->ndisks; i++) { + virDomainCheckpointDiskDef *chkdisk =3D &parentdef->disks[i]; + + if (STRNEQ(chkdisk->name, diskname)) + continue; + + /* currently inspected checkpoint doesn't describe the disk, + * continue into parent checkpoint */ + if (chkdisk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) + break; + + return chkdisk; + } + + parent =3D virDomainCheckpointFindByName(vm->checkpoints, + parentdef->parent.parent_na= me); + } + + return NULL; +} + + static int qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, virDomainCheckpointDefPtr chkdef, @@ -112,13 +156,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, { qemuDomainObjPrivatePtr priv =3D vm->privateData; virQEMUDriverPtr driver =3D priv->driver; - virDomainMomentObjPtr moment; - virDomainCheckpointDefPtr parentdef =3D NULL; - bool search_parents; int rc; g_autoptr(virJSONValue) actions =3D NULL; size_t i; - size_t j; if (!(actions =3D virJSONValueNewArray())) return -1; @@ -126,6 +166,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDef *chkdisk =3D &chkdef->disks[i]; virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); + virDomainCheckpointDiskDef *parentchkdisk =3D NULL; /* domdisk can be missing e.g. when it was unplugged */ if (!domdisk) @@ -137,42 +178,28 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, /* If any ancestor checkpoint has a bitmap for the same * disk, then this bitmap must be merged to the * ancestor. */ - search_parents =3D true; - for (moment =3D parent; - search_parents && moment; - moment =3D virDomainCheckpointFindByName(vm->checkpoints, - parentdef->parent.pare= nt_name)) { - parentdef =3D virDomainCheckpointObjGetDef(moment); - for (j =3D 0; j < parentdef->ndisks; j++) { - virDomainCheckpointDiskDef *disk2; - g_autoptr(virJSONValue) arr =3D NULL; - - disk2 =3D &parentdef->disks[j]; - if (STRNEQ(chkdisk->name, disk2->name) || - disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) - continue; - search_parents =3D false; - - if (!(arr =3D virJSONValueNewArray())) - return -1; + if ((parentchkdisk =3D qemuCheckpointFindActiveDiskInParent(vm, pa= rent, chkdisk->name))) { + g_autoptr(virJSONValue) arr =3D NULL; - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, - domdi= sk->src->nodeformat, - chkdi= sk->bitmap) < 0) - return -1; + if (!(arr =3D virJSONValueNewArray())) + return -1; - if (chkcurrent) { - if (qemuMonitorTransactionBitmapEnable(actions, - domdisk->src->n= odeformat, - disk2->bitmap) = < 0) - return -1; - } + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, + domdisk->= src->nodeformat, + chkdisk->= bitmap) < 0) + return -1; - if (qemuMonitorTransactionBitmapMerge(actions, - domdisk->src->nodefo= rmat, - disk2->bitmap, &arr)= < 0) + if (chkcurrent) { + if (qemuMonitorTransactionBitmapEnable(actions, + domdisk->src->nodef= ormat, + parentchkdisk->bitm= ap) < 0) return -1; } + + if (qemuMonitorTransactionBitmapMerge(actions, + domdisk->src->nodeformat, + parentchkdisk->bitmap, &= arr) < 0) + return -1; } if (qemuMonitorTransactionBitmapRemove(actions, @@ -324,14 +351,12 @@ qemuCheckpointAddActions(virDomainObjPtr vm, virDomainMomentObjPtr old_current, virDomainCheckpointDefPtr def) { - size_t i, j; - virDomainCheckpointDefPtr olddef; - virDomainMomentObjPtr parent; - bool search_parents; + size_t i; for (i =3D 0; i < def->ndisks; i++) { virDomainCheckpointDiskDef *chkdisk =3D &def->disks[i]; virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); + virDomainCheckpointDiskDef *parentchkdisk =3D NULL; /* checkpoint definition validator mandates that the corresponding * domdisk should exist */ @@ -351,25 +376,13 @@ qemuCheckpointAddActions(virDomainObjPtr vm, * iteration; but it is also possible to have to search * further than the immediate parent to find another * checkpoint with a bitmap on the same disk. */ - search_parents =3D true; - for (parent =3D old_current; search_parents && parent; - parent =3D virDomainCheckpointFindByName(vm->checkpoints, - olddef->parent.parent_= name)) { - olddef =3D virDomainCheckpointObjGetDef(parent); - for (j =3D 0; j < olddef->ndisks; j++) { - virDomainCheckpointDiskDef *disk2; - - disk2 =3D &olddef->disks[j]; - if (STRNEQ(chkdisk->name, disk2->name) || - disk2->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) - continue; - if (qemuMonitorTransactionBitmapDisable(actions, - domdisk->src->node= format, - disk2->bitmap) < 0) - return -1; - search_parents =3D false; - break; - } + if ((parentchkdisk =3D qemuCheckpointFindActiveDiskInParent(vm, ol= d_current, + chkdisk-= >name))) { + + if (qemuMonitorTransactionBitmapDisable(actions, + domdisk->src->nodeform= at, + parentchkdisk->bitmap)= < 0) + return -1; } } return 0; --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594122; cv=none; d=zohomail.com; s=zohoarc; b=Bg/y7yYcZdutFuGmgQaIyxGresLI/UCcZBhFGgXBarr00KVubl1KSWVlQMKK5IpXYwVJY58iZSbq8p4VRiVQ48lblxJv3W/FfoGDmia/w65qSFJFbcn4voLIR1taGWvg19oYXVo5UitnbnoHwcGPvSQtz5UylN12yO9s3WCceCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594122; 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=zn8mZ7cVhtzsPkQfqFG6J664SQj+psVAolSy0J7Mp1o=; b=PTK69fHerNZE7e2JEvJTGlT91aSdpvGD36Ppb+MPHaEeTHKA21tL/MtGHQNZlx/VURqmib/Cd3X7ZQt6nXih+9eGzapIO9k62kOgZm/uCInJFtlr6Zznf5iVyTLVkGbJOPA924q6YNch4faepqEmWZvXJxVm0iWAkJcvlCeG5EI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594122779581.2229133273813; Thu, 9 Jan 2020 10:22:02 -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-26-RhbKAhwwMXGls5YBoEvDRA-1; Thu, 09 Jan 2020 13:22:00 -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 5BAD21007271; Thu, 9 Jan 2020 18:21:52 +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 2C3355C57C; Thu, 9 Jan 2020 18:21:52 +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 C18271803C33; Thu, 9 Jan 2020 18:21:51 +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 009ILclL018306 for ; Thu, 9 Jan 2020 13:21:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 105167C3D8; Thu, 9 Jan 2020 18:21:38 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64A3A7C3E2; Thu, 9 Jan 2020 18:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594121; 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=zn8mZ7cVhtzsPkQfqFG6J664SQj+psVAolSy0J7Mp1o=; b=gXQ7+wTBjcxKU1tmUJYdjktfA2EqlUkI58+FvG51eWd5Z8reqfTtZMxcx5gXv1jaYEwiZb ezgogimeiPxd+MKem75oWjCjjDH6awAcVeLY4LSJqjvDe8VHyFqiFyTx9b/qt9dlumJnJ+ pD00OdPI5AcpMFXWdemhbmRKuC71dQg= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:15 +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 09/16] qemu: checkpoint: Extract calculation of bitmap merging for checkpoint deletion 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 X-MC-Unique: RhbKAhwwMXGls5YBoEvDRA-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" This will allow some testing before refactoring. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 72 ++++++++++++++++++++++++-------------- src/qemu/qemu_checkpoint.h | 7 ++++ 2 files changed, 53 insertions(+), 26 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 1100f6e744..e75cdd0458 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -148,6 +148,46 @@ qemuCheckpointFindActiveDiskInParent(virDomainObjPtr v= m, } +int +qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, + const char *delbitmap, + const char *parentbitmap, + bool chkcurrent, + virJSONValuePtr actions) +{ + if (parentbitmap) { + g_autoptr(virJSONValue) arr =3D NULL; + + if (!(arr =3D virJSONValueNewArray())) + return -1; + + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, + src->nodeform= at, + delbitmap) < = 0) + return -1; + + if (chkcurrent) { + if (qemuMonitorTransactionBitmapEnable(actions, + src->nodeformat, + parentbitmap) < 0) + return -1; + } + + if (qemuMonitorTransactionBitmapMerge(actions, + src->nodeformat, + parentbitmap, &arr) < 0) + return -1; + } + + if (qemuMonitorTransactionBitmapRemove(actions, + src->nodeformat, + delbitmap) < 0) + return -1; + + return 0; +} + + static int qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, virDomainCheckpointDefPtr chkdef, @@ -167,6 +207,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, virDomainCheckpointDiskDef *chkdisk =3D &chkdef->disks[i]; virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); virDomainCheckpointDiskDef *parentchkdisk =3D NULL; + const char *parentbitmap =3D NULL; /* domdisk can be missing e.g. when it was unplugged */ if (!domdisk) @@ -178,33 +219,12 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, /* If any ancestor checkpoint has a bitmap for the same * disk, then this bitmap must be merged to the * ancestor. */ - if ((parentchkdisk =3D qemuCheckpointFindActiveDiskInParent(vm, pa= rent, chkdisk->name))) { - g_autoptr(virJSONValue) arr =3D NULL; - - if (!(arr =3D virJSONValueNewArray())) - return -1; - - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, - domdisk->= src->nodeformat, - chkdisk->= bitmap) < 0) - return -1; - - if (chkcurrent) { - if (qemuMonitorTransactionBitmapEnable(actions, - domdisk->src->nodef= ormat, - parentchkdisk->bitm= ap) < 0) - return -1; - } - - if (qemuMonitorTransactionBitmapMerge(actions, - domdisk->src->nodeformat, - parentchkdisk->bitmap, &= arr) < 0) - return -1; - } + if ((parentchkdisk =3D qemuCheckpointFindActiveDiskInParent(vm, pa= rent, + chkdisk-= >name))) + parentbitmap =3D parentchkdisk->name; - if (qemuMonitorTransactionBitmapRemove(actions, - domdisk->src->nodeformat, - chkdisk->bitmap) < 0) + if (qemuCheckpointDiscardDiskBitmaps(domdisk->src, chkdisk->bitmap, + parentbitmap, chkcurrent, act= ions) < 0) return -1; } diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index eb85611ea6..85fd453d50 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -71,3 +71,10 @@ qemuCheckpointCreateFinalize(virQEMUDriverPtr driver, void qemuCheckpointRollbackMetadata(virDomainObjPtr vm, virDomainMomentObjPtr chk); + +int +qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, + const char *delbitmap, + const char *parentbitmap, + bool chkcurrent, + virJSONValuePtr actions); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 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 From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1578594127; cv=none; d=zohomail.com; s=zohoarc; b=LZOA34v9b6bsnYHYFMP8lXNLPFTo7Lzz++NvWVQTY53vd/wkH0gnfKy+UudrGGwakZJZnT6G5Nx8g193uZwm8WnfjmqYctItgT1CPTsT3AT+P0LRBrrImbznkQjvFkFJ+c/wyFO90o7yGtTX36Xv8aEqoRGNXYLFhBZ3xS6Cp+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594127; 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=JYA6460sMENWuyDk+T2nAyv0XdtuoM4Br+VzdSmxX/w=; b=nlT+LSZi9MJtcY2GkOs3HU8LIVoJwxuYsJKK8HysnA9U5ObMS6eauSo4t+kGedZRwomm8a72i/dr2hrVPSj5TnIQJI8MC/ymaHvz3pP0kjruLra3pvRqg1kvwHKr1Wjji5Ycl5Y63AfEG1pJ3E3GXUFpzXD9MhiFq9SraYK4WmY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1578594127724437.78328061006425; Thu, 9 Jan 2020 10:22:07 -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-177-sj2dAEIrO9y7RPAG2jzoJQ-1; Thu, 09 Jan 2020 13:22:01 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C4C6D8024D8; Thu, 9 Jan 2020 18:21:55 +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 9DD5E5DA2C; Thu, 9 Jan 2020 18:21:55 +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 5CC8E503CF; Thu, 9 Jan 2020 18:21:55 +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 009ILe0C018327 for ; Thu, 9 Jan 2020 13:21:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02AB37C3D0; Thu, 9 Jan 2020 18:21:40 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 578097C015; Thu, 9 Jan 2020 18:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594126; 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=JYA6460sMENWuyDk+T2nAyv0XdtuoM4Br+VzdSmxX/w=; b=IvWqVjR4sNHl+9LEzYD7iv1c3humVwY4HetQPBze+Zu+3JwzhaEwjGxPNmIvvZhfwaepqy R82rOyIKmtbgBunal4PiMTzZQtt7DYmXvMKvcX3svxAvfsOQmmyQUfVr+ZREd/NmZp51tf FH34dewAGkxgahBpTc2cr7YLMVs5rdY= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:17 +0100 Message-Id: <9647c9781564526431b6ded570eb1f44bc1d6c23.1578593859.git.pkrempa@redhat.com> 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 11/16] tests: qemublock: Add few more test cases for checkpoint deletion 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.14 X-MC-Unique: sj2dAEIrO9y7RPAG2jzoJQ-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 all intermediate steps and deletion of the current checkpoint on a flat (single-image) disk image. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 4 +++ .../checkpointdelete/basic-current-out.json | 29 +++++++++++++++++++ .../basic-intermediate1-out.json | 22 ++++++++++++++ .../basic-intermediate2-out.json | 22 ++++++++++++++ .../basic-intermediate3-out.json | 22 ++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-current-= out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermed= iate1-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermed= iate2-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/basic-intermed= iate3-out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3ed2486ad2..203e0f70b1 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -999,6 +999,10 @@ mymain(void) } while (0) TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate1", "b", "a"); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate2", "c", "b"); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c"); + TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/checkpointdelete/basic-current-out.jso= n b/tests/qemublocktestdata/checkpointdelete/basic-current-out.json new file mode 100644 index 0000000000..1b607567e8 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/basic-current-out.json @@ -0,0 +1,29 @@ +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "current" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-o= ut.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.= json new file mode 100644 index 0000000000..eccb7ed15f --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate1-out.json @@ -0,0 +1,22 @@ +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "b" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-o= ut.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.= json new file mode 100644 index 0000000000..de40e4b5b0 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate2-out.json @@ -0,0 +1,22 @@ +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "c" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-o= ut.json b/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.= json new file mode 100644 index 0000000000..b5d85f43f0 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/basic-intermediate3-out.json @@ -0,0 +1,22 @@ +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + } +] --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 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=1578594125; cv=none; d=zohomail.com; s=zohoarc; b=MUbMxvcR8phc3eNY0MkPOo6xFQBfvSvLlTwNNBmrKp5lN6IHp1j2NXk8pbN9pKavsNc+RxMHUtInbGNz9UQC6cMhgoI5Ox8Dy++03NPORjV561NhMc8uGjNEol0ki8o545TM6L8eL5ge9pPsxPLttgNBkuNO5OB1nNLTxX9jxSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594125; 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=Bcj0Lr0wfT8/zmn8kUAcdopYe3mFoILysTThcRE2IG0=; b=aDJzNPT0tUTTCD7vwtG+yEmTIS+v9d40dqHYCJu6nua39QhXxxhJ1UYN8JSE11b6srZMWHONfeSMDv8EsSQvGwZwfQ2uZ1JVZoQ+LekQ/kAHezhDHFPCrqihDGdeLf/IJCL0pZwt6hfbGX9ZNrh7TDfhp9hs7Qx50DNAz9Kofl4= 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 1578594125146270.33229348342616; Thu, 9 Jan 2020 10:22:05 -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-364-nsWyPWWjOySHwWVK9k_Q7A-1; Thu, 09 Jan 2020 13:22:00 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DEDD3102CE17; Thu, 9 Jan 2020 18:21:52 +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 B78997C3E7; Thu, 9 Jan 2020 18:21:52 +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 70EF8503CB; Thu, 9 Jan 2020 18:21:52 +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 009ILfo8018339 for ; Thu, 9 Jan 2020 13:21:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 242057C015; Thu, 9 Jan 2020 18:21:41 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 520139A84; Thu, 9 Jan 2020 18:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594122; 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=Bcj0Lr0wfT8/zmn8kUAcdopYe3mFoILysTThcRE2IG0=; b=GKP2mBLR6WtTD3AQlsopQvlNPP/5MPWe+IU1i/QIFRH5liZgaB/6UULWQpbgm25r1uSyuT LynBi1uJrIsT33y120UrgyIzL18HDjNDU7KDEclB0OrQ/iKH+dQ4ZcnNJlK//VK593gpJj Kk1wlosJoOzQBh3m7TlIuM1YGx9xs4g= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:18 +0100 Message-Id: <25524098795b56bc3054d84bbfaddabad186ff8b.1578593859.git.pkrempa@redhat.com> 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 12/16] tests: qemublock: Add synthetic snapshot+checkpoint test data 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.15 X-MC-Unique: nsWyPWWjOySHwWVK9k_Q7A-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 a faked qemu output which would simulate scenario where libvirt would take a snapshot and checkpoint simultaneously. This is visible in libvirt-2-format node where bitmap 'c' appears, but bitmap 'b' which is active in the previous layer is not present. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 1 + .../snapshots-synthetic-checkpoint.json | 827 ++++++++++++++++++ .../bitmap/snapshots-synthetic-checkpoint.out | 13 + 3 files changed, 841 insertions(+) create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-chec= kpoint.json create mode 100644 tests/qemublocktestdata/bitmap/snapshots-synthetic-chec= kpoint.out diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 203e0f70b1..8a3f7da029 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -966,6 +966,7 @@ mymain(void) TEST_BITMAP_DETECT("basic"); TEST_BITMAP_DETECT("synthetic"); TEST_BITMAP_DETECT("snapshots"); + TEST_BITMAP_DETECT("snapshots-synthetic-checkpoint"); #define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named) \ do { \ diff --git a/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.= json b/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.json new file mode 100644 index 0000000000..25cc150d67 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.json @@ -0,0 +1,827 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911540", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "d", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "c", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911527", + "backing-filename": "/tmp/pull4.1575911527", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911550", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "in-use", + "auto" + ], + "name": "current", + "granularity": 65536 + }, + { + "flags": [ + "in-use" + ], + "name": "d", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911540", + "backing-filename": "/tmp/pull4.1575911540", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-format", + "backing_file_depth": 4, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911540", + "dirty-bitmaps": [ + { + "name": "d", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "current", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911550", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 393728, + "filename": "/tmp/pull4.1575911550", + "format": "file", + "actual-size": 212992, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911550", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911540", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "d", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "c", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911527", + "backing-filename": "/tmp/pull4.1575911527", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-2-format", + "backing_file_depth": 3, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911527", + "dirty-bitmaps": [ + { + "name": "c", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "d", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911540", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 393728, + "filename": "/tmp/pull4.1575911540", + "format": "file", + "actual-size": 212992, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-2-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911540", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-3-format", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911522", + "dirty-bitmaps": [ + { + "name": "a", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "b", + "recording": true, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911527", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 459264, + "filename": "/tmp/pull4.1575911527", + "format": "file", + "actual-size": 217088, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-3-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911527", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-4-format", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.qcow2", + "dirty-bitmaps": [ + { + "name": "a", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911522", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 328192, + "filename": "/tmp/pull4.1575911522", + "format": "file", + "actual-size": 208896, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-4-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911522", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-5-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "dirty-bitmaps": [ + { + "name": "a", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 328192, + "filename": "/tmp/pull4.qcow2", + "format": "file", + "actual-size": 208896, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-5-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + } +] diff --git a/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.= out b/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.out new file mode 100644 index 0000000000..0270657001 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots-synthetic-checkpoint.out @@ -0,0 +1,13 @@ +libvirt-1-format: + d: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 + current: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 +libvirt-2-format: + c: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 + d: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 +libvirt-3-format: + a: record:0 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 + b: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 +libvirt-4-format: + a: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 +libvirt-5-format: + a: record:1 busy:0 persist:1 inconsist:0 gran:65536 dirty:0 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594130; cv=none; d=zohomail.com; s=zohoarc; b=edUk3a/Kup3o7p/70vuPDDrd5MCns2oFCedcH4W/ceUXdG0dNav/rSEX1Z7yKZqvv5mZGWsgeMnhJUHIpKa/0cNVfbRvcxdoUw/C/lXzIdBJ7fRZGrCk7BcxpNXcWa9MYHYvfFODureU3nRgezQrO7vphUewrDkLr3iP3k3NvmQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594130; 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=AqrAM+L8SK2NxEITKG+7L0lqojvIKDEmXCcNi9wx7BE=; b=heP8bWYBw99DFjjWrJ/hNK6hgAxAEg33/WODaBGaVLe7HdXiL5OEXp+UqQfwdSye5EQ+6wX+OX8eclOS8f2sFNc9g309YC4sYFnaLW80b0UrXZ6aAw8nx2QCGbRQpKf1HjtF9SScwKDt8Y72VaASg+oB9DbzWHZCpvC1GPJz3Ps= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594130194387.59017276525447; Thu, 9 Jan 2020 10:22:10 -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-336-q6gs4EmfPeWI_isFYIBiSg-1; Thu, 09 Jan 2020 13:22:03 -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 7E5FF100727F; Thu, 9 Jan 2020 18:21:56 +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 58FFF86CC1; Thu, 9 Jan 2020 18:21:56 +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 12F99503D2; Thu, 9 Jan 2020 18:21:56 +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 009ILg2N018349 for ; Thu, 9 Jan 2020 13:21:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1F1CA7C382; Thu, 9 Jan 2020 18:21:42 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 719CC9A84; Thu, 9 Jan 2020 18:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594129; 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=AqrAM+L8SK2NxEITKG+7L0lqojvIKDEmXCcNi9wx7BE=; b=ZFTKhRK5ls267lWNkbWeBjR2teAA4bZUMIEzYSUkhhPgUtGM3YpL3W/1u4ELh2Og8FmEs5 Jt0L29SV/gbGG44JQ8uYOxY+NEM3CsHsiEpBKhBZVlCis6etM7SYnR1Kb0qTNZWfp+160H Bh1sNx8oO+muJJEHw31o3+w4BsAjYkQ= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:19 +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 13/16] qemu: checkpoint: Introduce support for deleting checkpoints accross snapshots 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 X-MC-Unique: q6gs4EmfPeWI_isFYIBiSg-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" Allow deleting of checkpoints when snapshots were created along. The code tracks and modifies the checkpoint list so that backups can still be taken with such a backing chain. This unfortunately requires to rename few bitmaps (by copying and deleting them) in some cases. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 112 ++++++++++++++++++++++++++++--------- src/qemu/qemu_checkpoint.h | 5 +- tests/qemublocktest.c | 34 +++++++---- 3 files changed, 111 insertions(+), 40 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index e75cdd0458..087a740cf8 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -24,6 +24,7 @@ #include "qemu_capabilities.h" #include "qemu_monitor.h" #include "qemu_domain.h" +#include "qemu_block.h" #include "virerror.h" #include "virlog.h" @@ -150,39 +151,92 @@ qemuCheckpointFindActiveDiskInParent(virDomainObjPtr = vm, int qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, + virHashTablePtr blockNamedNodeData, const char *delbitmap, const char *parentbitmap, - bool chkcurrent, - virJSONValuePtr actions) + virJSONValuePtr actions, + const char *diskdst) { - if (parentbitmap) { - g_autoptr(virJSONValue) arr =3D NULL; + virStorageSourcePtr n =3D src; - if (!(arr =3D virJSONValueNewArray())) - return -1; + /* find the backing chain entry with bitmap named '@bitmap' */ + while (n) { + qemuBlockNamedNodeDataBitmapPtr tmp; - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, - src->nodeform= at, - delbitmap) < = 0) - return -1; + if ((tmp =3D qemuBlockNamedNodeDataGetBitmapByName(blockNamedNodeD= ata, + n, delbitmap))) { + break; + } + + n =3D n->backingStore; + } + + if (!n) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("bitmap '%s' not found in backing chain of '%s'"), + delbitmap, diskdst); + return -1; + } - if (chkcurrent) { - if (qemuMonitorTransactionBitmapEnable(actions, - src->nodeformat, - parentbitmap) < 0) + while (n) { + qemuBlockNamedNodeDataBitmapPtr srcbitmap; + + if (!(srcbitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNam= edNodeData, + n, delbitm= ap))) + break; + + /* For the actual checkpoint deletion we will merge any bitmap int= o the + * bitmap of the parent checkpoint (@mergebitmap) or for any image + * where the parent checkpoint bitmap is not present we must rename + * the bitmap of the deleted checkpoint into the bitmap of the par= ent + * checkpoint as qemu can't currently take the allocation map and = turn + * it into a bitmap and thus we wouldn't be able to do a backup. */ + if (parentbitmap) { + qemuBlockNamedNodeDataBitmapPtr dstbitmap; + g_autoptr(virJSONValue) arr =3D NULL; + + dstbitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNamed= NodeData, + n, parentbit= map); + + if (dstbitmap) { + if (srcbitmap->recording && !dstbitmap->recording) { + if (qemuMonitorTransactionBitmapEnable(actions, + n->nodeformat, + dstbitmap->name= ) < 0) + return -1; + } + + } else { + if (qemuMonitorTransactionBitmapAdd(actions, + n->nodeformat, + parentbitmap, + true, + !srcbitmap->recording, + srcbitmap->granularity= ) < 0) + return -1; + } + + if (!(arr =3D virJSONValueNewArray())) + return -1; + + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(arr, + n->nodefo= rmat, + srcbitmap= ->name) < 0) + return -1; + + if (qemuMonitorTransactionBitmapMerge(actions, + n->nodeformat, + parentbitmap, &arr) < 0) return -1; } - if (qemuMonitorTransactionBitmapMerge(actions, - src->nodeformat, - parentbitmap, &arr) < 0) + if (qemuMonitorTransactionBitmapRemove(actions, + n->nodeformat, + srcbitmap->name) < 0) return -1; - } - if (qemuMonitorTransactionBitmapRemove(actions, - src->nodeformat, - delbitmap) < 0) - return -1; + n =3D n->backingStore; + } return 0; } @@ -191,11 +245,11 @@ qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr = src, static int qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, virDomainCheckpointDefPtr chkdef, - bool chkcurrent, virDomainMomentObjPtr parent) { qemuDomainObjPrivatePtr priv =3D vm->privateData; virQEMUDriverPtr driver =3D priv->driver; + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; int rc; g_autoptr(virJSONValue) actions =3D NULL; size_t i; @@ -203,6 +257,11 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, if (!(actions =3D virJSONValueNewArray())) return -1; + qemuDomainObjEnterMonitor(driver, vm); + blockNamedNodeData =3D qemuMonitorBlockGetNamedNodeData(priv->mon); + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeD= ata) + return -1; + for (i =3D 0; i < chkdef->ndisks; i++) { virDomainCheckpointDiskDef *chkdisk =3D &chkdef->disks[i]; virDomainDiskDefPtr domdisk =3D virDomainDiskByTarget(vm->def, chk= disk->name); @@ -223,8 +282,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, chkdisk-= >name))) parentbitmap =3D parentchkdisk->name; - if (qemuCheckpointDiscardDiskBitmaps(domdisk->src, chkdisk->bitmap, - parentbitmap, chkcurrent, act= ions) < 0) + if (qemuCheckpointDiscardDiskBitmaps(domdisk->src, blockNamedNodeD= ata, + chkdisk->bitmap, parentbitmap, + actions, domdisk->dst) < 0) return -1; } @@ -262,7 +322,7 @@ qemuCheckpointDiscard(virQEMUDriverPtr driver, virDomainCheckpointDefPtr chkdef =3D virDomainCheckpointObjGetDef(= chk); parent =3D virDomainCheckpointFindByName(vm->checkpoints, chk->def->parent_name); - if (qemuCheckpointDiscardBitmaps(vm, chkdef, chkcurrent, parent) <= 0) + if (qemuCheckpointDiscardBitmaps(vm, chkdef, parent) < 0) return -1; } diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index 85fd453d50..976b1eed0f 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -74,7 +74,8 @@ qemuCheckpointRollbackMetadata(virDomainObjPtr vm, int qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, + virHashTablePtr blockNamedNodeData, const char *delbitmap, const char *parentbitmap, - bool chkcurrent, - virJSONValuePtr actions); + virJSONValuePtr actions, + const char *diskdst); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 8a3f7da029..293757b8d4 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -704,6 +704,7 @@ struct testQemuCheckpointDeleteMergeData { virStorageSourcePtr chain; const char *deletebitmap; const char *parentbitmap; + const char *nodedatafile; }; @@ -714,22 +715,30 @@ testQemuCheckpointDeleteMerge(const void *opaque) g_autofree char *actual =3D NULL; g_autofree char *expectpath =3D NULL; g_autoptr(virJSONValue) actions =3D NULL; - bool currentcheckpoint; + g_autoptr(virJSONValue) nodedatajson =3D NULL; + g_autoptr(virHashTable) nodedata =3D NULL; expectpath =3D g_strdup_printf("%s/%s%s-out.json", abs_srcdir, checkpointDeletePrefix, data->name); - if (!(actions =3D virJSONValueNewArray())) + if (!(nodedatajson =3D virTestLoadFileJSON(bitmapDetectPrefix, data->n= odedatafile, + ".json", NULL))) return -1; - /* hack to get the 'current' state until the function stops accepting = it */ - currentcheckpoint =3D STREQ("current", data->deletebitmap); + if (!(nodedata =3D qemuMonitorJSONBlockGetNamedNodeDataJSON(nodedatajs= on))) { + VIR_TEST_VERBOSE("failed to load nodedata JSON\n"); + return -1; + } + + if (!(actions =3D virJSONValueNewArray())) + return -1; if (qemuCheckpointDiscardDiskBitmaps(data->chain, + nodedata, data->deletebitmap, data->parentbitmap, - currentcheckpoint, - actions) < 0) { + actions, + "testdisk") < 0) { VIR_TEST_VERBOSE("failed to generate checkpoint delete transaction= \n"); return -1; } @@ -988,22 +997,23 @@ 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) \ +#define TEST_CHECKPOINT_DELETE_MERGE(testname, delbmp, parbmp, named) \ do { \ checkpointdeletedata.name =3D testname; \ checkpointdeletedata.chain =3D bitmapSourceChain; \ checkpointdeletedata.deletebitmap =3D delbmp; \ checkpointdeletedata.parentbitmap =3D parbmp; \ + checkpointdeletedata.nodedatafile =3D named; \ if (virTestRun("checkpoint delete " testname, \ testQemuCheckpointDeleteMerge, &checkpointdeletedat= a) < 0) \ ret =3D -1; \ } while (0) - TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL); - TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate1", "b", "a"); - TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate2", "c", "b"); - TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c"); - TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d"); + TEST_CHECKPOINT_DELETE_MERGE("basic-noparent", "a", NULL, "basic"); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate1", "b", "a", "basic"); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate2", "c", "b", "basic"); + TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c", "basic"); + TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d", "basic"); cleanup: virHashFree(diskxmljsondata.schema); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1578594130; cv=none; d=zohomail.com; s=zohoarc; b=jwCish1Rpgl7egjBFxcmAF4JpDErclDDwHzVL7A13W/To1ZTsLVejWheVv25ZL1vKvfBPGmJWDfed54hhHQWPHH3glnzK2ax+Hg2Y+jhBvJF8v04IdkKpnMOjTt9qn0UO5rlywj5TAOAFmD3/b6UmBakrB9BWj05xg8gh7kuezo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594130; 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=egneNVAo9CmETHYr6NsylMRW2vxVpmB30bA3qF47be0=; b=VMYILwjhOeQdT3Qden6RJOETI+jYHUtfF4H+lJZvHzsJNnqZUbGgV2XUsuAQvxq3y/OgqDpJJgSTWf9Z7kKafYrSlsq3CFLZTXo9msIN8/8SOSYTJ9oaLWG+BivGyisMTZvJhNfsDBsv+1LGkHhZDtcIzt/0VZVMjUgN+e8gWgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1578594130769995.835983557463; Thu, 9 Jan 2020 10:22:10 -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-406-_NMvBc-QOCqeXasCBmDhCw-1; Thu, 09 Jan 2020 13:22:08 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D05AD1007286; Thu, 9 Jan 2020 18:21: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 A746D5DA66; Thu, 9 Jan 2020 18:21:59 +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 65D49503D8; Thu, 9 Jan 2020 18:21:59 +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 009ILjvH018367 for ; Thu, 9 Jan 2020 13:21:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id A48EB9A84; Thu, 9 Jan 2020 18:21:45 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0530E7C3E1; Thu, 9 Jan 2020 18:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594129; 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=egneNVAo9CmETHYr6NsylMRW2vxVpmB30bA3qF47be0=; b=ingPL5Mcr2c0SDbuThTdN0FpW634qLgremEfzP7gdTvv62q7WuCeveUGzE6Bn+HUVIXjQi P2j6DN8EsQu8RLtVXHRNAj+tJKGKA4M/xj8esBL+H7PeX/cSTqc5T+ZduaKp8leFbul00/ G7dOubhoDRbrhZG0vj3FJP5+dHZjfWc= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:20 +0100 Message-Id: <17840951a7a3fb012061fbf8d52c4c0a4709904d.1578593859.git.pkrempa@redhat.com> 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 14/16] tests: qemublock: Add checkpoint deletion test for deep backing chain 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.14 X-MC-Unique: _NMvBc-QOCqeXasCBmDhCw-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 cases for merging various pairs of bitmaps when snapshots were created together with checkpoints. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 6 +++ .../snapshots-current-out.json | 29 +++++++++++ .../snapshots-intermediate1-out.json | 22 ++++++++ .../snapshots-intermediate2-out.json | 52 +++++++++++++++++++ .../snapshots-intermediate3-out.json | 52 +++++++++++++++++++ .../snapshots-noparent-out.json | 23 ++++++++ 6 files changed, 184 insertions(+) create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-curr= ent-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-inte= rmediate1-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-inte= rmediate2-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-inte= rmediate3-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-nopa= rent-out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 293757b8d4..b8a052b19b 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1015,6 +1015,12 @@ mymain(void) TEST_CHECKPOINT_DELETE_MERGE("basic-intermediate3", "d", "c", "basic"); TEST_CHECKPOINT_DELETE_MERGE("basic-current", "current", "d", "basic"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-noparent", "a", NULL, "snapsho= ts"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate1", "b", "a", "sna= pshots"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate2", "c", "b", "sna= pshots"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "sna= pshots"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "sna= pshots"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-current-out= .json b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json new file mode 100644 index 0000000000..1b607567e8 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-current-out.json @@ -0,0 +1,29 @@ +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "current" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te1-out.json new file mode 100644 index 0000000000..29fefeea63 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.= json @@ -0,0 +1,22 @@ +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te2-out.json new file mode 100644 index 0000000000..ca5627269c --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.= json @@ -0,0 +1,52 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-2-format", + "name": "c" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-3-format", + "name": "c" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te3-out.json new file mode 100644 index 0000000000..ee7ae97fdb --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.= json @@ -0,0 +1,52 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-1-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-2-format", + "name": "d" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-ou= t.json b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.js= on new file mode 100644 index 0000000000..45a84b47c2 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json @@ -0,0 +1,23 @@ +[ + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-3-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1578594227; cv=none; d=zohomail.com; s=zohoarc; b=I6ZrYCRYmzZ0JRtCzGslgwuzBQ4T5EhadXQ+tQCTUAAy/xmf9Az2YOx9G9T5ZG+qQ1QAZ0Zx76K2w5TytCEZ/AeseHeR/V8LFDY+P7Mv5Zer8KmirrymXQf6zI+steosn22im81ZZipwcIrI/Q+kqYI9yBIGjpsLMj5FiJoX3mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594227; 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=7b1g3vs6V6qlj7C8TezIUQbapXFbz54jXIBYqhji8R4=; b=BCbOhRRKL/ngSl1l5dfkP/bIXmEw2mYEOEn5SnR+SzkC7tX0Cpipxys9ZX6zuiIGYZwu/PpQ4/U46YqNpacg2ihQ25Tw4zIlz6QWGxM2OlF1cgKHl44yHEwfS767uwed6RDxGzSw2DYUUCCfKRyP5gUccrSQQC1FXMG8KU22jWQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1578594227324110.61874252859002; Thu, 9 Jan 2020 10:23: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-27-JwzFkTl7PCW39jHfsshNnQ-1; Thu, 09 Jan 2020 13:22:13 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E7908018DC; Thu, 9 Jan 2020 18:22:04 +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 441089A84; Thu, 9 Jan 2020 18:22: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 D817C1803C32; Thu, 9 Jan 2020 18:22:03 +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 009ILpRm018387 for ; Thu, 9 Jan 2020 13:21:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 319A67C3E2; Thu, 9 Jan 2020 18:21:51 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F2EE7C015; Thu, 9 Jan 2020 18:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594226; 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=7b1g3vs6V6qlj7C8TezIUQbapXFbz54jXIBYqhji8R4=; b=iYOmxSm+kqtObzdiBWiZZzEbgPr7Y5GmnW1zd5qml2h39bywywVt/EbVnE/43HPC0ujp23 piR3NpJP0wOaB5y/G67zd39OtCM1+t0KRJP5m+HHsOvLlCSKd+mato0T634G07MSaUzzsT j3ZtlsqXZBxhlSY4syo9cQ6JdvDf5gg= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:21 +0100 Message-Id: <6535488f199d608c219f0debe41dc8796c19305e.1578593859.git.pkrempa@redhat.com> 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 15/16] tests: qemublock: Add checkpoint deletion tests for some special cases 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.15 X-MC-Unique: JwzFkTl7PCW39jHfsshNnQ-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" Use the synthetic test data to verify that the algorithm correctly picks bitmaps to merge when the bitmap is changed along with the image itself. Signed-off-by: Peter Krempa --- tests/qemublocktest.c | 7 +++ .../snapshots-intermediate2-out.json | 7 +++ .../snapshots-intermediate3-out.json | 7 +++ ...hots-synthetic-checkpoint-current-out.json | 29 +++++++++ ...ynthetic-checkpoint-intermediate1-out.json | 29 +++++++++ ...ynthetic-checkpoint-intermediate2-out.json | 32 ++++++++++ ...ynthetic-checkpoint-intermediate3-out.json | 59 +++++++++++++++++++ ...ots-synthetic-checkpoint-noparent-out.json | 23 ++++++++ 8 files changed, 193 insertions(+) create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synt= hetic-checkpoint-current-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synt= hetic-checkpoint-intermediate1-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synt= hetic-checkpoint-intermediate2-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synt= hetic-checkpoint-intermediate3-out.json create mode 100644 tests/qemublocktestdata/checkpointdelete/snapshots-synt= hetic-checkpoint-noparent-out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index b8a052b19b..c2c7507e20 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1021,6 +1021,13 @@ mymain(void) TEST_CHECKPOINT_DELETE_MERGE("snapshots-intermediate3", "d", "c", "sna= pshots"); TEST_CHECKPOINT_DELETE_MERGE("snapshots-current", "current", "d", "sna= pshots"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-noparent"= , "a", NULL, "snapshots-synthetic-checkpoint"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermedi= ate1", "b", "a", "snapshots-synthetic-checkpoint"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermedi= ate2", "c", "b", "snapshots-synthetic-checkpoint"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-intermedi= ate3", "d", "c", "snapshots-synthetic-checkpoint"); + TEST_CHECKPOINT_DELETE_MERGE("snapshots-synthetic-checkpoint-current",= "current", "d", "snapshots-synthetic-checkpoint"); + + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te2-out.json index ca5627269c..4da21a9df7 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.= json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.= json @@ -29,6 +29,13 @@ "name": "c" } }, + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + }, { "type": "block-dirty-bitmap-merge", "data": { diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te3-out.json index ee7ae97fdb..dc87dd60b8 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.= json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.= json @@ -29,6 +29,13 @@ "name": "d" } }, + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-2-format", + "name": "c" + } + }, { "type": "block-dirty-bitmap-merge", "data": { diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-current-out.json b/tests/qemublocktestdata/checkpointdelete/snaps= hots-synthetic-checkpoint-current-out.json new file mode 100644 index 0000000000..1b607567e8 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-current-out.json @@ -0,0 +1,29 @@ +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "current" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate1-out.json new file mode 100644 index 0000000000..e979691e6f --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate1-out.json @@ -0,0 +1,29 @@ +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate2-out.json new file mode 100644 index 0000000000..e82098918a --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate2-out.json @@ -0,0 +1,32 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-2-format", + "name": "c" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate3-out.json new file mode 100644 index 0000000000..dc87dd60b8 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate3-out.json @@ -0,0 +1,59 @@ +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-1-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-1-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-1-format", + "name": "d" + } + }, + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-2-format", + "name": "c" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-2-format", + "name": "d" + } + } +] diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snap= shots-synthetic-checkpoint-noparent-out.json new file mode 100644 index 0000000000..45a84b47c2 --- /dev/null +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-noparent-out.json @@ -0,0 +1,23 @@ +[ + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-3-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-remove", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 26 14:50:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1578594130; cv=none; d=zohomail.com; s=zohoarc; b=eBbKrl+hEOUvdX0FXk52RiowROqQqOivdVWHgDxLGzkmppeMoss2GGfGHgNgJDJ3/Zt39gVKgfO1pppJITvMGh61BnAeqcKlpIrsETidago6KJWG3VGReb3wBZw4CulNcc2p8CLJfr7Fkj/yrvyNg2d8Mcfg2prFXlQ+YN/nMSk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578594130; 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=11+4tBRLoBLEgs0UaZbnB0hnUJbbLY+yoAjR4DGsvdU=; b=R0i8+cOrifPo5ZEwo2y++tqObSddbmCK9U/slmsuIT0YLPZJwaAiJF2GX7xJgnGlSG44EVUnJdTpKPcoHLgT+pcn3NOw9k4qoNosb20xbhg1TbQTiQly7J/wjE9LOfpY4kt/DyGrBhwjxN69FYjCuEHT/KaeGb9DPnbpcurE2dM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1578594130539216.70898976842636; Thu, 9 Jan 2020 10:22:10 -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-101-QrToXC2bPGSzPFkzOYV1ZA-1; Thu, 09 Jan 2020 13:22:06 -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 8B706DBC7; Thu, 9 Jan 2020 18:21:58 +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 65FEE5C57C; Thu, 9 Jan 2020 18:21:58 +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 192C1503D4; Thu, 9 Jan 2020 18:21:58 +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 009ILuX1018403 for ; Thu, 9 Jan 2020 13:21:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1FC507C3E8; Thu, 9 Jan 2020 18:21:56 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BDFF7C3E7; Thu, 9 Jan 2020 18:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578594129; 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=11+4tBRLoBLEgs0UaZbnB0hnUJbbLY+yoAjR4DGsvdU=; b=gGXurlM5WMuuLjdsH38ACOmusTZDCHPOYzJN8WeWTg4zUflR45N7pFSWq0/X74az5SIjdc CRqGQYK1t1CfcqO/8HVKfDtEYDBZaGREfjAuR1x1WgXO7GjddvxHScGaF8yGKIDV573t0L 1uyTPwWzC4CjbA2q5F9CjbIDDb/fJds= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 19:21:22 +0100 Message-Id: <663e82a9d222d966e6bc97f11b86ee8f54a74cce.1578593859.git.pkrempa@redhat.com> 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 16/16] qemu: checkpoint: Track and relabel images for 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: QrToXC2bPGSzPFkzOYV1ZA-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" Allow qemu access to modify backing files in case when we want to delete a checkpoint. This patch adds tracking of which images need to be relabelled when calculating the transaction, the code to relabel them and rollback. To verify that stuff works we also output the list of images to relabel into the test case output files in qemublocktest. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 33 ++++++++++++++++--- src/qemu/qemu_checkpoint.h | 3 +- tests/qemublocktest.c | 19 +++++++++-- .../snapshots-intermediate1-out.json | 2 ++ .../snapshots-intermediate2-out.json | 3 ++ .../snapshots-intermediate3-out.json | 2 ++ .../snapshots-noparent-out.json | 4 +++ ...ynthetic-checkpoint-intermediate1-out.json | 2 ++ ...ynthetic-checkpoint-intermediate2-out.json | 2 ++ ...ynthetic-checkpoint-intermediate3-out.json | 2 ++ ...ots-synthetic-checkpoint-noparent-out.json | 4 +++ 11 files changed, 69 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 087a740cf8..13bd6653b7 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -155,7 +155,8 @@ qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr sr= c, const char *delbitmap, const char *parentbitmap, virJSONValuePtr actions, - const char *diskdst) + const char *diskdst, + GSList **reopenimages) { virStorageSourcePtr n =3D src; @@ -235,6 +236,9 @@ qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr sr= c, srcbitmap->name) < 0) return -1; + if (n !=3D src) + *reopenimages =3D g_slist_prepend(*reopenimages, n); + n =3D n->backingStore; } @@ -253,6 +257,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, int rc; g_autoptr(virJSONValue) actions =3D NULL; size_t i; + g_autoptr(GSList) reopenimages =3D NULL; + g_autoptr(GSList) relabelimages =3D NULL; + GSList *next; if (!(actions =3D virJSONValueNewArray())) return -1; @@ -284,16 +291,34 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, if (qemuCheckpointDiscardDiskBitmaps(domdisk->src, blockNamedNodeD= ata, chkdisk->bitmap, parentbitmap, - actions, domdisk->dst) < 0) + actions, domdisk->dst, + &reopenimages) < 0) return -1; } + /* label any non-top images for read-write access */ + for (next =3D reopenimages; next; next =3D next->next) { + virStorageSourcePtr src =3D next->data; + + if (qemuDomainStorageSourceAccessAllow(driver, vm, src, false, fal= se) < 0) + goto relabel; + + relabelimages =3D g_slist_prepend(relabelimages, src); + } + qemuDomainObjEnterMonitor(driver, vm); rc =3D qemuMonitorTransaction(priv->mon, &actions); - if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + if (qemuDomainObjExitMonitor(driver, vm) < 0) return -1; - return 0; + relabel: + for (next =3D relabelimages; next; next =3D next->next) { + virStorageSourcePtr src =3D next->data; + + ignore_value(qemuDomainStorageSourceAccessAllow(driver, vm, src, t= rue, false)); + } + + return rc; } diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index 976b1eed0f..cf1e9e46cb 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -78,4 +78,5 @@ qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, const char *delbitmap, const char *parentbitmap, virJSONValuePtr actions, - const char *diskdst); + const char *diskdst, + GSList **reopenimages); diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index c2c7507e20..a368e6a74f 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -717,6 +717,9 @@ testQemuCheckpointDeleteMerge(const void *opaque) g_autoptr(virJSONValue) actions =3D NULL; g_autoptr(virJSONValue) nodedatajson =3D NULL; g_autoptr(virHashTable) nodedata =3D NULL; + g_autoptr(GSList) reopenimages =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + GSList *tmp; expectpath =3D g_strdup_printf("%s/%s%s-out.json", abs_srcdir, checkpointDeletePrefix, data->name); @@ -738,14 +741,26 @@ testQemuCheckpointDeleteMerge(const void *opaque) data->deletebitmap, data->parentbitmap, actions, - "testdisk") < 0) { + "testdisk", + &reopenimages) < 0) { VIR_TEST_VERBOSE("failed to generate checkpoint delete transaction= \n"); return -1; } - if (!(actual =3D virJSONValueToString(actions, true))) + if (virJSONValueToBuffer(actions, &buf, true) < 0) return -1; + if (reopenimages) { + virBufferAddLit(&buf, "reopen nodes:\n"); + + for (tmp =3D reopenimages; tmp; tmp =3D tmp->next) { + virStorageSourcePtr src =3D tmp->data; + virBufferAsprintf(&buf, "%s\n", src->nodeformat); + } + } + + actual =3D virBufferContentAndReset(&buf); + return virTestCompareToFile(actual, expectpath); } diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e1-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te1-out.json index 29fefeea63..c9bda3a17a 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.= json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate1-out.= json @@ -20,3 +20,5 @@ } } ] +reopen nodes: +libvirt-3-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e2-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te2-out.json index 4da21a9df7..8a0e3f2cff 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.= json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate2-out.= json @@ -57,3 +57,6 @@ } } ] +reopen nodes: +libvirt-3-format +libvirt-2-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediat= e3-out.json b/tests/qemublocktestdata/checkpointdelete/snapshots-intermedia= te3-out.json index dc87dd60b8..211bc40baf 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.= json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-intermediate3-out.= json @@ -57,3 +57,5 @@ } } ] +reopen nodes: +libvirt-2-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-ou= t.json b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.js= on index 45a84b47c2..f750f44da2 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-noparent-out.json @@ -21,3 +21,7 @@ } } ] +reopen nodes: +libvirt-5-format +libvirt-4-format +libvirt-3-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate1-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate1-out.json index e979691e6f..d7e6d18637 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate1-out.json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate1-out.json @@ -27,3 +27,5 @@ } } ] +reopen nodes: +libvirt-3-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate2-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate2-out.json index e82098918a..cfbff010c2 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate2-out.json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate2-out.json @@ -30,3 +30,5 @@ } } ] +reopen nodes: +libvirt-2-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-intermediate3-out.json b/tests/qemublocktestdata/checkpointdelete= /snapshots-synthetic-checkpoint-intermediate3-out.json index dc87dd60b8..211bc40baf 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate3-out.json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-intermediate3-out.json @@ -57,3 +57,5 @@ } } ] +reopen nodes: +libvirt-2-format diff --git a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-c= heckpoint-noparent-out.json b/tests/qemublocktestdata/checkpointdelete/snap= shots-synthetic-checkpoint-noparent-out.json index 45a84b47c2..f750f44da2 100644 --- a/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-noparent-out.json +++ b/tests/qemublocktestdata/checkpointdelete/snapshots-synthetic-checkpoi= nt-noparent-out.json @@ -21,3 +21,7 @@ } } ] +reopen nodes: +libvirt-5-format +libvirt-4-format +libvirt-3-format --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list