From nobody Sun May 19 01:43:07 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-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=1583931383; cv=none; d=zohomail.com; s=zohoarc; b=UDySvtr9xy05NIRTwevNM64qFh53l2FGjzBWA/e66saJtYnqcOF77KzC1emck41bWU8fwMw75mDZiQToNOPOw6iJ8HDxETUL42yN0agDLQeXDKSZNVXKTeslVkjwaOuEGl2st7X2l9eunRKTIEGJz6IMu0cymarzY8Fu7f5mJxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931383; 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=5vM423Xip/CDONTFuMI9oX7ey0sm5BgPGu2HlF3ZYko=; b=Mk5OQSzs6RkgWDhL0enC3jMOGQZ+QnR8MNnhOWraCVVALTN1OUq85vy0E7mFUMn1XnWoInLohE/3v32cgS05qvFzQDxVe5R8WlxHK/XiRjSXiOawxiMNqFVVLCs8yykoF+da/p+t5/QuYMyspak2Qqxm0RNvrzxgYRBK0AIwFgQ= 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583931383643326.95175093889804; Wed, 11 Mar 2020 05:56:23 -0700 (PDT) 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-21-5pF-GKcBP-6QSE7eZpOtLQ-1; Wed, 11 Mar 2020 08:56:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 080D7100A5F1; Wed, 11 Mar 2020 12:56:15 +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 D1C528F379; Wed, 11 Mar 2020 12:56:14 +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 8611D1832E26; Wed, 11 Mar 2020 12:56:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCu975009281 for ; Wed, 11 Mar 2020 08:56:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1C9F45C296; Wed, 11 Mar 2020 12:56:09 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E81A5C1D8; Wed, 11 Mar 2020 12:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931382; 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=5vM423Xip/CDONTFuMI9oX7ey0sm5BgPGu2HlF3ZYko=; b=GLzuTW0LM3ZtgHoYGEFOoJBmLeMNn99KcoaeJ0pYkps0gQ8UWE8IPSp9pIl/IEXOjP1J7c ETv+6ooo3W9bG4uTq6yqaE/rwGFomrubaGjEL1AcrXW0VuQRsjI3QM1oA4ZUUQpghi+RIU TuDlj/ZKNdZB7hyBdKhrLG/JFX/mrco= X-MC-Unique: 5pF-GKcBP-6QSE7eZpOtLQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 01/19] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_REOPEN Date: Wed, 11 Mar 2020 13:55:46 +0100 Message-Id: <06904760fbccfa4b09fbc8e133edafcb68c78238.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This capability will be asserted once qemu stabilizes 'blockdev-reopen'. For now we just add the capability so that we can introduce some code that will use the reopening call. This will show our willingness to adopt use of reopen and help qemu developers stabilize it. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_capabilities.c | 1 + src/qemu/qemu_capabilities.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 25a77c24af..c486697d5b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -566,6 +566,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "vhost-user-fs", "query-named-block-nodes.flat", "blockdev-snapshot.allow-write-only-overlay", + "blockdev-reopen", ); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index e952fcb6b8..f0961e273c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -547,6 +547,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_DEVICE_VHOST_USER_FS, /* -device vhost-user-fs */ QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT, /* query-named-block-nodes= supports the 'flat' option */ QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY, /* blockdev-snapshot has= the 'allow-write-only-overlay' feature */ + QEMU_CAPS_BLOCKDEV_REOPEN, /* 'blockdev-reopen' qmp command is support= ed */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931389; cv=none; d=zohomail.com; s=zohoarc; b=Cj07uFOGjSR+fhpweNvTpnLKqHg8L1FwyRGO7+/2I8K/De9yrGhbaTzHL1I5AWYSKztALpIlgsfu3/glZHOLruFSFsuxbWUN8KzHrullMdJu6ERp5sZEs51CuSfHuLMYpWwj8XhWnYRRRqysxIZhgi98fdFwC9qhdqtRr65yPcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931389; 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=py1ig+PJuxfrdfuuWtw3TPwKj+vVKoLmKLiz+4eSKWE=; b=gW1rut/FiwJw0X+rmKC+/PgWDWFYefsvFzu+OBP2CyUsVlLC3DB9lhg0iJ0hDetNht+y+PsobdoaBelsJ26HDrSeDj0aAHeFRLE0MEg1cYYV/L3fLMt9/y0CfRCB/Hil2rEKkmLBI+elccLEBp/3UtuZirG0AxS+nlFJ4IDOPos= 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 1583931389930921.3125110663067; Wed, 11 Mar 2020 05:56:29 -0700 (PDT) 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-468--8nreFx_O8CgzxI4ZtYlCQ-1; Wed, 11 Mar 2020 08:56:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 331B81085927; Wed, 11 Mar 2020 12:56:20 +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 07BCD8F379; Wed, 11 Mar 2020 12:56:20 +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 B15C286A1F; Wed, 11 Mar 2020 12:56:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuAWi009288 for ; Wed, 11 Mar 2020 08:56:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 198345C296; Wed, 11 Mar 2020 12:56:10 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B27B5C1D8; Wed, 11 Mar 2020 12:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931388; 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=py1ig+PJuxfrdfuuWtw3TPwKj+vVKoLmKLiz+4eSKWE=; b=VjNNnX2H1QuY3tWjMQQxirHgPIB0K17BLYb62PAxGN3BgJQJ0l+yTWb8jhDVr6rizU/OBG jNv+Lix2Fdf9rakU7gIyN7e4pVc5yalvC9gxqpYKKplH4Xd6FSdcBuVCDD0h6EjVvO6pST HmR22pqeXZ1xf7OsMFNQxSxS7clUMpU= X-MC-Unique: -8nreFx_O8CgzxI4ZtYlCQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 02/19] qemu: monitor: Add handler for blockdev-reopen Date: Wed, 11 Mar 2020 13:55:47 +0100 Message-Id: <857f3b6bb75357febe8d52e9aac8bd7e1242b4db.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce the monitor code for using blockdev-reopen. For now we'll use x-blockdev-reopen so that the interactions between qemu and libvirt can be tested with the existing code. Since the usage will be guarded by the for-now unasserted capability we'll be able to change the called command when the command will be stabilized. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_monitor.c | 13 +++++++++++++ src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 4 ++++ 4 files changed, 41 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index e54d28b6cc..2a285025df 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4368,6 +4368,19 @@ qemuMonitorBlockdevAdd(qemuMonitorPtr mon, } +int +qemuMonitorBlockdevReopen(qemuMonitorPtr mon, + virJSONValuePtr *props) +{ + VIR_DEBUG("props=3D%p (node-name=3D%s)", *props, + NULLSTR(virJSONValueObjectGetString(*props, "node-name"))); + + QEMU_CHECK_MONITOR(mon); + + return qemuMonitorJSONBlockdevReopen(mon, props); +} + + int qemuMonitorBlockdevDel(qemuMonitorPtr mon, const char *nodename) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2319647a35..5c86da80e5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1319,6 +1319,9 @@ int qemuMonitorBlockdevCreate(qemuMonitorPtr mon, int qemuMonitorBlockdevAdd(qemuMonitorPtr mon, virJSONValuePtr *props); +int qemuMonitorBlockdevReopen(qemuMonitorPtr mon, + virJSONValuePtr *props); + int qemuMonitorBlockdevDel(qemuMonitorPtr mon, const char *nodename); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3eac80c060..88608be49a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8810,6 +8810,27 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon, } +int +qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon, + virJSONValuePtr *props) +{ + g_autoptr(virJSONValue) cmd =3D NULL; + g_autoptr(virJSONValue) reply =3D NULL; + virJSONValuePtr pr =3D g_steal_pointer(props); + + if (!(cmd =3D qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", = pr))) + return -1; + + if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) + return -1; + + if (qemuMonitorJSONCheckError(cmd, reply) < 0) + return -1; + + return 0; +} + + int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon, const char *nodename) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index ed48600b82..5b3bb295eb 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -602,6 +602,10 @@ int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon, virJSONValuePtr *props) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); +int qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon, + virJSONValuePtr *props) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon, const char *nodename) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931382; cv=none; d=zohomail.com; s=zohoarc; b=P17iSzi2hn/NduHd282RpQFuBgGDi6phmZiK//BFV4wkF832zwOWjVIGkcEqvIrIuPJDEzhbarZIiR8ydpH7x3QXSutSQrhfMnKAJ08322bFV0eOrjFcEYUL62+UweV7jwhZ/aG+QBncu/8FXesMWjYsxvazhhd/a62mL4S94r4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931382; 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=6JcsHvdAHaERuFahuYtcJQghcDFtd3RuqqNSA7I7WxA=; b=KSVALz10cueftnNVPBaptLqMXkWMWy7kkBjBfxUcLEy0TC5R8F1jOfz1KSY4tFUpLMFBfu+TYL7PFrmOV1mH+s2LOXQJa126ZaKYWtbI9l/7iXWB/MqoCIf6Tul8Txlq62JHcRGDG59icezCGkCwBpgJrXtFeSxw0zif+LpgilQ= 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 1583931382363913.1467977816261; Wed, 11 Mar 2020 05:56:22 -0700 (PDT) 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-296-EG8h9tljOJC94Wln1jriOA-1; Wed, 11 Mar 2020 08:56:18 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7746B1005510; Wed, 11 Mar 2020 12:56:13 +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 3CBCD10027A4; Wed, 11 Mar 2020 12:56:13 +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 E878286A19; Wed, 11 Mar 2020 12:56:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuB1p009298 for ; Wed, 11 Mar 2020 08:56:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 17A6E5C296; Wed, 11 Mar 2020 12:56:11 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 694625C1D8; Wed, 11 Mar 2020 12:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931381; 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=6JcsHvdAHaERuFahuYtcJQghcDFtd3RuqqNSA7I7WxA=; b=f1+SkdhXP+MEcmbh5bY7qEPfH5UylYXUhR/cJN26ExNIrekpZU5MKAADbl5LPmbGX5J0Jh vQ4MUDxQWbMAwTXxR6jYYGcSdlV4s8Cfa1/OQ/mSUJWL+qi8ub5xzkKzJRN1y7EuG/X/xx V9hN6lOnDWNFeUZ3wHMWnmzQJRqP2iY= X-MC-Unique: EG8h9tljOJC94Wln1jriOA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 03/19] qemu: block: implement helpers for blockdev-reopen Date: Wed, 11 Mar 2020 13:55:48 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Introduce a set of helpers to call blockdev-reopen in certain scenarios Libvirt will use the QMP command to turn certain members of the backing chain read-write for bitmap manipulation and we'll also want to use it to replace/install the backing chain of a qcow2 format node. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_block.c | 101 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 9 ++++ 2 files changed, 110 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 152c73f1bf..edebbcd0ce 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2960,3 +2960,104 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr= src, return 0; } + + +/** + * qemuBlockReopenFormat: + * @vm: domain object + * @src: storage source to reopen + * @asyncJob: qemu async job type + * + * Invokes the 'blockdev-reopen' command on the format layer of @src. This= means + * that @src must be already properly configured for the desired outcome. = The + * nodenames of @src are used to identify the specific image in qemu. + */ +static int +qemuBlockReopenFormat(virDomainObjPtr vm, + virStorageSourcePtr src, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virQEMUDriverPtr driver =3D priv->driver; + g_autoptr(virJSONValue) reopenprops =3D NULL; + int rc; + + /* If we are lacking the object here, qemu might have opened an image = with + * a node name unknown to us */ + if (!src->backingStore) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("can't reopen image with unknown presence of back= ing store")); + return -1; + } + + if (!(reopenprops =3D qemuBlockStorageSourceGetBlockdevProps(src, src-= >backingStore))) + return -1; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) + return -1; + + rc =3D qemuMonitorBlockdevReopen(priv->mon, &reopenprops); + + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; + + return 0; +} + + +/** + * qemuBlockReopenReadWrite: + * @vm: domain object + * @src: storage source to reopen + * @asyncJob: qemu async job type + * + * Wrapper that reopens @src read-write. We currently depend on qemu + * reopening the storage with 'auto-read-only' enabled for us. + * After successful reopen @src's 'readonly' flag is modified. Does nothing + * if @src is already read-write. + */ +int +qemuBlockReopenReadWrite(virDomainObjPtr vm, + virStorageSourcePtr src, + qemuDomainAsyncJob asyncJob) +{ + if (!src->readonly) + return 0; + + src->readonly =3D false; + if (qemuBlockReopenFormat(vm, src, asyncJob) < 0) { + src->readonly =3D true; + return -1; + } + + return 0; +} + + +/** + * qemuBlockReopenReadOnly: + * @vm: domain object + * @src: storage source to reopen + * @asyncJob: qemu async job type + * + * Wrapper that reopens @src read-only. We currently depend on qemu + * reopening the storage with 'auto-read-only' enabled for us. + * After successful reopen @src's 'readonly' flag is modified. Does nothing + * if @src is already read-only. + */ +int +qemuBlockReopenReadOnly(virDomainObjPtr vm, + virStorageSourcePtr src, + qemuDomainAsyncJob asyncJob) +{ + if (src->readonly) + return 0; + + src->readonly =3D true; + if (qemuBlockReopenFormat(vm, src, asyncJob) < 0) { + src->readonly =3D false; + return -1; + } + + return 0; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index eab0128d5d..1d8a364bd0 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -228,3 +228,12 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr sr= c, virHashTablePtr blockNamedNodeData, bool shallow, virJSONValuePtr *actions); + +int +qemuBlockReopenReadWrite(virDomainObjPtr vm, + virStorageSourcePtr src, + qemuDomainAsyncJob asyncJob); +int +qemuBlockReopenReadOnly(virDomainObjPtr vm, + virStorageSourcePtr src, + qemuDomainAsyncJob asyncJob); --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931510; cv=none; d=zohomail.com; s=zohoarc; b=lAFifGvtaltDSP0mkUcpp7Jj3WOjrmWHcY+reQoJR6RKRFeNmWS0Y8dcidojhQPSnUtfs8m3BOzKiDiISPvWYUXGFSHbtgOrDqowPt9tE8jPoZiud9B9+p7Hl0to3KgK/Pg1QyqlmGid2j1nWL6M74V2rTsGXmRBJsUKwBmPrKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931510; 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=fSYHRNvMRU/Fc9ZjqV2Mmn5pUWS+ZSzaISRr9j6iP7E=; b=SRII4yrwgkPxsx5SjUuC70su1Vi6JaOz+eqplP4a+E14S3MaiUeligrgsUm4ElgvGKNG0/uXiN5LZme8omBucl4NhpM+npooWdkxGdUjm6m6unK8/soOQoGkcZAVLZW5emryMNmos4D/1R1vrSVcKr4fAYK1U729RU/c4IqncJk= 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 1583931510722567.4342306797646; Wed, 11 Mar 2020 05:58:30 -0700 (PDT) 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-343-o-VtFtpBN2277xiOcPKJpw-1; Wed, 11 Mar 2020 08:56:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A894813F5; Wed, 11 Mar 2020 12:56:24 +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 7AE811000322; Wed, 11 Mar 2020 12:56:24 +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 310CE1832E29; Wed, 11 Mar 2020 12:56:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuCVp009307 for ; Wed, 11 Mar 2020 08:56:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 165A85C219; Wed, 11 Mar 2020 12:56:12 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67D815C1D8; Wed, 11 Mar 2020 12:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931509; 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=fSYHRNvMRU/Fc9ZjqV2Mmn5pUWS+ZSzaISRr9j6iP7E=; b=WFl0lQXO/F/CaB5sKb6BcR7oJfWH2svJ4czWgdC1qfKpPC+1NJ5MMUWDNvf/jG6LmC1aH1 k41vv2Vb0Vv6l/OG4N9MP3EE4R7bmTxQ7ZYLu1xBVzYP7ZDOFsxBf4sdLj6NLHm8ubloZv m2hb5FNePAtdjBlblB8sP7wQXZ05qwY= X-MC-Unique: o-VtFtpBN2277xiOcPKJpw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 04/19] qemuCheckpointDiscardBitmaps: Reopen images for bitmap modifications Date: Wed, 11 Mar 2020 13:55:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Qemu's bitmap APIs don't reopen the appropriate images read-write for modification. It's libvirt's duty to reopen them via blockdev-reopen if we wish to modify the bitmaps. Use the new helpers to reopen the images for bitmap manipulation. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index ea87b09aa0..5890deb471 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -300,6 +300,10 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, false, false, false) < 0) goto relabel; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN) && + qemuBlockReopenReadWrite(vm, src, QEMU_ASYNC_JOB_NONE) < 0) + goto relabel; + relabelimages =3D g_slist_prepend(relabelimages, src); } @@ -312,6 +316,9 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, for (next =3D relabelimages; next; next =3D next->next) { virStorageSourcePtr src =3D next->data; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) + ignore_value(qemuBlockReopenReadOnly(vm, src, QEMU_ASYNC_JOB_N= ONE)); + ignore_value(qemuDomainStorageSourceAccessAllow(driver, vm, src, true, false, false= )); } --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931557; cv=none; d=zohomail.com; s=zohoarc; b=mwSzZoFCsFt3OocNKGuFK4US/vtYJDAm4sPzWqx1Cugl1731lzoUW0X1Uj2oZvOARAjGnmrFy+Omlzilt6/XAjjWrY0qVVaFFZHjkLsFvci2SSvlScxbMkSX04UH4ewMaEK2reWzSCH6DO/PQZ/y4n90LfC905fcrAcjxRqhT8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931557; 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=ziljqEOhc6FE5gJ8X+B+JkpSxfB0dOMpJCPw9RB1ze4=; b=j6F1BxFvyqW8OxJaB90rfLTzTEvhU2lXVQy21v5icOiaeLPPMVGx83EVmHV77rENZmeRgRiGsm+EU5EBbt4wZgM17ILiWMubM/pljiOd+ubSEK2LyHLVCBOlnxzlfR5v+nEczstm4I21q65jc2da2jQ/k5pfLmhbZeOIny1JVSM= 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 1583931557036117.59072497468537; Wed, 11 Mar 2020 05:59:17 -0700 (PDT) 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-60-a1wHvjbPPcCS63Kr031WhA-1; Wed, 11 Mar 2020 08:56:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EEA3102C8CE; Wed, 11 Mar 2020 12:56:28 +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 29A9F38D; Wed, 11 Mar 2020 12:56:28 +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 C292E1832E38; Wed, 11 Mar 2020 12:56:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuDWp009315 for ; Wed, 11 Mar 2020 08:56:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 12BA15C1D8; Wed, 11 Mar 2020 12:56:13 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65A775C219; Wed, 11 Mar 2020 12:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931555; 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=ziljqEOhc6FE5gJ8X+B+JkpSxfB0dOMpJCPw9RB1ze4=; b=hf/DnlhPGq9VtrM+bKJpF0J15w9Dzdc6zwpbp1jsrXcUyznWmVKah9Wf/Y+nN+Xo5jyJ9K 66k5ukTNufjXgNiIwH5R0hfaQXiQRxdQL6ZmrWFYE7ThsrFoNYvHT6NfVIG7bIHeVEON5z 9eFzez0xTBWfLTLlTNy2oljuGXS2U+s= X-MC-Unique: a1wHvjbPPcCS63Kr031WhA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 05/19] qemuCheckpointDiscardBitmaps: Use correct field for checkpoint bitmap name Date: Wed, 11 Mar 2020 13:55:50 +0100 Message-Id: <65e74b2c16168f238768baf1f3b72a9d789d0277.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The code deleting checkpoints needs the name of the parent checkpoint's disk's bitmap but was using the disk alias instead. This would create wrong bitmaps after deleting some checkpoints. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_checkpoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 5890deb471..76f10a701e 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -283,7 +283,7 @@ qemuCheckpointDiscardBitmaps(virDomainObjPtr vm, * ancestor. */ if ((parentchkdisk =3D qemuCheckpointFindActiveDiskInParent(vm, pa= rent, chkdisk-= >name))) - parentbitmap =3D parentchkdisk->name; + parentbitmap =3D parentchkdisk->bitmap; if (qemuCheckpointDiscardDiskBitmaps(domdisk->src, blockNamedNodeD= ata, chkdisk->bitmap, parentbitmap, --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931405; cv=none; d=zohomail.com; s=zohoarc; b=FW2uhtbVjtCSg4/32W83lx65jkLMEIkbRA2wjX3iS0VBlUnJdvCiL/kItw9HTSkFopRwwAnRPSY+/3t0j62c9o9+e55l9nJyI2kbxdCyJo6X/kXarUD/wQ+yCJayywP9jdkeZeU6pKscC4C9jEFmPPeZnyPvY32Y5lwlHwMimYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931405; 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=ODqkBlXY5GAPItkEwTJ2an93nSQthqyiyXfiZrsmaMk=; b=YsIC9MUP9Cf3uFmQCIZ2p5rH3x6O1SjvVxBMlfpRKbr43cOCbm0lrn/Nu8gs2F1hFaD4bFgGrKgceo74BdXzW2w9BfRYUDSQ5ZSSdH1TFQ+H36xNhFdYP2Glf2HtTQYeK7KZSLSHK9vhh5xVxuBH2RF6ADaVg9IH5Brpevj0e44= 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 15839314054051014.0755818706057; Wed, 11 Mar 2020 05:56:45 -0700 (PDT) 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-107-ZXcZPyY6PcitxPKxiXUaYQ-1; Wed, 11 Mar 2020 08:56:38 -0400 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 9068A1005514; Wed, 11 Mar 2020 12:56:32 +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 644AC92D2A; Wed, 11 Mar 2020 12:56:32 +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 0792286A1E; Wed, 11 Mar 2020 12:56:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuE0p009330 for ; Wed, 11 Mar 2020 08:56:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0EE6F5C219; Wed, 11 Mar 2020 12:56:14 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 617685C1D8; Wed, 11 Mar 2020 12:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931404; 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=ODqkBlXY5GAPItkEwTJ2an93nSQthqyiyXfiZrsmaMk=; b=UsfmiNhhXylOkOcNr7aNFA5N68cvcWMp9mQUNwrkZzhZhuNDxDxOBl5f87FpJpsJ8NJp6f sVvaGs7dbwCNdOapBrdY1l1wyrWo7PfkIscbrvjHbf8THDyiJ/Y96laJIlU4lSxtC1uIme JB0IbXp8sSm1DrzGhF1xV3eOzW3YcVc= X-MC-Unique: ZXcZPyY6PcitxPKxiXUaYQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 06/19] qemuDomainBlockCommit: Move checks depending on capabilities after liveness check Date: Wed, 11 Mar 2020 13:55:51 +0100 Message-Id: <661b04791b7bc8dbe77df44a3690464252e6f93e.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Since capabilities are not present for inactive VMs we'd report that we don't support '--delete' or commiting while checkpoints exist rather than the proper error. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d565054436..d3eb2171ef 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18413,9 +18413,6 @@ qemuDomainBlockCommit(virDomainPtr dom, if (virDomainBlockCommitEnsureACL(dom->conn, vm->def) < 0) goto cleanup; - if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) - goto cleanup; - if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) goto cleanup; @@ -18424,12 +18421,6 @@ qemuDomainBlockCommit(virDomainPtr dom, blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("deleting committed images is not supported by th= is VM")); - goto endjob; - } - /* Convert bandwidth MiB to bytes, if necessary */ if (!(flags & VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES)) { if (speed > LLONG_MAX >> 20) { @@ -18454,6 +18445,15 @@ qemuDomainBlockCommit(virDomainPtr dom, if (qemuDomainDiskBlockJobIsActive(disk)) goto endjob; + if (qemuDomainSupportsCheckpointsBlockjobs(vm) < 0) + goto endjob; + + if (!blockdev && (flags & VIR_DOMAIN_BLOCK_COMMIT_DELETE)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("deleting committed images is not supported by th= is VM")); + goto endjob; + } + if (!top || STREQ(top, disk->dst)) topSource =3D disk->src; else if (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 = || --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931388; cv=none; d=zohomail.com; s=zohoarc; b=nNodjEUMG5oaWj8bNpoaKo5V8huwA+qv3t6jKVCNdrE8lYAo3RNQK4M2xH84SNrT2wkUpVhHzISoqa65Ht3PHmY65+OCWsC57YcvojiPfGH9JFj4mFe8h8M7LB3RygOsyq5TudOYWFyxTnMU3m0d22C0bLdiTE6HYJwZYKCwYeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931388; 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=a6WOSAKwZG8V0CLdlf6FQ0+v2AjAoyDB6npShg8/s2c=; b=aXMKlrKJnBOVAyAqMzr2PiR5946sWEbAOY9fvfRbPWNcogFMoqk3io0bzcaqFFHRfPZcH63TwjkWOXvlfX+xAFCH/zCOImLMPZwl3Oz+eiU1D4gZ5gOxrPFtkmuJhEI6vzTeyvDLl+eT3aYZwSN+LqABoVMBK9jO2uOdsm3Bja8= 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 158393138870935.23272018108321; Wed, 11 Mar 2020 05:56:28 -0700 (PDT) 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-123-lMOqyz2ANlioSNgiMe3gNQ-1; Wed, 11 Mar 2020 08:56:24 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 68FF38010F3; Wed, 11 Mar 2020 12:56:18 +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 3E28B8FBE3; Wed, 11 Mar 2020 12:56:18 +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 DD9D11832E37; Wed, 11 Mar 2020 12:56:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuFqH009338 for ; Wed, 11 Mar 2020 08:56:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0AB125C219; Wed, 11 Mar 2020 12:56:15 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DF975C1D8; Wed, 11 Mar 2020 12:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931387; 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=a6WOSAKwZG8V0CLdlf6FQ0+v2AjAoyDB6npShg8/s2c=; b=THt28bJG2qn7nHofwZm0E8V7YirJtls+R6STCZSLnIgN0298bSWJMC4BA+F0vuiI31G/Oq +Fn0mzlBOsCzwsY0Itutc8kSC2szzOf8ECdl122epYqAoqGvf8f8mfhCQVQCSlFR7rLmmf fZRkwvBXK3U1/CT4YQc/5N7Zv2ByljI= X-MC-Unique: lMOqyz2ANlioSNgiMe3gNQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 07/19] qemu: domain: Extract formatting of 'commit' blockjob data into a function Date: Wed, 11 Mar 2020 13:55:52 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" I'll be adding more fields to care about so splitting the code out will be better long-term. Signed-off-by: Peter Krempa Reviewed-by: Pavel Mores Reviewed-by: Eric Blake --- src/qemu/qemu_domain.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3d3f796d85..369d9b8446 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2530,6 +2530,24 @@ qemuDomainObjPrivateXMLFormatBlockjobFormatSource(vi= rBufferPtr buf, } +static void +qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job, + virBufferPtr buf) +{ + if (job->data.commit.base) + virBufferAsprintf(buf, "\n", job->data.commit.b= ase->nodeformat); + + if (job->data.commit.top) + virBufferAsprintf(buf, "\n", job->data.commit.to= p->nodeformat); + + if (job->data.commit.topparent) + virBufferAsprintf(buf, "\n", job->data.com= mit.topparent->nodeformat); + + if (job->data.commit.deleteCommittedImages) + virBufferAddLit(buf, "\n"); +} + + static int qemuDomainObjPrivateXMLFormatBlockjobIterator(void *payload, const void *name G_GNUC_UNUS= ED, @@ -2589,14 +2607,7 @@ qemuDomainObjPrivateXMLFormatBlockjobIterator(void *= payload, case QEMU_BLOCKJOB_TYPE_COMMIT: case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - if (job->data.commit.base) - virBufferAsprintf(&childBuf, "\n", job-= >data.commit.base->nodeformat); - if (job->data.commit.top) - virBufferAsprintf(&childBuf, "\n", job->= data.commit.top->nodeformat); - if (job->data.commit.topparent) - virBufferAsprintf(&childBuf, "\n",= job->data.commit.topparent->nodeformat); - if (job->data.commit.deleteCommittedImages) - virBufferAddLit(&childBuf, "\n"); + qemuDomainPrivateBlockJobFormatCommit(job, &childBuf); break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931442; cv=none; d=zohomail.com; s=zohoarc; b=ENPLWmwC/SxPrNIPr46LNSI6YKV83DSJKBh4nyNJgcDVOsg+n0dVvgbo7xEX0uU5PzS6IjP4DQCQramCS0+fmcsh3ssgDUwWHY6weXM0vKxx0yNOZOK6DVmVIudPNXntb4WGslY53G4Zob83KPwQHkpG4xuvBobNRyxIjIjl2Qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931442; 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=tKgN5matiXG1Zvg2EncAxkx1J3Al4vduDj3kmtuY9P0=; b=bzBamstKlYNr6szd+AvE6hjce2nU3YFWnc9n+K1fX9fbsMvelVL5972n/MyBnsUTqkELRI3ZpPJfHcfPNdL30QPOII4urXtAkkAuEN3cG8LTyzs3JQunrcAvNR5qWJ7IbiB0+aR9T+F6nfeoM8U4DHHzD0nTexlhucY06AnUCJE= 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 1583931442559188.31852138416127; Wed, 11 Mar 2020 05:57:22 -0700 (PDT) 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-98--0nAe-GMPzqj4zO_QQfqoQ-1; Wed, 11 Mar 2020 08:56:27 -0400 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 610C1800D5E; Wed, 11 Mar 2020 12:56:22 +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 2498860C18; Wed, 11 Mar 2020 12:56:22 +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 B24E086A1F; Wed, 11 Mar 2020 12:56:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuJGV009357 for ; Wed, 11 Mar 2020 08:56:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E31D5C1D8; Wed, 11 Mar 2020 12:56:19 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 081155C54A; Wed, 11 Mar 2020 12:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931441; 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=tKgN5matiXG1Zvg2EncAxkx1J3Al4vduDj3kmtuY9P0=; b=QWQSRV2QesG839xBM6PrlXuZbFjJzPMcJ2IaQFZojN8kPny2g7LbV3IrL9/iHnqGBALsfM k2IC4dE0/Bu3AT7qLMJ53oZaGMaFr2SZQff0AWhQ/EpgV7qPPDC0sAq0k80Zc7pxjOC88U A0tJYEwJ16O7cRUlnP5sXW4VU9Vq96k= X-MC-Unique: -0nAe-GMPzqj4zO_QQfqoQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 08/19] qemu: domain: Extract parsing of 'commit' blockjob data into a function Date: Wed, 11 Mar 2020 13:55:53 +0100 Message-Id: <68623a8cd8d1fe3faab3088747eebe3c53ae0322.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" I'll be adding more fields to care about so splitting the code out will be better long-term. Signed-off-by: Peter Krempa Reviewed-by: Pavel Mores Reviewed-by: Eric Blake --- src/qemu/qemu_domain.c | 57 ++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 369d9b8446..d8486a5277 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3153,6 +3153,40 @@ qemuDomainObjPrivateXMLParseBlockjobNodename(qemuBlo= ckJobDataPtr job, } +static int +qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job, + xmlXPathContextPtr ctxt) +{ + if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_COMMIT) { + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./topparent/@= node)", + &job->data.commit.top= parent, + ctxt); + + if (!job->data.commit.topparent) + return -1; + } + + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./top/@node)", + &job->data.commit.top, + ctxt); + qemuDomainObjPrivateXMLParseBlockjobNodename(job, + "string(./base/@node)", + &job->data.commit.base, + ctxt); + + if (virXPathNode("./deleteCommittedImages", ctxt)) + job->data.commit.deleteCommittedImages =3D true; + + if (!job->data.commit.top || + !job->data.commit.base) + return -1; + + return 0; +} + + static void qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qemuBlockJobDataPtr job, xmlXPathContextPtr ctxt, @@ -3172,29 +3206,10 @@ qemuDomainObjPrivateXMLParseBlockjobDataSpecific(qe= muBlockJobDataPtr job, break; case QEMU_BLOCKJOB_TYPE_COMMIT: - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./toppare= nt/@node)", - &job->data.commit= .topparent, - ctxt); - - if (!job->data.commit.topparent) - goto broken; - - G_GNUC_FALLTHROUGH; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./top/@no= de)", - &job->data.commit= .top, - ctxt); - qemuDomainObjPrivateXMLParseBlockjobNodename(job, - "string(./base/@n= ode)", - &job->data.commit= .base, - ctxt); - if (virXPathNode("./deleteCommittedImages", ctxt)) - job->data.commit.deleteCommittedImages =3D true; - if (!job->data.commit.top || - !job->data.commit.base) + if (qemuDomainObjPrivateXMLParseBlockjobDataCommit(job, ctxt) = < 0) goto broken; + break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931406; cv=none; d=zohomail.com; s=zohoarc; b=bn2/Y753W5jaugkH3ruD/IPjS6hw+M8n78q/cHElfzUPgtLMHEpmWx2sW48bsgYbz69vQU/3/D7aE2Y5Rlo8pX5BPfVzRvGt4uEEqkj59vudtzIFCTicPNBj/36vHV3PV7JnC3w/UgdsACkBwNHGjJfN6stHirvCzyXhPbtl4Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931406; 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=qkzejjR8wPnY8MscTPOF0X0c5aH/Wmic1c3TWLahc7g=; b=PdjyiF6OfiazLGafD2um1vLi/Kmqobi337a0iPYG7A6c2oTJhBIkrm4DKD0BWJabAAkW8VMDZyMh9e5Vwr4wOgaw4HBDRZq01VtxeA37qvrQUgL9OWef2u8Y25dCL4b20gcuc+b6nR3TL3j0pQjM1sfR95Wrr4hSOuhq5JyJ43k= 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583931406008978.2067797277568; Wed, 11 Mar 2020 05:56:46 -0700 (PDT) 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-388-t9rvtOeyPnyGxXcYtGZc5g-1; Wed, 11 Mar 2020 08:56:42 -0400 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 6B7738017CC; Wed, 11 Mar 2020 12:56:36 +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 3AACF60C88; Wed, 11 Mar 2020 12:56:36 +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 DADF386A25; Wed, 11 Mar 2020 12:56:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuOTD009372 for ; Wed, 11 Mar 2020 08:56:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 94ABE5C3FD; Wed, 11 Mar 2020 12:56:24 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AEED5C219; Wed, 11 Mar 2020 12:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931404; 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=qkzejjR8wPnY8MscTPOF0X0c5aH/Wmic1c3TWLahc7g=; b=cwDYR7Y0GSVF2b4PulcT0YR02H2bpTmFUiAfl2njGcEunR/Snsi2z4EZLgz7eFgLeT8vz2 /msRTxqS1r2bkhNNkeW31UMaWM/Yvn9K4PWFrmejzLqIiHclRqGPURLexPDsoW4mq6Jhi8 DtrsWsxiksVujzartmiSo+ekzEvcyzc= X-MC-Unique: t9rvtOeyPnyGxXcYtGZc5g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 09/19] qemu: blockjob: Store list of bitmaps disabled prior to commit Date: Wed, 11 Mar 2020 13:55:54 +0100 Message-Id: <43144ef68b180ab6ee5d16d8dffcbdcf10cb34c8.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Starting a commit job will require disabling bitmaps in the base image so that they are not dirtied by the commit job. We need to store a list of the bitmaps so that we can later re-enable them. Add a field and status XML handling code as well as a test. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_blockjob.h | 2 ++ src/qemu/qemu_domain.c | 26 +++++++++++++++++++ .../blockjob-blockdev-in.xml | 4 +++ 3 files changed, 32 insertions(+) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 72c7fa053e..e2e28ca4d3 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -88,6 +88,8 @@ struct _qemuBlockJobCommitData { virStorageSourcePtr top; virStorageSourcePtr base; bool deleteCommittedImages; + char **disabledBitmapsBase; /* a NULL-terminated list of bitmap names = which + were disabled in @base for the commit j= ob */ }; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d8486a5277..f3e98d7ad9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2534,6 +2534,9 @@ static void qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDataPtr job, virBufferPtr buf) { + g_auto(virBuffer) disabledBitmapsBuf =3D VIR_BUFFER_INIT_CHILD(buf); + char **bitmaps =3D job->data.commit.disabledBitmapsBase; + if (job->data.commit.base) virBufferAsprintf(buf, "\n", job->data.commit.b= ase->nodeformat); @@ -2545,6 +2548,11 @@ qemuDomainPrivateBlockJobFormatCommit(qemuBlockJobDa= taPtr job, if (job->data.commit.deleteCommittedImages) virBufferAddLit(buf, "\n"); + + while (bitmaps && *bitmaps) + virBufferEscapeString(&disabledBitmapsBuf, "\= n", *(bitmaps++)); + + virXMLFormatElement(buf, "disabledBaseBitmaps", NULL, &disabledBitmaps= Buf); } @@ -3157,6 +3165,9 @@ static int qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuBlockJobDataPtr job, xmlXPathContextPtr ctxt) { + g_autofree xmlNodePtr *nodes =3D NULL; + ssize_t nnodes; + if (job->type =3D=3D QEMU_BLOCKJOB_TYPE_COMMIT) { qemuDomainObjPrivateXMLParseBlockjobNodename(job, "string(./topparent/@= node)", @@ -3183,6 +3194,21 @@ qemuDomainObjPrivateXMLParseBlockjobDataCommit(qemuB= lockJobDataPtr job, !job->data.commit.base) return -1; + if ((nnodes =3D virXPathNodeSet("./disabledBaseBitmaps/bitmap", ctxt, = &nodes)) > 0) { + size_t i; + + job->data.commit.disabledBitmapsBase =3D g_new0(char *, nnodes + 1= ); + + for (i =3D 0; i < nnodes; i++) { + char *tmp; + + if (!(tmp =3D virXMLPropString(nodes[i], "name"))) + return -1; + + job->data.commit.disabledBitmapsBase[i] =3D g_steal_pointer(&t= mp); + } + } + return 0; } diff --git a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml b/tests/q= emustatusxml2xmldata/blockjob-blockdev-in.xml index ca6d110179..cc17a17ff4 100644 --- a/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml +++ b/tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml @@ -243,6 +243,10 @@ + + + + --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931405; cv=none; d=zohomail.com; s=zohoarc; b=DG9atRUfanWsNN37UWcadRrxlIKT+MP9rWt4cyPrqLvZSsA/S3Mre4faKXuD42X4eW7BHAzhboXF8qh1uSt/cIh5sQCxQhxg7QYPotc5s4i4lY2RfuvxvUjX8aOn4ZTQbwlikZDtW6Xlo0ORaHOUiNvk0dbCfPMrxJyDHD8yY/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931405; 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=Ej7xAJ3ndZpV4aEDLx+MHkiCpALelVnvz4w9JQWI6VI=; b=M+fd4EhCTb3Z5dHkQy5kuWaUc7en4cbkjCpSCIpnGVUvzl8Zq24K1s8Aj9X/R3wSW0rGBD48PieTzD8pdpiLa5LDol3ovtLt4+jV/ke28NVxfGU8YfZMdKnBwKLwnzZZitZNuSwOCP7lrSz4k6kYzbMB5brAag82ABVRwFOd+Rs= 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 1583931405968794.8157591889873; Wed, 11 Mar 2020 05:56:45 -0700 (PDT) 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-35-E_ixQVteOpKfHCok_AfbYg-1; Wed, 11 Mar 2020 08:56:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 324D9477; Wed, 11 Mar 2020 12:56:35 +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 0890310027A4; Wed, 11 Mar 2020 12:56:35 +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 B953D86A22; Wed, 11 Mar 2020 12:56:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCuXxQ009395 for ; Wed, 11 Mar 2020 08:56:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7DDA35C57D; Wed, 11 Mar 2020 12:56:33 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 475ED5C54A; Wed, 11 Mar 2020 12:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931403; 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=Ej7xAJ3ndZpV4aEDLx+MHkiCpALelVnvz4w9JQWI6VI=; b=CAu2D7OwlVxpKHE6cLJWmXOxNPuU+xvq6LKz21N9S8krqDGtixdC+YV/vBToagTePKWFSE t9x0HDpmhO8O+BpHs1k0IIUQRw8aApL3HzVnbN35Vx/IuLGwKJp06IvV14xozU6Xap/8LB rjr3VD8WGF2I+E4wpxp7wtK9McTC2mo= X-MC-Unique: E_ixQVteOpKfHCok_AfbYg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 10/19] qemublocktest: Fix and optimize fake image chain Date: Wed, 11 Mar 2020 13:55:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Set the 'id' field of the backing chain properly so that we can look up images and initialize 6 images instead of 10 as we don't use more currently. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 7b7948d4c6..a6b6376c7d 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -570,6 +570,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeImage(si= ze_t idx) if (!(ret =3D virStorageSourceNew())) abort(); + ret->id =3D idx; ret->type =3D VIR_STORAGE_TYPE_FILE; ret->format =3D VIR_STORAGE_FILE_QCOW2; ret->path =3D g_strdup_printf("/image%zu", idx); @@ -589,7 +590,7 @@ testQemuBackupIncrementalBitmapCalculateGetFakeChain(vo= id) n =3D ret =3D testQemuBackupIncrementalBitmapCalculateGetFakeImage(1); - for (i =3D 2; i < 10; i++) { + for (i =3D 2; i < 6; i++) { n->backingStore =3D testQemuBackupIncrementalBitmapCalculateGetFak= eImage(i); n =3D n->backingStore; } --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931411; cv=none; d=zohomail.com; s=zohoarc; b=CTIIbO/djZQZqI+HSsN1hRL6u1QybVgFTMOwPALVuloJUmLUhhAxJ1Ie4zpYeYohKDmGCWgZ8D9iHUwVBJyttvm0nWYP9JeW2wjVmdVrQtc5j72SD6esZ/mO+jjU9FCstpEXxKHMuRhozw620XD5Q0Lmsoj6RTkvUJ+1w4eotCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931411; 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=yPHYHGwincDOYfaxMRqggjjIIUHKsFpRGqY8H1bVy7A=; b=DY3zxHdjlzTG6BZT7uWKhnw0c30Dnm88AmmBudVrDYzRdTMnKSbY/w7QvfLXz3eJA8YheP98tXIkp+SOq1UlHWURWEMoe6lwf3eO2/RNentTEjSlDz2JRpGXN4gjyBc1n/5R2dTOeUr6VBRE3k+DlUGwr046GC7EpE6nhtAJnVU= 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 1583931411046346.1311243016396; Wed, 11 Mar 2020 05:56:51 -0700 (PDT) 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-463-mcpP1jaqMtaezjS_6VWQZQ-1; Wed, 11 Mar 2020 08:56:47 -0400 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 67837102CE14; Wed, 11 Mar 2020 12:56:40 +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 38C4890519; Wed, 11 Mar 2020 12:56:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DE17A86A26; Wed, 11 Mar 2020 12:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCudcD009412 for ; Wed, 11 Mar 2020 08:56:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 161355C57D; Wed, 11 Mar 2020 12:56:39 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id C90435C3FD; Wed, 11 Mar 2020 12:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931409; 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=yPHYHGwincDOYfaxMRqggjjIIUHKsFpRGqY8H1bVy7A=; b=Cq+FftdD549rf5ZXaqiY8XuehILPcPYFIB4F5iTAoeI6eXPdYhVYSqoV4vECJFt0tseOcp yTtlWQwhRwrEOvcCH0wgFVI7UWd/un/SsIB/WnlcXuuopNsufy8tAInF+5k6qfxukBgRlQ 8A62uCB5y2VHGU5an0R9EC/a6QZpB8Y= X-MC-Unique: mcpP1jaqMtaezjS_6VWQZQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 11/19] qemu: block: Implement helpers for dealing with bitmaps during block commit Date: Wed, 11 Mar 2020 13:55:56 +0100 Message-Id: <57c3f8c8115d0e6a084838f08f5277116ddee03a.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qemuBlockBitmapsHandleCommitStart prepares for disabling the bitmaps in the 'base' of the commit job so that the bitmaps are not dirtied by the commit job. This needs to be done prior to start of the commit job. qemuBlockBitmapsHandleCommitFinish then calculates the necessary merges that agregate all the bitmaps between the commited images and write them into the base bitmap. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_block.c | 219 ++++++++++++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 14 +++ 2 files changed, 233 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index edebbcd0ce..6853c021ca 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2962,6 +2962,225 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr= src, } +/** + * @topsrc: virStorageSource representing 'top' of the job + * @basesrc: virStorageSource representing 'base' of the job + * @blockNamedNodeData: hash table containing data about bitmaps + * @actions: filled with arguments for a 'transaction' command + * @disabledBitmapsBase: filled with a list of bitmap names which must be = disabled + * + * Prepares data for correctly hanlding bitmaps during the start of a comm= it + * job. The bitmaps in the 'base' image must be disabled, so that the writ= es + * done by the blockjob don't dirty the enabled bitmaps. + * + * @actions and @disabledBitmapsBase are untouched if no bitmaps need + * to be disabled. + */ +int +qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char ***disabledBitmapsBase) +{ + g_autoptr(virJSONValue) act =3D virJSONValueNewArray(); + VIR_AUTOSTRINGLIST bitmaplist =3D NULL; + size_t curbitmapstr =3D 0; + qemuBlockNamedNodeDataPtr entry; + bool disable_bitmaps =3D false; + size_t i; + + if (!(entry =3D virHashLookup(blockNamedNodeData, basesrc->nodeformat)= )) + return 0; + + bitmaplist =3D g_new0(char *, entry->nbitmaps); + + for (i =3D 0; i < entry->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; + + if (!bitmap->recording || bitmap->inconsistent || + !qemuBlockBitmapChainIsValid(topsrc, bitmap->name, blockNamedN= odeData)) + continue; + + disable_bitmaps =3D true; + + if (qemuMonitorTransactionBitmapDisable(act, basesrc->nodeformat, + bitmap->name) < 0) + return -1; + + bitmaplist[curbitmapstr++] =3D g_strdup(bitmap->name); + } + + if (disable_bitmaps) { + *actions =3D g_steal_pointer(&act); + *disabledBitmapsBase =3D g_steal_pointer(&bitmaplist); + } + + return 0; +} + + +struct qemuBlockBitmapsHandleCommitData { + bool skip; + bool create; + bool enable; + const char *basenode; + virJSONValuePtr merge; + unsigned long long granularity; + bool persistent; +}; + + +static void +qemuBlockBitmapsHandleCommitDataFree(void *opaque) +{ + struct qemuBlockBitmapsHandleCommitData *data =3D opaque; + + virJSONValueFree(data->merge); + g_free(data); +} + + +static int +qemuBlockBitmapsHandleCommitFinishIterate(void *payload, + const void *entryname, + void *opaque) +{ + struct qemuBlockBitmapsHandleCommitData *data =3D payload; + const char *bitmapname =3D entryname; + virJSONValuePtr actions =3D opaque; + + if (data->skip) + return 0; + + if (data->create) { + if (qemuMonitorTransactionBitmapAdd(actions, data->basenode, bitma= pname, + data->persistent, !data-> enab= le, + data->granularity) < 0) + return -1; + } else { + if (data->enable && + qemuMonitorTransactionBitmapEnable(actions, data->basenode, bi= tmapname) < 0) + return -1; + } + + if (data->merge && + qemuMonitorTransactionBitmapMerge(actions, data->basenode, bitmapn= ame, + &data->merge) < 0) + return -1; + + return 0; +} + + +/** + * @topsrc: virStorageSource representing 'top' of the job + * @basesrc: virStorageSource representing 'base' of the job + * @blockNamedNodeData: hash table containing data about bitmaps + * @actions: filled with arguments for a 'transaction' command + * @disabledBitmapsBase: bitmap names which were disabled + * + * Calculates the necessary bitmap merges/additions/enablements to properly + * handle commit of images from 'top' into 'base'. The necessary operations + * in form of argumets of the 'transaction' command are filled into 'actio= ns' + * if there is anything to do. Otherwise NULL is returned. + */ +int +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char **disabledBitmapsBase) +{ + g_autoptr(virJSONValue) act =3D virJSONValueNewArray(); + virStorageSourcePtr n; + qemuBlockNamedNodeDataPtr entry; + g_autoptr(virHashTable) commitdata =3D NULL; + struct qemuBlockBitmapsHandleCommitData *bitmapdata; + size_t i; + + commitdata =3D virHashNew(qemuBlockBitmapsHandleCommitDataFree); + + for (n =3D topsrc; n !=3D basesrc; n =3D n->backingStore) { + if (!(entry =3D virHashLookup(blockNamedNodeData, n->nodeformat))) + continue; + + for (i =3D 0; i < entry->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; + + if (!(bitmapdata =3D virHashLookup(commitdata, bitmap->name)))= { + bitmapdata =3D g_new0(struct qemuBlockBitmapsHandleCommitD= ata, 1); + + /* we must mirror the state of the topmost bitmap and merge + * everything else */ + bitmapdata->create =3D true; + bitmapdata->enable =3D bitmap->recording; + bitmapdata->basenode =3D basesrc->nodeformat; + bitmapdata->merge =3D virJSONValueNewArray(); + bitmapdata->granularity =3D bitmap->granularity; + bitmapdata->persistent =3D bitmap->persistent; + + if (virHashAddEntry(commitdata, bitmap->name, bitmapdata) = < 0) { + qemuBlockBitmapsHandleCommitDataFree(bitmapdata); + return -1; + } + } + + if (bitmap->inconsistent || + !qemuBlockBitmapChainIsValid(topsrc, bitmap->name, blockNa= medNodeData)) + bitmapdata->skip =3D true; + + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(bitmapdat= a->merge, + n->nodefo= rmat, + bitmap->n= ame) < 0) + return -1; + } + } + + if ((entry =3D virHashLookup(blockNamedNodeData, basesrc->nodeformat))= ) { + /* note that all bitmaps in 'base' were disabled when commit was s= tarted */ + for (i =3D 0; i < entry->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; + + if ((bitmapdata =3D virHashLookup(commitdata, bitmap->name))) { + bitmapdata->create =3D false; + } else { + if (disabledBitmapsBase) { + char **disabledbitmaps; + + for (disabledbitmaps =3D disabledBitmapsBase; *disable= dbitmaps; disabledbitmaps++) { + if (STREQ(*disabledBitmapsBase, bitmap->name)) { + bitmapdata =3D g_new0(struct qemuBlockBitmapsH= andleCommitData, 1); + + bitmapdata->create =3D false; + bitmapdata->enable =3D true; + bitmapdata->basenode =3D basesrc->nodeformat; + bitmapdata->granularity =3D bitmap->granularit= y; + bitmapdata->persistent =3D bitmap->persistent; + + if (virHashAddEntry(commitdata, bitmap->name, = bitmapdata) < 0) { + qemuBlockBitmapsHandleCommitDataFree(bitma= pdata); + return -1; + } + + break; + } + } + } + } + } + } + + if (virHashForEach(commitdata, qemuBlockBitmapsHandleCommitFinishItera= te, act) < 0) + return -1; + + if (virJSONValueArraySize(act) > 0) + *actions =3D g_steal_pointer(&act); + + return 0; +} + + /** * qemuBlockReopenFormat: * @vm: domain object diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 1d8a364bd0..ac666ffb3a 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -229,6 +229,20 @@ qemuBlockBitmapsHandleBlockcopy(virStorageSourcePtr sr= c, bool shallow, virJSONValuePtr *actions); +int +qemuBlockBitmapsHandleCommitStart(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char ***disabledBitmapsBase); + +int +qemuBlockBitmapsHandleCommitFinish(virStorageSourcePtr topsrc, + virStorageSourcePtr basesrc, + virHashTablePtr blockNamedNodeData, + virJSONValuePtr *actions, + char **disabledBitmapsBase); + int qemuBlockReopenReadWrite(virDomainObjPtr vm, virStorageSourcePtr src, --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931417; cv=none; d=zohomail.com; s=zohoarc; b=GhZbEb8CgHswrLDiVi2WeOHVFiwWts6POd2GHBY25REAkwCxhLn9a9SOStdYYCwPXvm7+m0LRZvO28ZIqUiwZpeSkMcv0C/IlnOZ/hnXnB63aNHFCVOkHJ7CUTt+04npXJKEsE3a/oG0r9Knj8RQEm8UioBbOmnvC2bnvbJDg/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931417; 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=y64Unc/Lb2OB8G1lC7KpPPkEjEbk5y1+cy5p8VINBqo=; b=KP01HFUUtWMsOXHfNBcyjO6TvupJkzyCbm7AG6dLpP8z3UfHobndquOYY3+APJf28cuKycUWlccYEYIK03Lny47a6yZXTZviQRng+40h+/3G+9MS8DHRW+29pmB+D5zCxSKa2ekwItYn8ut0MIYgEF7r3QihZbjpt32bus+KXdE= 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 1583931417748822.9514083816305; Wed, 11 Mar 2020 05:56:57 -0700 (PDT) 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-150-5Mb2pg01NgaFb5uHqmRz1A-1; Wed, 11 Mar 2020 08:56:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B978A800D48; Wed, 11 Mar 2020 12:56: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 93DAE8F372; Wed, 11 Mar 2020 12:56: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 51B7E86A25; Wed, 11 Mar 2020 12:56:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCulpU009440 for ; Wed, 11 Mar 2020 08:56:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E7965C3FD; Wed, 11 Mar 2020 12:56:47 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2B225C54A; Wed, 11 Mar 2020 12:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931416; 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=y64Unc/Lb2OB8G1lC7KpPPkEjEbk5y1+cy5p8VINBqo=; b=LOt92Uz/5je3UP0xnxbxCKPdm/CuN2SXKue6GcE8CrbqVwsIdPVO7oguEVfTGpqCKNungK qaJuL5MtLMgsoWdB/YEBKbVLMvFYq8SsOEjMzdpjRsWvgsLEkH54oxdq3C98kLsWf8A+f0 sx+4VqvGMI9RY0HmVkJc2ynoTUFqnjo= X-MC-Unique: 5Mb2pg01NgaFb5uHqmRz1A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 12/19] qemublocktest: Add tests for handling of bitmaps during block-commit Date: Wed, 11 Mar 2020 13:55:57 +0100 Message-Id: <9b5116c6dd58be507789654561374a51b7f74e00.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add code for testing the two necessary steps of handling bitmaps during block commit and excercise the code on the test data which we have for bitmap handling. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 95 ++++++++++++++ .../bitmapblockcommit/basic-1-2 | 119 ++++++++++++++++++ .../bitmapblockcommit/basic-1-3 | 119 ++++++++++++++++++ .../bitmapblockcommit/basic-2-3 | 2 + 4 files changed, 335 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/basic-2-3 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index a6b6376c7d..3662fee42a 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -599,6 +599,21 @@ testQemuBackupIncrementalBitmapCalculateGetFakeChain(v= oid) } +static virStorageSourcePtr +testQemuBitmapGetFakeChainEntry(virStorageSourcePtr src, + size_t idx) +{ + virStorageSourcePtr n; + + for (n =3D src; n; n =3D n->backingStore) { + if (n->id =3D=3D idx) + return n; + } + + return NULL; +} + + typedef virDomainMomentDefPtr testMomentList; static void @@ -853,6 +868,68 @@ testQemuBlockBitmapBlockcopy(const void *opaque) return virTestCompareToFile(actual, expectpath); } +static const char *blockcommitPrefix =3D "qemublocktestdata/bitmapblockcom= mit/"; + +struct testQemuBlockBitmapBlockcommitData { + const char *name; + virStorageSourcePtr top; + virStorageSourcePtr base; + virStorageSourcePtr chain; + const char *nodedatafile; +}; + + +static int +testQemuBlockBitmapBlockcommit(const void *opaque) +{ + const struct testQemuBlockBitmapBlockcommitData *data =3D opaque; + + g_autofree char *actual =3D NULL; + g_autofree char *expectpath =3D NULL; + g_autoptr(virJSONValue) actionsDisable =3D NULL; + g_autoptr(virJSONValue) actionsMerge =3D NULL; + g_autoptr(virJSONValue) nodedatajson =3D NULL; + g_autoptr(virHashTable) nodedata =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOSTRINGLIST bitmapsDisable =3D NULL; + + expectpath =3D g_strdup_printf("%s/%s%s", abs_srcdir, + blockcommitPrefix, data->name); + + if (!(nodedatajson =3D virTestLoadFileJSON(bitmapDetectPrefix, data->n= odedatafile, + ".json", NULL))) + return -1; + + if (!(nodedata =3D qemuMonitorJSONBlockGetNamedNodeDataJSON(nodedatajs= on))) { + VIR_TEST_VERBOSE("failed to load nodedata JSON\n"); + return -1; + } + + if (qemuBlockBitmapsHandleCommitStart(data->top, data->base, nodedata, + &actionsDisable, &bitmapsDisable= ) < 0) + return -1; + + virBufferAddLit(&buf, "pre job bitmap disable:\n"); + + if (actionsDisable && + virJSONValueToBuffer(actionsDisable, &buf, true) < 0) + return -1; + + virBufferAddLit(&buf, "merge bitmpas:\n"); + + if (qemuBlockBitmapsHandleCommitFinish(data->top, data->base, nodedata, + &actionsMerge, bitmapsDisable) = < 0) + return -1; + + if (actionsMerge && + virJSONValueToBuffer(actionsMerge, &buf, true) < 0) + return -1; + + actual =3D virBufferContentAndReset(&buf); + + return virTestCompareToFile(actual, expectpath); +} + static int mymain(void) @@ -866,6 +943,7 @@ mymain(void) struct testQemuCheckpointDeleteMergeData checkpointdeletedata; struct testQemuBlockBitmapValidateData blockbitmapvalidatedata; struct testQemuBlockBitmapBlockcopyData blockbitmapblockcopydata; + struct testQemuBlockBitmapBlockcommitData blockbitmapblockcommitdata; char *capslatest_x86_64 =3D NULL; virQEMUCapsPtr caps_x86_64 =3D NULL; g_autoptr(virStorageSource) bitmapSourceChain =3D NULL; @@ -1196,6 +1274,23 @@ mymain(void) TEST_BITMAP_BLOCKCOPY("snapshots-shallow", true, "snapshots"); TEST_BITMAP_BLOCKCOPY("snapshots-deep", false, "snapshots"); + +#define TEST_BITMAP_BLOCKCOMMIT(testname, topimg, baseimg, ndf) \ + do {\ + blockbitmapblockcommitdata.name =3D testname; \ + blockbitmapblockcommitdata.top =3D testQemuBitmapGetFakeChainEntry= (bitmapSourceChain, topimg); \ + blockbitmapblockcommitdata.base =3D testQemuBitmapGetFakeChainEntr= y(bitmapSourceChain, baseimg); \ + blockbitmapblockcommitdata.nodedatafile =3D ndf; \ + if (virTestRun("bitmap block commit " testname, \ + testQemuBlockBitmapBlockcommit, \ + &blockbitmapblockcommitdata) < 0) \ + ret =3D -1; \ + } while (0) + + TEST_BITMAP_BLOCKCOMMIT("basic-1-2", 1, 2, "basic"); + TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic"); + TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-2 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-1-2 new file mode 100644 index 0000000000..8eeb4c3a11 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-2 @@ -0,0 +1,119 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "a", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "a" + } + ] + } + }, + { + "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-1-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-1-3 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-1-3 new file mode 100644 index 0000000000..71b48e31a5 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-1-3 @@ -0,0 +1,119 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "a", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/basic-2-3 b/tests/qe= mublocktestdata/bitmapblockcommit/basic-2-3 new file mode 100644 index 0000000000..bfc58f994e --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/basic-2-3 @@ -0,0 +1,2 @@ +pre job bitmap disable: +merge bitmpas: --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931426; cv=none; d=zohomail.com; s=zohoarc; b=EB1pfaL/QO0ovWxfzW2p2YR0yMxsbg0Xfe+bi9Tm3CIAeCbyCo1+qstAmlYwDd4VOuGD3DhUe5OAnGWxdAgcXIJkUbvt/3cGI1q9wspZ8+0Trn9UETZ4Uq21AqIGetjqZbjARsNqCTA/sguI8OtO0L7+OeFs2xYX5t0/8vgfFzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931426; 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=jOz7rGJmyUCksppBjQAGk2g+X0EH95CiM+VQMI3IRJc=; b=AaZI2/A80Jr5MN3tpEdgZfwQLqXEvmiE+Qs2dNicK6LXj6FMD8QxnCjD6ise/UBVL5Afr24iiI2k4Fw8w0uAYzZCKsMtmz4m2dMND2o9mpEHy8XScyGwyOnZBbAgUIo57k1GKsEhOWQwPlRFVpUUTPK3Aw8mE8qiMGQKGsldIO8= 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 1583931426736618.7101421645741; Wed, 11 Mar 2020 05:57:06 -0700 (PDT) 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-416-IrRjE23oNQuacjGf8eyX4g-1; Wed, 11 Mar 2020 08:57:02 -0400 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 938A4107ACC7; Wed, 11 Mar 2020 12:56:57 +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 6603173892; Wed, 11 Mar 2020 12:56:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1760086A26; Wed, 11 Mar 2020 12:56:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCutxN009458 for ; Wed, 11 Mar 2020 08:56:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id B27785C57D; Wed, 11 Mar 2020 12:56:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 489A95C3FD; Wed, 11 Mar 2020 12:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931425; 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=jOz7rGJmyUCksppBjQAGk2g+X0EH95CiM+VQMI3IRJc=; b=a777MAS5qS1V/wL4IxCCGjsd9XcKxh/Lj+INSBwtNIu0bGYrBrSqkANAqXTuf/d/O89Jea nDkcSlwYPKAYgnQQQyHINOpJpnozatVsQDDi/Z1zZR43GHPCWQaQMBgcIpERQBAkDRuAuf gfo3o3fjCb9PkCjJkNsPBuc0HnvYtew= X-MC-Unique: IrRjE23oNQuacjGf8eyX4g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 13/19] qemublocktest: Add more tests for block-commit bitmap handling with snapshots Date: Wed, 11 Mar 2020 13:55:58 +0100 Message-Id: <51a7253ff9f62912790f58a99b63d4c2f6f71476.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Test handling of more complex cases of merging bitmaps accross snapshots. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 15 ++ .../bitmapblockcommit/snapshots-1-2 | 49 +++++++ .../bitmapblockcommit/snapshots-1-3 | 76 ++++++++++ .../bitmapblockcommit/snapshots-1-4 | 126 +++++++++++++++++ .../bitmapblockcommit/snapshots-1-5 | 130 ++++++++++++++++++ .../bitmapblockcommit/snapshots-2-3 | 49 +++++++ .../bitmapblockcommit/snapshots-2-4 | 99 +++++++++++++ .../bitmapblockcommit/snapshots-2-5 | 103 ++++++++++++++ .../bitmapblockcommit/snapshots-3-4 | 72 ++++++++++ .../bitmapblockcommit/snapshots-3-5 | 76 ++++++++++ .../bitmapblockcommit/snapshots-4-4 | 11 ++ .../bitmapblockcommit/snapshots-4-5 | 33 +++++ 12 files changed, 839 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 3662fee42a..5eb38c3981 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1291,6 +1291,21 @@ mymain(void) TEST_BITMAP_BLOCKCOMMIT("basic-1-3", 1, 3, "basic"); TEST_BITMAP_BLOCKCOMMIT("basic-2-3", 2, 3, "basic"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-2", 1, 2, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-3", 1, 3, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-4", 1, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-1-5", 1, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-3", 2, 3, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-4", 2, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-2-5", 2, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-3-4", 3, 4, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-3-5", 3, 5, "snapshots"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-4-5", 4, 5, "snapshots"); + + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-2 new file mode 100644 index 0000000000..0015b9ceb3 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-2 @@ -0,0 +1,49 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-2-format", + "name": "d" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-3 new file mode 100644 index 0000000000..5691b408aa --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-3 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "c" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-4 new file mode 100644 index 0000000000..454001531a --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-4 @@ -0,0 +1,126 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-1-5 new file mode 100644 index 0000000000..2fd43d7917 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-1-5 @@ -0,0 +1,130 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "d", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-3 new file mode 100644 index 0000000000..d719a90bd7 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-3 @@ -0,0 +1,49 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "c" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-4 new file mode 100644 index 0000000000..9e37962344 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-4 @@ -0,0 +1,99 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-2-5 new file mode 100644 index 0000000000..d6b20a5d05 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-2-5 @@ -0,0 +1,103 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "d", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "d", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "d" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-3-4 new file mode 100644 index 0000000000..b96e8910d7 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-4 @@ -0,0 +1,72 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-4-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-3-5 new file mode 100644 index 0000000000..9570c34c40 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-3-5 @@ -0,0 +1,76 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-4-4 new file mode 100644 index 0000000000..a445fd7c49 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-4 @@ -0,0 +1,11 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 b/test= s/qemublocktestdata/bitmapblockcommit/snapshots-4-5 new file mode 100644 index 0000000000..7e1020d96e --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-4-5 @@ -0,0 +1,33 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "a", + "bitmaps": [ + { + "node": "libvirt-4-format", + "name": "a" + } + ] + } + } +] --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931433; cv=none; d=zohomail.com; s=zohoarc; b=Pr0vROOJDlEzdMN9SVN3Ri6wPDHQPj44CBWsPYOSnuBmVrWoea2uX/XH0KEiX1a6HnGGBWOSgjgxymHiSV/FpuqiysfDKQPgE+z1HhBI4g4NkEw+7rm4eQ9aD1CAoFJFshmsIrdUeTz2JJm2iJaF7WWhr88fRQB/E8GjOaYtQys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931433; 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=h6x6IOVtfcZ+fyNGGfJy3Gp457hHWtOu8d6LGYZD4qg=; b=P+gGm4WcdeEdm0vvFuwaJ6GBEj1keSGnnESf3nae1/+AtTKer9oQYbQVIUpI7U+L/WzAzfWxAH7j+O7uMFJMp+VwS7ndbMA5ofCI7lgfB5/fq3iJNbGGZC39f71GkAT5PuS1ppiefxjjRxY+mdrY3EaTVFonRg7LHLKaOp438Zk= 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 1583931433140259.5816629099693; Wed, 11 Mar 2020 05:57:13 -0700 (PDT) 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-20-V9KWnAXaPCCNV_D1cl_pJA-1; Wed, 11 Mar 2020 08:57:09 -0400 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 88A0F1085948; Wed, 11 Mar 2020 12:57:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 590425DA7C; Wed, 11 Mar 2020 12:57:03 +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 0C1201832E25; Wed, 11 Mar 2020 12:57:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCv2iC009477 for ; Wed, 11 Mar 2020 08:57:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2108C5C57D; Wed, 11 Mar 2020 12:57:02 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEA505C54A; Wed, 11 Mar 2020 12:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931431; 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=h6x6IOVtfcZ+fyNGGfJy3Gp457hHWtOu8d6LGYZD4qg=; b=bWGEtUdWuUIPiqcW7n3W7DH/aXT4nn98QFIKUyMlY77NUqy7qpJCXuZB7h3mr7KotlG7m4 ypMiV3FN6BF4ya3YMVXZJS4xcjVuZ3aNs5AQSjnkYCA8hd9MU7bCetwUzIsr6qVKkNPcoV MHtn+FSEpA5OJ0NoeKef65L506Vbie0= X-MC-Unique: V9KWnAXaPCCNV_D1cl_pJA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 14/19] qemublocktest: Add tests of broken bitmap chain handling during block-commit Date: Wed, 11 Mar 2020 13:55:59 +0100 Message-Id: <8aa6035104b6270ae6036d6593c72f43b44e4cbe.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use the 'snapshots-synthetic-broken' test data for block-commit. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 13 ++++ .../snapshots-synthetic-broken-1-2 | 27 +++++++ .../snapshots-synthetic-broken-1-3 | 66 +++++++++++++++++ .../snapshots-synthetic-broken-1-4 | 73 +++++++++++++++++++ .../snapshots-synthetic-broken-1-5 | 73 +++++++++++++++++++ .../snapshots-synthetic-broken-2-3 | 43 +++++++++++ .../snapshots-synthetic-broken-2-4 | 50 +++++++++++++ .../snapshots-synthetic-broken-2-5 | 50 +++++++++++++ .../snapshots-synthetic-broken-3-4 | 27 +++++++ .../snapshots-synthetic-broken-3-5 | 27 +++++++ .../snapshots-synthetic-broken-4-5 | 20 +++++ 11 files changed, 469 insertions(+) create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-2 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-1-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-3 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-2-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-3-4 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-3-5 create mode 100644 tests/qemublocktestdata/bitmapblockcommit/snapshots-syn= thetic-broken-4-5 diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 5eb38c3981..b782e7969d 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -1305,6 +1305,19 @@ mymain(void) TEST_BITMAP_BLOCKCOMMIT("snapshots-4-5", 4, 5, "snapshots"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-2", 1, 2, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-3", 1, 3, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-4", 1, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-1-5", 1, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-3", 2, 3, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-4", 2, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-2-5", 2, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-3-4", 3, 4, "snaps= hots-synthetic-broken"); + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-3-5", 3, 5, "snaps= hots-synthetic-broken"); + + TEST_BITMAP_BLOCKCOMMIT("snapshots-synthetic-broken-4-5", 4, 5, "snaps= hots-synthetic-broken"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-2 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-2 new file mode 100644 index 0000000000..d413fbe723 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-2 @@ -0,0 +1,27 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-2-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-2-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-3 new file mode 100644 index 0000000000..6eb14f927a --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-3 @@ -0,0 +1,66 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-4 new file mode 100644 index 0000000000..f4d9b72576 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-4 @@ -0,0 +1,73 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-1-5 new file mode 100644 index 0000000000..a8e575c2d9 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 1-5 @@ -0,0 +1,73 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "current", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "current", + "bitmaps": [ + { + "node": "libvirt-1-format", + "name": "current" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-3 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-3 new file mode 100644 index 0000000000..d468e2b9d8 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-3 @@ -0,0 +1,43 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-3-format", + "name": "b" + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-3-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-3-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-4 new file mode 100644 index 0000000000..2a9986bac6 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-4 @@ -0,0 +1,50 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-2-5 new file mode 100644 index 0000000000..47d9f6e17a --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 2-5 @@ -0,0 +1,50 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + }, + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "c", + "persistent": true, + "disabled": true, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "c", + "bitmaps": [ + { + "node": "libvirt-2-format", + "name": "c" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-4 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-4 new file mode 100644 index 0000000000..367a930a74 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 3-4 @@ -0,0 +1,27 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-4-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-4-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-3-5 new file mode 100644 index 0000000000..0062ec140c --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 3-5 @@ -0,0 +1,27 @@ +pre job bitmap disable: +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-add", + "data": { + "node": "libvirt-5-format", + "name": "b", + "persistent": true, + "disabled": false, + "granularity": 65536 + } + }, + { + "type": "block-dirty-bitmap-merge", + "data": { + "node": "libvirt-5-format", + "target": "b", + "bitmaps": [ + { + "node": "libvirt-3-format", + "name": "b" + } + ] + } + } +] diff --git a/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-4-5 b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-= broken-4-5 new file mode 100644 index 0000000000..b1f10a8a24 --- /dev/null +++ b/tests/qemublocktestdata/bitmapblockcommit/snapshots-synthetic-broken-= 4-5 @@ -0,0 +1,20 @@ +pre job bitmap disable: +[ + { + "type": "block-dirty-bitmap-disable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] +merge bitmpas: +[ + { + "type": "block-dirty-bitmap-enable", + "data": { + "node": "libvirt-5-format", + "name": "a" + } + } +] --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931438; cv=none; d=zohomail.com; s=zohoarc; b=k46FyqQ0qLllx/WH+eF0A6+K7AApbNoRSXFI07ByiwFBHuvNYMH3ysILoGlQ7EbzLV5k6wjei33UII16u7IP/GNYx1/dwsSCiKqC1FvXoEdmo6HRXVi+4lBRFUEaJwKvRsuTVgDmAQKnBjE8OTFGeMST7MVJ9F7+n8MWegd3T5Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931438; 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=bCvnPTkRke83MN5op3UoifUuHHblNn11VB+TgSCp4Xw=; b=jiPgfG11+HY6uCtxDe8qVvSlyRhXpIE74sVmL/qxJYLEUhevso5rKnEzPJmJZ2Sq+tbCy/D1RGYkixis8W6VPuzJoubf6Qm4BO6fjYuB17aPokIyGAAHhV2g2Fnaw4gZMRpUQaWlHuNxqFnD5FhIkQxGlCulG7rT/UkMqRx89Ps= 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 1583931438441252.00997313407015; Wed, 11 Mar 2020 05:57:18 -0700 (PDT) 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-273-jEh29RuvM9-5u5ATn61HmA-1; Wed, 11 Mar 2020 08:57:14 -0400 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 2A96D1085933; Wed, 11 Mar 2020 12:57:09 +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 F3D2E60FC2; Wed, 11 Mar 2020 12:57:08 +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 AEE0286A21; Wed, 11 Mar 2020 12:57:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCv6lb009495 for ; Wed, 11 Mar 2020 08:57:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id A4D745C54A; Wed, 11 Mar 2020 12:57:06 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58A045C3FD; Wed, 11 Mar 2020 12:57:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931437; 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=bCvnPTkRke83MN5op3UoifUuHHblNn11VB+TgSCp4Xw=; b=S3GwA1gH/hnaaXs4NK9wMCcy1P2aWU+BCXLL3vFDxzHPciThATu4iHYSJRVaNyPKEQLIu3 O+npDQf4H5+2QfR3XJ5xCYkLKmUqS1V53zwsCwECJRnYqE8h+RORO8Qs4vDWVQ4YEkdzCa tGwpJ098eOorHmI+l48Tb0juXRIMT84= X-MC-Unique: jEh29RuvM9-5u5ATn61HmA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 15/19] qemuBlockJobDiskNewCommit: Propagate 'disabledBitmapsBase' Date: Wed, 11 Mar 2020 13:56:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add an argument to qemuBlockJobDiskNewCommit to propagate the list of disabled bitmaps into the job data structure. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_blockjob.c | 2 ++ src/qemu/qemu_blockjob.h | 1 + src/qemu/qemu_driver.c | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index e894e1634d..63f1cc79c3 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -285,6 +285,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virStorageSourcePtr topparent, virStorageSourcePtr top, virStorageSourcePtr base, + char ***disabledBitmapsBase, bool delete_imgs, unsigned int jobflags) { @@ -310,6 +311,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, job->data.commit.top =3D top; job->data.commit.base =3D base; job->data.commit.deleteCommittedImages =3D delete_imgs; + job->data.commit.disabledBitmapsBase =3D g_steal_pointer(disabledBitma= psBase); job->jobflags =3D jobflags; if (qemuBlockJobRegister(job, vm, disk, true) < 0) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index e2e28ca4d3..9264c70217 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -187,6 +187,7 @@ qemuBlockJobDiskNewCommit(virDomainObjPtr vm, virStorageSourcePtr topparent, virStorageSourcePtr top, virStorageSourcePtr base, + char ***disabledBitmapsBase, bool delete_imgs, unsigned int jobflags); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d3eb2171ef..31c0f2dd91 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18556,7 +18556,7 @@ qemuDomainBlockCommit(virDomainPtr dom, } if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, - baseSource, + baseSource, NULL, flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE, flags))) goto endjob; --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931493; cv=none; d=zohomail.com; s=zohoarc; b=akGJyNTGfrzj918VTM4sci4zCVDwzu4vGDQRN30Lvkw73Yc1ZxYk8BeLD6mmGlriqo9JYvYd+/VrqFijNS19uwsriYqmBvOu5/6g45JG4zNZOr5FqVrPgv9P7Foqj/OTF0vmWbidGa+x/Gxu3shPFy9pVFxcaM8imYw+KgYT6zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931493; 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=Aj3+om9NLJroFkTfLnYku9xI+Vkn4yzJq+6qynAe+ik=; b=bbdrvtkJg1R7rhP1vT/jWHhYYx9ff8O733ClaKmrBBzcP7gHGFI0DfjzYGZqaXhI9PZHmdQym7dzN7zq/U9WTX7SIeFTTXYYaxu1vZ6I8jvlIQ1v6yZuw6x4TllOOkqqePwobroRM5/KLt3sow4ZNppceq+/RCXte1H6MSIkS+8= 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 1583931493945438.56176874498556; Wed, 11 Mar 2020 05:58:13 -0700 (PDT) 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-245-27iixedhMX-5zwOplfsNig-1; Wed, 11 Mar 2020 08:57:27 -0400 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 4B832800D48; Wed, 11 Mar 2020 12:57:22 +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 1D51C9298B; Wed, 11 Mar 2020 12:57:22 +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 C025B1832E2D; Wed, 11 Mar 2020 12:57:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCvKdA009512 for ; Wed, 11 Mar 2020 08:57:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 527155C557; Wed, 11 Mar 2020 12:57:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5823F5C1D8; Wed, 11 Mar 2020 12:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931491; 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=Aj3+om9NLJroFkTfLnYku9xI+Vkn4yzJq+6qynAe+ik=; b=Y3Icw6wZzjQmIZ5Dr4Xzr6ye53c5DIH7ivK6lWe5iwnmhQ5ZlGEqLIQaO8VLimRwEFsrcQ 4h0876dYfc1Ke1zIPavFUjccqPctCXEDYospkfEH7BSGhwLZ5RNNLFl5U4HO/GNx372iH5 HL6g55LOGxP/wgnAj/6uaQB9bpa/N9w= X-MC-Unique: 27iixedhMX-5zwOplfsNig-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 16/19] qemuDomainBlockCommit: Handle bitmaps on start of commit Date: Wed, 11 Mar 2020 13:56:01 +0100 Message-Id: <06c420609fae35c626d6fbd42d691eaaba76df97.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" On start of the commit job, we need to disable any active bitmap in the base. Use qemuBlockBitmapsHandleCommitStart to calculate which and call the appropriate QMP APIs. We use blockdev-reopen to make the 'base' writable to disable the bitmaps. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 31c0f2dd91..628fe9b107 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18399,6 +18399,8 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *nodebase =3D NULL; bool persistjob =3D false; bool blockdev =3D false; + g_autoptr(virJSONValue) bitmapDisableActions =3D NULL; + VIR_AUTOSTRINGLIST bitmapDisableList =3D NULL; virCheckFlags(VIR_DOMAIN_BLOCK_COMMIT_SHALLOW | VIR_DOMAIN_BLOCK_COMMIT_ACTIVE | @@ -18555,8 +18557,29 @@ qemuDomainBlockCommit(virDomainPtr dom, goto endjob; } + if (blockdev && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) { + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; + if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEMU_AS= YNC_JOB_NONE))) + goto endjob; + + if (qemuBlockBitmapsHandleCommitStart(topSource, baseSource, + blockNamedNodeData, + &bitmapDisableActions, + &bitmapDisableList) < 0) + goto endjob; + + /* if we don't have terminator on 'base' we can't reopen it */ + if (bitmapDisableActions && !baseSource->backingStore) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("can't handle bitmaps on unterminated backing= image '%s'"), + base); + goto endjob; + } + } + if (!(job =3D qemuBlockJobDiskNewCommit(vm, disk, top_parent, topSourc= e, - baseSource, NULL, + baseSource, &bitmapDisableList, flags & VIR_DOMAIN_BLOCK_COMMIT_= DELETE, flags))) goto endjob; @@ -18578,6 +18601,24 @@ qemuDomainBlockCommit(virDomainPtr dom, if (!backingPath && top_parent && !(backingPath =3D qemuBlockGetBackingStoreString(baseSource))) goto endjob; + + if (bitmapDisableActions) { + int rc; + + if (qemuBlockReopenReadWrite(vm, baseSource, QEMU_ASYNC_JOB_NO= NE) < 0) + goto endjob; + + qemuDomainObjEnterMonitor(driver, vm); + rc =3D qemuMonitorTransaction(priv->mon, &bitmapDisableActions= ); + if (qemuDomainObjExitMonitor(driver, vm) < 0) + goto endjob; + + if (qemuBlockReopenReadOnly(vm, baseSource, QEMU_ASYNC_JOB_NON= E) < 0) + goto endjob; + + if (rc < 0) + goto endjob; + } } else { device =3D job->name; } --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931547; cv=none; d=zohomail.com; s=zohoarc; b=bP18gE0gQvEzezU+4x1shaV4tps7afNl7KVtQR3itOOgkTmCjhxkknJpfVfrFbcwiMSvL+TsgrlM2NrCYv1mS5UvmbUH+PNmBCKKjHfntNcP1mQeJYHHtCnkWpd3YQYCx1MAsRw4gm7rwm4/C7ZCeZaGfnMlFMFeKLrHvie+7uQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931547; 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=KD9MJ5og2xeHf6FFGKdpKOsSFU3k+vKAC0lnhq/aAu0=; b=kJnkJHQattQmNZkbbGknb/6pFko3qu3RSVVaETv67HpuzTBBufygNmDUNI1bwWktBTqS9BQlDGV90Ev4u8x/vRQLtHaKk6G7aaLzZtLOgSnASg80ayh/J5Ky5TDRUHcwezhX5LYBdvecMde98SurIObaBNxsKxRQMgtxYCVK3eg= 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 1583931547800171.00260329615492; Wed, 11 Mar 2020 05:59:07 -0700 (PDT) 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-19-xe2vK390NRCZZAWmokKr9g-1; Wed, 11 Mar 2020 08:57:34 -0400 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 05FC91052BA0; Wed, 11 Mar 2020 12:57:28 +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 A3E8660C87; Wed, 11 Mar 2020 12:57:27 +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 574121832E37; Wed, 11 Mar 2020 12:57:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCvPe1009530 for ; Wed, 11 Mar 2020 08:57:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id E3FAB5C57E; Wed, 11 Mar 2020 12:57:25 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 943FD5C219; Wed, 11 Mar 2020 12:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931546; 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=KD9MJ5og2xeHf6FFGKdpKOsSFU3k+vKAC0lnhq/aAu0=; b=HxBtWap0KUtMyC2wVeyj3ZvRs/GbGb9GN5ZZvSXYeKx5nnIiYqZLlW6nWUxjrmlDIkdB+I plTaf9Ug6v8CwY/Ve9NET3ZyV1QBxcuiPdIbHdqrmXIjSLp0ILs2kEIcqIPFRFWE0aJmrW V/3lT7aG0LIaqQZPur8Vw2aZUH7sHyo= X-MC-Unique: xe2vK390NRCZZAWmokKr9g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 17/19] qemuDomainBlockPivot: Handle merging of bitmaps when pivoting an active block-commit Date: Wed, 11 Mar 2020 13:56:02 +0100 Message-Id: <2446bea4afd1a76138dd02744ac092514be8ee32.1583930936.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Active layer block commit makes the 'base' image the new top image of the disk after it finishes. This means that all bitmap operations need to be handled prior to this happening as we'd lose writes otherwise. The ideal place is to handle it when pivoting to the new image as only guest-writes would be happening after this point. Use qemuBlockBitmapsHandleCommitFinish to calculate the merging transaction. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 628fe9b107..3afdecda1b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17301,6 +17301,23 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver, break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: + /* we technically don't need reopen here, but we couldn't prepare + * the bitmaps if it wasn't present thus must skip this */ + if (blockdev && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) { + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; + + if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEM= U_ASYNC_JOB_NONE))) + return -1; + + if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, + job->data.commit.base, + blockNamedNodeData, + &actions, + job->data.commit.disabl= edBitmapsBase) < 0) + return -1; + } + break; } --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931469; cv=none; d=zohomail.com; s=zohoarc; b=ATJLSjzYsPAhPyX+Ms0BenGns8HZfOAvyloLQdYXi+KOwKjcbYLcre7XARzloE43yA38pOmLxiRPY9xagZw9S9Vl8zdNV4x2O43/ao0sbdhJD5VJndzglp62obf7qUGdUGa/iQ+IgpE1aUWhPV/ugQhY/X3VSazyutPFsUAfZto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931469; 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=YaoACrZjI0wnR7OY3CC0PW8EY6AzXWRdoKAyjvWZ8is=; b=jkwZ0dZS6qXRIciBfN6ouCHMHC6/yAV6OfIuRnnuld1R1SENSLd2IVTyja9QeaAlZCbY7RlJ4MMbsIuX1/PvGK0OFNgryq0nPdEJMcI3cx3+WA51aUy3gqQwsggO8AuzoRVUZV62MFDym7o9W2j/LgJpc7AJAKeJHcjEQ4ooIaI= 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 1583931469898241.31042401909292; Wed, 11 Mar 2020 05:57:49 -0700 (PDT) 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-222-RiR1KoNTPx-PoTpm7H3J0Q-1; Wed, 11 Mar 2020 08:57:46 -0400 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 9B480477; Wed, 11 Mar 2020 12:57:39 +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 66D7D60C87; Wed, 11 Mar 2020 12:57:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EBE2086A1E; Wed, 11 Mar 2020 12:57:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCvbn6009552 for ; Wed, 11 Mar 2020 08:57:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4642D5C219; Wed, 11 Mar 2020 12:57:37 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8ADA5C1D8; Wed, 11 Mar 2020 12:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931468; 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=YaoACrZjI0wnR7OY3CC0PW8EY6AzXWRdoKAyjvWZ8is=; b=V5BSSlPNwWi07+7G56TJlIeLquNECsvzpoPo0mNv04Uuvi/ezfjUozF4RuWUsK+6UKHXqX 9PZ7renF5QCKnuyfTcnDiXlI9JaAFljNzvQltXsSWhQbVNYRftlOef9dwNMAOKPRCEAN6l CxfF7oy/AD5yieos/PkU4MFLzKt/m1Y= X-MC-Unique: RiR1KoNTPx-PoTpm7H3J0Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 18/19] qemu: blockjob: Handle bitmaps after finish of normal block-commit Date: Wed, 11 Mar 2020 13:56:03 +0100 Message-Id: <1e8e20a6ae98a95112a140e47d6ddfb1ab5b7c55.1583930937.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Merge the bitmaps into base of the block commit after the job finishes. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_blockjob.c | 53 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 63f1cc79c3..ed7959175a 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1049,6 +1049,56 @@ qemuBlockJobDeleteImages(virQEMUDriverPtr driver, } } + +/** + * qemuBlockJobProcessEventCompletedCommitBitmaps: + * + * Handles the bitmap changes after commit. This function shall return -1 = on + * monitor failures. + */ +static int +qemuBlockJobProcessEventCompletedCommitBitmaps(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autoptr(virHashTable) blockNamedNodeData =3D NULL; + g_autoptr(virJSONValue) actions =3D NULL; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) + return 0; + + if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, asyncJob))) + return -1; + + if (qemuBlockBitmapsHandleCommitFinish(job->data.commit.top, + job->data.commit.base, + blockNamedNodeData, + &actions, + job->data.commit.disabledBitmap= sBase) < 0) + return 0; + + if (!actions) + return 0; + + if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0) + return -1; + + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + return -1; + + qemuMonitorTransaction(priv->mon, &actions); + + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + return -1; + + if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) + return -1; + + return 0; +} + + /** * qemuBlockJobProcessEventCompletedCommit: * @driver: qemu driver object @@ -1106,6 +1156,9 @@ qemuBlockJobProcessEventCompletedCommit(virQEMUDriver= Ptr driver, if (!n) return; + if (qemuBlockJobProcessEventCompletedCommitBitmaps(vm, job, asyncJob) = < 0) + return; + /* revert access to images */ qemuDomainStorageSourceAccessAllow(driver, vm, job->data.commit.base, true, false, false); --=20 2.24.1 From nobody Sun May 19 01:43:07 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=1583931474; cv=none; d=zohomail.com; s=zohoarc; b=GuAFjKfub+TvjO8C0WSK3jDmHzrnJO7dlEafPVx8UkqZDYZOIHfdMMtb+U7G05quIdrDzZiFfIGbxj71vK42/BcYwWPDZay3n2ARJ7PFnKcqVOGYj1BwnxWQzzO5OAv9K10AWdvzwVgXFaaMV3H25/386jOt/PDDiBBg5S6DCkE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583931474; 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=eNwY4Za6GAAvvyiLePwB5vSU6F8a7O96vzvW1lERPZM=; b=Bxa68HTi9MqClHwB8NM8nR61NFPwpeXzzCDb1bZTFfHO8WjCZ5jL3lDOxfRqWCvo9xCepCHJ6MTjAjZAuIfFtIMXWaH1ebICiZ5zTaDNb9D5GbfbfGIFjRIoavHbEtvpE4O7QD9Bpd0hNBSr18zwvUQVIdIkx973fKUHM5KkL1E= 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 158393147491681.02441918716602; Wed, 11 Mar 2020 05:57:54 -0700 (PDT) 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-116-aaYGtT5XPIW9rAXoVX9YFw-1; Wed, 11 Mar 2020 08:57:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DEF0DB69; Wed, 11 Mar 2020 12:57:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F32C8FBE0; Wed, 11 Mar 2020 12:57:43 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1400E1832E29; Wed, 11 Mar 2020 12:57:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 02BCvefq009562 for ; Wed, 11 Mar 2020 08:57:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42A825C545; Wed, 11 Mar 2020 12:57:40 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91EF85C1D8; Wed, 11 Mar 2020 12:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583931471; 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=eNwY4Za6GAAvvyiLePwB5vSU6F8a7O96vzvW1lERPZM=; b=Pyz09PDuaVKZlCBFD9KoLS5P/4L1J8UR2CserDUO1H/ACm/9Pv3M4KzRXkVOteq70GV9U+ z2NJ9oXNn6vlkObocdX5cZbsgU8u9DAPK8wE95mG6OCggdCg/sIVFJlGZLJbmvklFiIa2O LKK5H2/VhB77oq4lhPzO/9prHpKMP34= X-MC-Unique: aaYGtT5XPIW9rAXoVX9YFw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 19/19] qemu: blockjob: Re-enable bitmaps after failed block-copy Date: Wed, 11 Mar 2020 13:56:04 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If a block-copy fails we should at least re-enable the bitmaps so that the operation can be re-tried. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_blockjob.c | 42 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index ed7959175a..60fe1cedf6 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1346,6 +1346,40 @@ qemuBlockJobProcessEventFailedActiveCommit(virQEMUDr= iverPtr driver, } +static void +qemuBlockJobProcessEventFailedCommitCommon(virDomainObjPtr vm, + qemuBlockJobDataPtr job, + qemuDomainAsyncJob asyncJob) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + g_autoptr(virJSONValue) actions =3D virJSONValueNewArray(); + char **disabledBitmaps =3D job->data.commit.disabledBitmapsBase; + + if (!disabledBitmaps || !*disabledBitmaps) + return; + + for (; *disabledBitmaps; disabledBitmaps++) { + qemuMonitorTransactionBitmapEnable(actions, + job->data.commit.base->nodeform= at, + *disabledBitmaps); + } + + if (qemuBlockReopenReadWrite(vm, job->data.commit.base, asyncJob) < 0) + return; + + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) + return; + + qemuMonitorTransaction(priv->mon, &actions); + + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0) + return; + + if (qemuBlockReopenReadOnly(vm, job->data.commit.base, asyncJob) < 0) + return; +} + + static void qemuBlockJobProcessEventConcludedCreate(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -1453,13 +1487,17 @@ qemuBlockJobEventProcessConcludedTransition(qemuBlo= ckJobDataPtr job, case QEMU_BLOCKJOB_TYPE_COMMIT: if (success) qemuBlockJobProcessEventCompletedCommit(driver, vm, job, async= Job); + else + qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob); break; case QEMU_BLOCKJOB_TYPE_ACTIVE_COMMIT: - if (success) + if (success) { qemuBlockJobProcessEventCompletedActiveCommit(driver, vm, job,= asyncJob); - else + } else { qemuBlockJobProcessEventFailedActiveCommit(driver, vm, job); + qemuBlockJobProcessEventFailedCommitCommon(vm, job, asyncJob); + } break; case QEMU_BLOCKJOB_TYPE_CREATE: --=20 2.24.1