From nobody Sat Apr 27 20:24:47 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=1576171146; cv=none; d=zohomail.com; s=zohoarc; b=nYOsOLy9Bwo/V9D3DoMBO5a6CofnNq8jNpXMK9xpnMwS6OvV+rQbHQdXJjPwffoGyFvuEqLTES52Xm/hf4kA318yEcjwYh2lsFHjUmpQVXrFYKkQllNf9b6omoxvdxfGWbS38vT4N8sbwh/9y2kMbGydzZbbbAyJUeauK/wzBBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171146; 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=/68zTpUhUaYyZ2olvpPCf+hHru5qN3KmlTdib3cesAw=; b=j8Mj2JNFGygRzb4XOsXffUvbcfM0929kWJbgxiNBCviNBFX5iEt+2ubqoIGgUNruCQb43uRVzPCnhIgFoIzR++691xd3fEzVzYgSnYifXXnAKlZyCsNmvG89fEOCSqm+s0NpMNrv+JWT1ctfNqBvh7tsHo3IyLlcjKXACjHDP5Y= 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 1576171146712152.36487573573845; Thu, 12 Dec 2019 09:19:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-120-lVymFja5P5OkfygLjrh_bg-1; Thu, 12 Dec 2019 12:19:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD2011854321; Thu, 12 Dec 2019 17:18:57 +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 9022461F37; Thu, 12 Dec 2019 17:18:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AB9CF18089CE; Thu, 12 Dec 2019 17:18:55 +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 xBCHIrxD004987 for ; Thu, 12 Dec 2019 12:18:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id 358785C241; Thu, 12 Dec 2019 17:18:53 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFF8B5C21B for ; Thu, 12 Dec 2019 17:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171145; 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=/68zTpUhUaYyZ2olvpPCf+hHru5qN3KmlTdib3cesAw=; b=YCupKn285xMsGMlxQqg0hbo/n1keXD27NzLKxkda0Q3Xf0eMWNb/B44/YZ3QqxTBHPF7vR MCpetNABkYc+JsZ/CbEr5uOcSTnRUpr8BbI9TR8OVUDezgYVWAkDZXUuETi7M8GKq6rwWI +37yyQqYDs6+T5d6h/Ub0+owNgVw238= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:31 +0100 Message-Id: <95a8c5f83d7cf9b949e18919086dc979dc0094b7.1576170715.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 Subject: [libvirt] [PATCH 01/19] virsh: Add QMP command wrapping for 'qemu-monitor-command' X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: lVymFja5P5OkfygLjrh_bg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Issuing simple QMP commands is pain as they need to be wrapped by the JSON wrapper: { "execute": "COMMAND" } and optionally also: { "execute": "COMMAND", "arguments":...} For simple commands without arguments we can add syntax sugar to virsh which allows simple usage of QMP and additionally prepares also for passing through of the 'arguments' section. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- docs/manpages/virsh.rst | 24 +++++++++++++++++------- tools/virsh-domain.c | 32 +++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index e9d6deaee1..697f83e5b2 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -7434,16 +7434,26 @@ qemu-monitor-command .. code-block:: shell - qemu-monitor-command domain { [--hmp] | [--pretty] } command... + qemu-monitor-command domain { [--hmp] | [--qmp] [--pretty] } command... Send an arbitrary monitor command *command* to domain *domain* through the -qemu monitor. The results of the command will be printed on stdout. If -*--hmp* is passed, the command is considered to be a human monitor command +qemu monitor. The results of the command will be printed on stdout. + +*command* is directly passed to qemu. If more than one argument is provide= d for +*command*, they are concatenated with a space in between before passing the +single command to the monitor. + +If *--qmp* is passed the first argument passed as *command* is used as a Q= MP +command name and appropriately wrapped into a JSON block. Additionally a s= econd +argument passed as *command* is appended as value of the 'arguments' param= eter +of the QMP command verbatim. + +If *--pretty* is given, and the monitor uses QMP, then the output will be +pretty-printed. + +If *--hmp* is passed, the command is considered to be a human monitor comm= and and libvirt will automatically convert it into QMP if needed. In that case -the result will also be converted back from QMP. If *--pretty* is given, -and the monitor uses QMP, then the output will be pretty-printed. If more -than one argument is provided for *command*, they are concatenated with a -space in between before passing the single command to the monitor. +the result will also be converted back from QMP. qemu-agent-command diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 56137bdd74..9447fa2904 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9522,6 +9522,10 @@ static const vshCmdOptDef opts_qemu_monitor_command[= ] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("pretty-print any qemu monitor protocol output") }, + {.name =3D "qmp", + .type =3D VSH_OT_BOOL, + .help =3D N_("wrap the 'cmd' argument in JSON wrapper for QMP") + }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, .flags =3D VSH_OFLAG_REQ, @@ -9539,16 +9543,38 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd= *cmd) unsigned int flags =3D 0; const vshCmdOpt *opt =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; + bool qmp =3D vshCommandOptBool(cmd, "qmp"); VSH_EXCLUSIVE_OPTIONS("hmp", "pretty"); + VSH_EXCLUSIVE_OPTIONS("hmp", "qmp"); if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; - while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) - virBufferAsprintf(&buf, "%s ", opt->data); + if (qmp) { + const char *command =3D NULL; + const char *arguments =3D NULL; - virBufferTrim(&buf, " ", -1); + if ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) + command =3D opt->data; + if ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) + arguments =3D opt->data; + + if (!command || (arguments && vshCommandOptArgv(ctl, cmd, opt))) { + vshError(ctl, "%s", _("-qmp option requires 1 or 2 arguments")= ); + return false; + } + + virBufferAsprintf(&buf, "{\"execute\":\"%s\"", command); + if (arguments) + virBufferAsprintf(&buf, ", \"arguments\":%s", arguments); + virBufferAddLit(&buf, "}"); + } else { + while ((opt =3D vshCommandOptArgv(ctl, cmd, opt))) + virBufferAsprintf(&buf, "%s ", opt->data); + + virBufferTrim(&buf, " ", -1); + } monitor_cmd =3D virBufferContentAndReset(&buf); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171147; cv=none; d=zohomail.com; s=zohoarc; b=OtqE5kJsmFaJojw8BakTg6zEl9tKPV6oL7KzAJI6Ec7s0+BUEGaUqjeldA92Nf03fcJOjoXTw6QH4hznW1VEG/55VOPu7P7EHsY6geFa3b3bLJi5D68/alAT9BsftCYPqetEPGkeybCjY/lbSgLcOIBdaDFlu4yM4DXRBF+5x9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171147; 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=drnpPPlBYhcwPPwCmv78bbufEhRizjK3Qh2HN+qP+pY=; b=U7tFs8+Iu3yomCghMSHMYCkIS/yq/y1Z1ezCystvyPIeeDAgzwCMlx98HRoHZa0yEzLuuTogGiD0xOSz0UEXXoQRPp13ZQmT6FzcKkiSSNCnvOpcKCYcwYySL1S7guQc6DQZMMWX2Rr1ZUgKbQFHUgEILmFQMqiHHrTSoLBKyag= 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 1576171147365739.3685635604896; Thu, 12 Dec 2019 09:19:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-285-g3ZoTMyrNNe53ta3uPUDaQ-1; Thu, 12 Dec 2019 12:19:04 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBC06800D41; Thu, 12 Dec 2019 17:18:56 +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 9EAC910013D9; Thu, 12 Dec 2019 17:18:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2C74018089CF; Thu, 12 Dec 2019 17:18:56 +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 xBCHIsle005014 for ; Thu, 12 Dec 2019 12:18:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 02DE65C241; Thu, 12 Dec 2019 17:18:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 806615C21B for ; Thu, 12 Dec 2019 17:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171146; 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=drnpPPlBYhcwPPwCmv78bbufEhRizjK3Qh2HN+qP+pY=; b=W6zPevmm8Mo7/7ABtEWpfFacE2z9gtXvKJc3qunwZE56E+4uF3F+3vW3coneC3YKsDfu1f IUoFgGdwgboPDN9xPMtqVjU6XrNEadEMQciJ9AjLx6iNLxELGbnAnCPq7StCOLPnQ+jWA2 VoOgKJd0ns/OxsajO37UQbAeUunOedk= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:32 +0100 Message-Id: <4393c46340dcbc0a28cd7c61c0d780c813056c8a.1576170715.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 Subject: [libvirt] [PATCH 02/19] virsh: Allow extracting 'return' section of QMP command in 'qemu-monitor-command' 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-MC-Unique: g3ZoTMyrNNe53ta3uPUDaQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Simplify gathering the actual return value from a passed-through QMP command when using 'qemu-monitor-command' by adding '--return-value' switch which just extracts the 'return' section and alternatively reports an error if the section is not present. This simplifies gathering of some test data where the full reply would need to be trimmed just for the actual return value. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- docs/manpages/virsh.rst | 5 ++++- tools/virsh-domain.c | 44 ++++++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index 697f83e5b2..7ec620f6ee 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -7434,7 +7434,7 @@ qemu-monitor-command .. code-block:: shell - qemu-monitor-command domain { [--hmp] | [--qmp] [--pretty] } command... + qemu-monitor-command domain { [--hmp] | [--qmp] [--pretty] [--return-va= lue] } command... Send an arbitrary monitor command *command* to domain *domain* through the qemu monitor. The results of the command will be printed on stdout. @@ -7451,6 +7451,9 @@ of the QMP command verbatim. If *--pretty* is given, and the monitor uses QMP, then the output will be pretty-printed. +If *--return-value* is given the 'return' key of the QMP response object is +extracted rather than passing through the full reply from qemu. + If *--hmp* is passed, the command is considered to be a human monitor comm= and and libvirt will automatically convert it into QMP if needed. In that case the result will also be converted back from QMP. diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 9447fa2904..a592726042 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -9526,6 +9526,10 @@ static const vshCmdOptDef opts_qemu_monitor_command[= ] =3D { .type =3D VSH_OT_BOOL, .help =3D N_("wrap the 'cmd' argument in JSON wrapper for QMP") }, + {.name =3D "return-value", + .type =3D VSH_OT_BOOL, + .help =3D N_("extract the value of the 'return' key from the returned= string") + }, {.name =3D "cmd", .type =3D VSH_OT_ARGV, .flags =3D VSH_OFLAG_REQ, @@ -9540,13 +9544,19 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd= *cmd) g_autoptr(virshDomain) dom =3D NULL; g_autofree char *monitor_cmd =3D NULL; g_autofree char *result =3D NULL; + g_autoptr(virJSONValue) resultjson =3D NULL; unsigned int flags =3D 0; const vshCmdOpt *opt =3D NULL; virBuffer buf =3D VIR_BUFFER_INITIALIZER; bool qmp =3D vshCommandOptBool(cmd, "qmp"); + bool pretty =3D vshCommandOptBool(cmd, "pretty"); + bool returnval =3D vshCommandOptBool(cmd, "return-value"); + virJSONValuePtr formatjson; + g_autofree char *jsonstr =3D NULL; VSH_EXCLUSIVE_OPTIONS("hmp", "pretty"); VSH_EXCLUSIVE_OPTIONS("hmp", "qmp"); + VSH_EXCLUSIVE_OPTIONS("hmp", "return-value"); if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -9584,17 +9594,33 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd= *cmd) if (virDomainQemuMonitorCommand(dom, monitor_cmd, &result, flags) < 0) return false; - if (vshCommandOptBool(cmd, "pretty")) { - char *tmp; - if ((tmp =3D virJSONStringReformat(result, true))) { - VIR_FREE(result); - result =3D tmp; - virTrimSpaces(result, NULL); - } else { - vshResetLibvirtError(); + if (returnval || pretty) { + resultjson =3D virJSONValueFromString(result); + + if (returnval && !resultjson) { + vshError(ctl, "failed to parse JSON returned by qemu"); + return false; } } - vshPrint(ctl, "%s\n", result); + + /* print raw non-prettified result */ + if (!resultjson) { + vshPrint(ctl, "%s\n", result); + return true; + } + + if (returnval) { + if (!(formatjson =3D virJSONValueObjectGet(resultjson, "return")))= { + vshError(ctl, "'return' member missing"); + return false; + } + } else { + formatjson =3D resultjson; + } + + jsonstr =3D virJSONValueToString(formatjson, pretty); + virTrimSpaces(jsonstr, NULL); + vshPrint(ctl, "%s", jsonstr); return true; } --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171205; cv=none; d=zohomail.com; s=zohoarc; b=kWsl8gn3bjsx8OX2YgsF8HV6e+pBSoGuUKatH3F616B9UJ6QeaSsoPOGse+wWA02VtOYwwuaz+ndMQKbgTK/2Di/yzZyguOpy6FKAMB61VauY6FAEVy9+B4DZSqm/qCmcj8nIROo5qKRPqTIrgBqtXkNFyM9EvnQe6Qt+mLZnp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171205; 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=B8pYmcleT8utl0UTCSLFCSyhabzeISFicjMpglIV0tI=; b=J79ecIOoFVyx3huhoFiz92VZfK9sGNee90K9XhqRbYu+T/RgcBpt/fi1JAnuE6r6+odVjUz3JM1mt4LnW1Kf5CJI6RtsbixkRDfPGWAdhBlpauACjQIez3uiCxgJeMGPU2m987jGxsij5dcY3Y7Kz/SI7Gc1TGG2nHp6TAW0dKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1576171205138197.1373261540307; Thu, 12 Dec 2019 09:20:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-SSV6Z5VoPr69G32NvGvl7Q-1; Thu, 12 Dec 2019 12:19:15 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 369D91854326; Thu, 12 Dec 2019 17:19:08 +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 038A310013A1; Thu, 12 Dec 2019 17:19: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 9DF7B83730; Thu, 12 Dec 2019 17:19:07 +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 xBCHIsvd005040 for ; Thu, 12 Dec 2019 12:18:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8F6B5C241; Thu, 12 Dec 2019 17:18:54 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 516275C21B for ; Thu, 12 Dec 2019 17:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171203; 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=B8pYmcleT8utl0UTCSLFCSyhabzeISFicjMpglIV0tI=; b=DYWBc8wzm3zVJbAtd4o6CASQnv7NyMWckcZqGiNcXuV3xqpmnQTxfR5N8WKa5jx+ho8WGT Y/dqcyDEvSRIQcbNE5Y778YGrYrgqWVAux0jk2tY/nO9XwhMnjNTzX5WVGfttkKoiMcGdK z9U2Omh/oocHsVLub0Hp2+aqyAfDMgI= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:33 +0100 Message-Id: <05802365425b88d41bcd1af005468f0ba70dbc59.1576170715.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 Subject: [libvirt] [PATCH 03/19] qemu: monitor: Extract data about dirty-bimaps in qemuMonitorBlockGetNamedNodeData 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-MC-Unique: SSV6Z5VoPr69G32NvGvl7Q-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We will need to inspect the presence and attributes for dirty bitmaps. Extract them when processing reply of query-named-block-nodes. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_monitor.h | 15 ++++++++ src/qemu/qemu_monitor_json.c | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 79e078fca4..1c990923d6 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -676,12 +676,27 @@ int qemuMonitorBlockStatsUpdateCapacityBlockdev(qemuM= onitorPtr mon, virHashTablePtr stats) ATTRIBUTE_NONNULL(2); +typedef struct _qemuBlockNamedNodeDataBitmap qemuBlockNamedNodeDataBitmap; +typedef qemuBlockNamedNodeDataBitmap *qemuBlockNamedNodeDataBitmapPtr; +struct _qemuBlockNamedNodeDataBitmap { + char *name; + bool recording; + bool busy; + bool persistent; + bool inconsistent; + + unsigned long long dirtybytes; + unsigned long long granularity; +}; typedef struct _qemuBlockNamedNodeData qemuBlockNamedNodeData; typedef qemuBlockNamedNodeData *qemuBlockNamedNodeDataPtr; struct _qemuBlockNamedNodeData { unsigned long long capacity; unsigned long long physical; + + qemuBlockNamedNodeDataBitmapPtr *bitmaps; + size_t nbitmaps; }; virHashTablePtr diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 00e1d3ce15..e3a6e3a6a2 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2873,14 +2873,84 @@ qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qem= uMonitorPtr mon, } +static void +qemuMonitorJSONBlockNamedNodeDataBitmapFree(qemuBlockNamedNodeDataBitmapPt= r bitmap) +{ + if (!bitmap) + return; + + g_free(bitmap->name); + g_free(bitmap); +} + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuBlockNamedNodeDataBitmap, + qemuMonitorJSONBlockNamedNodeDataBitmapFree); + + static void qemuMonitorJSONBlockNamedNodeDataFree(qemuBlockNamedNodeDataPtr data) { + size_t i; + + if (!data) + return; + + for (i =3D 0; i < data->nbitmaps; i++) + qemuMonitorJSONBlockNamedNodeDataBitmapFree(data->bitmaps[i]); + g_free(data->bitmaps); g_free(data); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuBlockNamedNodeData, qemuMonitorJSONBlock= NamedNodeDataFree); +static qemuBlockNamedNodeDataBitmapPtr +qemuMonitorJSONBlockGetNamedNodeDataBitmapOne(virJSONValuePtr val) +{ + g_autoptr(qemuBlockNamedNodeDataBitmap) bitmap =3D NULL; + const char *name; + + bitmap =3D g_new0(qemuBlockNamedNodeDataBitmap, 1); + + if (!(name =3D virJSONValueObjectGetString(val, "name"))) + return NULL; + + bitmap->name =3D g_strdup(name); + + ignore_value(virJSONValueObjectGetBoolean(val, "recording", &bitmap->r= ecording)); + ignore_value(virJSONValueObjectGetBoolean(val, "persistent", &bitmap->= persistent)); + ignore_value(virJSONValueObjectGetBoolean(val, "busy", &bitmap->busy)); + ignore_value(virJSONValueObjectGetBoolean(val, "inconsistent", &bitmap= ->inconsistent)); + ignore_value(virJSONValueObjectGetNumberUlong(val, "granularity", &bit= map->granularity)); + ignore_value(virJSONValueObjectGetNumberUlong(val, "count", &bitmap->d= irtybytes)); + + return g_steal_pointer(&bitmap); +} + + +static void +qemuMonitorJSONBlockGetNamedNodeDataBitmaps(virJSONValuePtr bitmaps, + qemuBlockNamedNodeDataPtr data) +{ + size_t nbitmaps =3D virJSONValueArraySize(bitmaps); + size_t i; + + data->bitmaps =3D g_new0(qemuBlockNamedNodeDataBitmapPtr, nbitmaps); + + for (i =3D 0; i < nbitmaps; i++) { + virJSONValuePtr bitmap =3D virJSONValueArrayGet(bitmaps, i); + qemuBlockNamedNodeDataBitmapPtr tmp; + + if (!bitmap) + continue; + + if (!(tmp =3D qemuMonitorJSONBlockGetNamedNodeDataBitmapOne(bitmap= ))) + continue; + + data->bitmaps[data->nbitmaps++] =3D tmp; + } +} + + static int qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos G_GNUC_UNUSED, virJSONValuePtr val, @@ -2888,6 +2958,7 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos= G_GNUC_UNUSED, { virHashTablePtr nodes =3D opaque; virJSONValuePtr img; + virJSONValuePtr bitmaps; const char *nodename; g_autoptr(qemuBlockNamedNodeData) ent =3D NULL; @@ -2904,6 +2975,9 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t pos= G_GNUC_UNUSED, if (virJSONValueObjectGetNumberUlong(img, "actual-size", &ent->physica= l) < 0) ent->physical =3D ent->capacity; + if ((bitmaps =3D virJSONValueObjectGetArray(val, "dirty-bitmaps"))) + qemuMonitorJSONBlockGetNamedNodeDataBitmaps(bitmaps, ent); + if (virHashAddEntry(nodes, nodename, ent) < 0) return -1; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171158; cv=none; d=zohomail.com; s=zohoarc; b=KbCyBm+AT42wRdjyMKnG1Y/Q2pr7CzaOOKXMDkDkxVSF784ICOEjgwaqCBj1q+i5SWFTGtnQr5M07ocWM/OZBG+2w5im2sFxTnrJCAHGXsE2Xb5Y0suC15FrL2h5X35woMJjOsi/JFnS7ls6AGADH6VC7YkwVhcJ+sljyYBb4sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171158; 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=euhP00JY0xuZB6AtKu0YbnajqY6iQjn0AcSYNw70W0s=; b=QfIHio+maTQjE3FO2KzndGpfgDxiCd36Jk2fRscGBT6v6C03f3QkHiDe0GgloeefXcPH+oPYaRySWYvJAVyvJTjTq5M1AqhBwFKZGFyFCSAivxs+I9fjCdE/shcmri0CQaXOMzOBba9N+Y+Msgo6p2eail7qo4UgO2jkZMLKtKI= 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 1576171158682435.36564376928516; Thu, 12 Dec 2019 09:19:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-7dJ4MHBVMWO8jx42appOcg-1; Thu, 12 Dec 2019 12:19:15 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE77C1854329; Thu, 12 Dec 2019 17:19:08 +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 B4E1710013A1; Thu, 12 Dec 2019 17:19: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 49D0818089D5; Thu, 12 Dec 2019 17:19: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 xBCHIt3E005064 for ; Thu, 12 Dec 2019 12:18:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 98C5C5C21B; Thu, 12 Dec 2019 17:18:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221B25C241 for ; Thu, 12 Dec 2019 17:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171157; 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=euhP00JY0xuZB6AtKu0YbnajqY6iQjn0AcSYNw70W0s=; b=VqqBk+RZu0UPikHPjFZjScon+9jGrlL262iVYqMe5oWYYyM0vd4nf7n7zwOR7LoXS3mgjn Ez9YJnM2OdxhYVTsWbgGve44xK3X+pdVBvcTPyB6Iz/n/U18ikXww7wsVmaaY0iD9m2Nqz GujhoANqdot3MSKcLIc78c4tflWyAZk= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:34 +0100 Message-Id: <54e7278251e32de963008f5231ee1948b4cbb2f7.1576170715.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 Subject: [libvirt] [PATCH 04/19] qemu: monitor: Extract internals of qemuMonitorJSONBlockGetNamedNodeData 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-MC-Unique: 7dJ4MHBVMWO8jx42appOcg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For testing purposes it will be beneficial to be able to parse the data from JSON directly rather than trying to simulate the monitor. Extract the worker bits and export them. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_monitor_json.c | 18 +++++++++++++----- src/qemu/qemu_monitor_json.h | 3 +++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e3a6e3a6a2..856c2c2778 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2993,14 +2993,10 @@ qemuMonitorJSONBlockGetNamedNodeDataWorker(size_t p= os G_GNUC_UNUSED, virHashTablePtr -qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon) +qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes) { - g_autoptr(virJSONValue) nodes =3D NULL; g_autoptr(virHashTable) ret =3D NULL; - if (!(nodes =3D qemuMonitorJSONQueryNamedBlockNodes(mon))) - return NULL; - if (!(ret =3D virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNo= deDataFree))) return NULL; @@ -3013,6 +3009,18 @@ qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr = mon) } +virHashTablePtr +qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon) +{ + g_autoptr(virJSONValue) nodes =3D NULL; + + if (!(nodes =3D qemuMonitorJSONQueryNamedBlockNodes(mon))) + return NULL; + + return qemuMonitorJSONBlockGetNamedNodeDataJSON(nodes); +} + + int qemuMonitorJSONBlockResize(qemuMonitorPtr mon, const char *device, const char *nodename, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 5d05772fa2..44926464b9 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -87,6 +87,9 @@ int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitorPt= r mon, int qemuMonitorJSONBlockStatsUpdateCapacityBlockdev(qemuMonitorPtr mon, virHashTablePtr stats); +virHashTablePtr +qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValuePtr nodes); + virHashTablePtr qemuMonitorJSONBlockGetNamedNodeData(qemuMonitorPtr mon); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171160; cv=none; d=zohomail.com; s=zohoarc; b=dI2BD+SN268xAONmjpPyUeO9IJB5BtPK9kNY2YQyj43Ke7cKfHQTJg3Ioi9ilQicOUcFzqQEm8fgwjAb/Qgq75XxRfO4viKn6l5XHVCawWm0l68Kn9B4m4caR3aNn2kbx2v7Y8qLntuM3bHqaijrlbL63wThZ0L7dPogPVrGnXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171160; 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=h7EhFUhRjdF3tbcjyOmf+ZCTa7zjH+3ujYmJC2rUN8M=; b=eobuIXgnr3JUfSv3OFCgbsnWOO7ujXCuqfZyaBt+x1IRoJVxBwOTJEFvvlQkUIclEk5Hyvu8/nZf9+ToS0mXH3c5l+u7HAyWtJKt++k9bNtX5rLIKEzjZJD4s+ucSNiA6PO9SMD4hVQtSgbyXLU3TiWo4xkJoaD219KgDUALj8I= 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 1576171160873603.7863593727556; Thu, 12 Dec 2019 09:19:20 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-304-aAWPOv1HPJOPhpmsx2i9vg-1; Thu, 12 Dec 2019 12:19:18 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8947B8005BC; Thu, 12 Dec 2019 17:19:12 +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 199B210013A1; Thu, 12 Dec 2019 17:19:12 +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 CFBA883732; Thu, 12 Dec 2019 17:19:11 +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 xBCHIur4005088 for ; Thu, 12 Dec 2019 12:18:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id 68ECD5C241; Thu, 12 Dec 2019 17:18:56 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E66CB5C21B for ; Thu, 12 Dec 2019 17:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171159; 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=h7EhFUhRjdF3tbcjyOmf+ZCTa7zjH+3ujYmJC2rUN8M=; b=fNSq34DEUcXrD1mEfoofexyRpfdPcknxQcJljyemgJfl+sLiIFlcP0VivcEMvH5GctWYdz ocVf4a88hCr9IoN84UkJi8vyFPiThpcRuzlabdtn0z6YNVZv7vQcYkkDWrMmbo+VxUWucZ T8F58bhHETpv9iWdJLH19dRmmAy5FGI= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:35 +0100 Message-Id: <60f348ecadab1cacdb7707f95d6342ca557452a9.1576170715.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 Subject: [libvirt] [PATCH 05/19] tests: qemublock: Add test for bitmap detection 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-MC-Unique: aAWPOv1HPJOPhpmsx2i9vg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Test the extraction of data about changed block tracking bitmaps. The first test case adds a simple scenario of multiple bitmaps in one layer. The test data will be also later reused for testing the code that determines which bitmaps to merge for an incremental backup. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 75 ++++++++++++++ tests/qemublocktestdata/bitmap/basic.json | 117 ++++++++++++++++++++++ tests/qemublocktestdata/bitmap/basic.out | 6 ++ 3 files changed, 198 insertions(+) create mode 100644 tests/qemublocktestdata/bitmap/basic.json create mode 100644 tests/qemublocktestdata/bitmap/basic.out diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 2c170548ec..16bee47a12 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -27,6 +27,7 @@ # include "virlog.h" # include "qemu/qemu_block.h" # include "qemu/qemu_qapi.h" +# include "qemu/qemu_monitor_json.h" # include "qemu/qemu_command.h" @@ -492,6 +493,71 @@ testQemuDiskXMLToPropsValidateFileSrcOnly(const void *= opaque) } +static const char *bitmapDetectPrefix =3D "qemublocktestdata/bitmap/"; + +static void +testQemuDetectBitmapsWorker(virHashTablePtr nodedata, + const char *nodename, + virBufferPtr buf) +{ + qemuBlockNamedNodeDataPtr data; + size_t i; + + if (!(data =3D virHashLookup(nodedata, nodename))) + return; + + virBufferAsprintf(buf, "%s:\n", nodename); + virBufferAdjustIndent(buf, 1); + + for (i =3D 0; i < data->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D data->bitmaps[i]; + + virBufferAsprintf(buf, "%8s: recod:%d busy:%d persist:%d inconist:= %d gran:%llu dirty:%llu\n", + bitmap->name, bitmap->recording, bitmap->busy, + bitmap->persistent, bitmap->inconsistent, + bitmap->granularity, bitmap->dirtybytes); + } + + virBufferAdjustIndent(buf, -1); +} + + +static int +testQemuDetectBitmaps(const void *opaque) +{ + const char *name =3D opaque; + g_autoptr(virJSONValue) nodedatajson =3D NULL; + g_autoptr(virHashTable) nodedata =3D NULL; + g_autofree char *actual =3D NULL; + g_autofree char *expectpath =3D NULL; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; + size_t i; + + expectpath =3D g_strdup_printf("%s/%s%s.out", abs_srcdir, + bitmapDetectPrefix, name); + + if (!(nodedatajson =3D virTestLoadFileJSON(bitmapDetectPrefix, name, + ".json", NULL))) + return -1; + + if (!(nodedata =3D qemuMonitorJSONBlockGetNamedNodeDataJSON(nodedatajs= on))) { + VIR_TEST_VERBOSE("failed to load nodedata JSON\n"); + return -1; + } + + /* we detect for the first 30 nodenames for simplicity */ + for (i =3D 0; i < 30; i++) { + g_autofree char *nodename =3D g_strdup_printf("libvirt-%zu-format"= , i); + + testQemuDetectBitmapsWorker(nodedata, nodename, &buf); + } + + actual =3D virBufferContentAndReset(&buf); + + return virTestCompareToFile(actual, expectpath); +} + + static int mymain(void) { @@ -702,6 +768,15 @@ mymain(void) TEST_IMAGE_CREATE("network-ssh-qcow2", NULL); TEST_IMAGE_CREATE("network-sheepdog-qcow2", NULL); +# define TEST_BITMAP_DETECT(testname) \ + do { \ + if (virTestRun("bitmap detect " testname, \ + testQemuDetectBitmaps, testname) < 0) \ + ret =3D -1; \ + } while (0) + + TEST_BITMAP_DETECT("basic"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/bitmap/basic.json b/tests/qemublocktes= tdata/bitmap/basic.json new file mode 100644 index 0000000000..9d418b1a37 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/basic.json @@ -0,0 +1,117 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "dirty-bitmaps": [ + { + "name": "current", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + }, + { + "name": "d", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "c", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "b", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "a", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/tmp/pull4.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + } +] diff --git a/tests/qemublocktestdata/bitmap/basic.out b/tests/qemublocktest= data/bitmap/basic.out new file mode 100644 index 0000000000..ab1660be50 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/basic.out @@ -0,0 +1,6 @@ +libvirt-1-format: + current: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + d: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + c: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + b: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + a: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171214; cv=none; d=zohomail.com; s=zohoarc; b=bBVH8BamFb5ihFZVcEBMtvGKUQi3llx47Hf2hq6Zt49xUxvkDMEEEWLbrF0nnxj1Cn1/ZPG7/c5zGwGppUKehZ7YC3VG69Q+uOiQ95MsRgDUJRGhjAwLBYCSRZ52gLvMV8N4KnzGLUl2XAaldOZ1+ZxlDdlb907oDM530NK5afs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171214; 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=6V51AI6AfX5Y6LZvkCF33VSM/qKjq1WoGTmU438fEu4=; b=Ih4yWAAChKnf085B552o31t5DwKnc1T+1ELsAsWF9JOWPapF1zrWYbH5NDJFEYlxRseSBe0ipO/W3uE0Wnk2CYsC/3mwfWC+dQyNTck/9FIQs/YkyRi2ACeOECewexs17Avb5n1lqBRF/vTgZxM87SQAzKAdgvVcyYudxocWwpw= 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 1576171213995921.9212122614766; Thu, 12 Dec 2019 09:20:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-245-yCJAo7cjNpeKF83iVyWIuA-1; Thu, 12 Dec 2019 12:19:20 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD2F61854327; Thu, 12 Dec 2019 17:19:12 +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 A539E10013A1; Thu, 12 Dec 2019 17:19:12 +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 5779283734; Thu, 12 Dec 2019 17:19: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 xBCHIvd1005115 for ; Thu, 12 Dec 2019 12:18:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3A6835C298; Thu, 12 Dec 2019 17:18:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B69765C241 for ; Thu, 12 Dec 2019 17:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171212; 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=6V51AI6AfX5Y6LZvkCF33VSM/qKjq1WoGTmU438fEu4=; b=B3MJFwLQIjqo2X/n+6Bb6haSHCvYxrcIfG0PGr4Z/qxTIdhFGbPmOcOPO70KHUHSufPD44 gRgolQTqOc7RM5ow73JUCWJLEpJIZPnLo5ak3wdAOlIuG68oh1uMZM4XUnMwkYELBf3N3/ 3Cyps1fNEP11uxtIw6/OJGjwyt2iRKo= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:36 +0100 Message-Id: <3e462817712335fd3d5fa9c9fe6ec8c9288dd922.1576170715.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 Subject: [libvirt] [PATCH 06/19] tests: qemublocktest: Add a syntetic test case for bitmap detection 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-MC-Unique: yCJAo7cjNpeKF83iVyWIuA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The real data gathered for the 'basic' test case don't excercise some fields. Add a copy with a few values modified. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 1 + tests/qemublocktestdata/bitmap/synthetic.json | 118 ++++++++++++++++++ tests/qemublocktestdata/bitmap/synthetic.out | 6 + 3 files changed, 125 insertions(+) create mode 100644 tests/qemublocktestdata/bitmap/synthetic.json create mode 100644 tests/qemublocktestdata/bitmap/synthetic.out diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 16bee47a12..e3aee03c81 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -776,6 +776,7 @@ mymain(void) } while (0) TEST_BITMAP_DETECT("basic"); + TEST_BITMAP_DETECT("synthetic"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/bitmap/synthetic.json b/tests/qemubloc= ktestdata/bitmap/synthetic.json new file mode 100644 index 0000000000..56882bd615 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/synthetic.json @@ -0,0 +1,118 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 200704, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "dirty-bitmaps": [ + { + "name": "current", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + }, + { + "name": "d", + "recording": false, + "persistent": false, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "c", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 1234, + "count": 0 + }, + { + "name": "b", + "recording": false, + "persistent": true, + "busy": true, + "status": "disabled", + "granularity": 65536, + "count": 21314 + }, + { + "name": "a", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "inconsistent": true, + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 197120, + "filename": "/tmp/pull4.qcow2", + "format": "file", + "actual-size": 200704, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + } +] diff --git a/tests/qemublocktestdata/bitmap/synthetic.out b/tests/qemublock= testdata/bitmap/synthetic.out new file mode 100644 index 0000000000..d941716d4b --- /dev/null +++ b/tests/qemublocktestdata/bitmap/synthetic.out @@ -0,0 +1,6 @@ +libvirt-1-format: + current: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + d: recod:0 busy:0 persist:0 inconist:0 gran:65536 dirty:0 + c: recod:0 busy:0 persist:1 inconist:0 gran:1234 dirty:0 + b: recod:0 busy:1 persist:1 inconist:0 gran:65536 dirty:21314 + a: recod:0 busy:0 persist:1 inconist:1 gran:65536 dirty:0 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171213; cv=none; d=zohomail.com; s=zohoarc; b=MtqKqvPHDW3C1Um6KM6FJEPPBHfkRPFbzVQRc0NILNjB/OBZP8h8AFuESuYZtGy7j/FFe1/dFKMSB9i1CmxTWjrHfPzhCSvL+Ik9CtDKH+fXU8A+kTrLrBByvBtPISEaotJKXUCVaxx5uhY+YrXKONiW7H44mhvvyLcsDtO4SMQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171213; 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=QgMG3oczr0mV97lXEhhQfEZalSNKxesoo3/j+ZybeM0=; b=HQQxDHeGFEJnrYIfOKyFS5IVpYDbrgGY6vQR3C2kP6M2owkrctRaV8S0omFyrjxrgcWy/BShuwlLvXv+PHV/f0DL67URxC4g1sKtbh1ngODSZknFvcSC34uv/gGFmIKRavVShqe0Xy1fG5yrljCA/W94vdjX3ZuOUmuoFN11qMs= 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 1576171213908986.8420855475853; Thu, 12 Dec 2019 09:20:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-cVEjqLi2NDaiMQuelb59mg-1; Thu, 12 Dec 2019 12:19:22 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47B6F8005B7; Thu, 12 Dec 2019 17:19:16 +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 1C28C60BF3; Thu, 12 Dec 2019 17:19:16 +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 C6E638373C; Thu, 12 Dec 2019 17:19:15 +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 xBCHIxlT005198 for ; Thu, 12 Dec 2019 12:19:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDF625C241; Thu, 12 Dec 2019 17:18:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7632B5C298 for ; Thu, 12 Dec 2019 17:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171212; 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=QgMG3oczr0mV97lXEhhQfEZalSNKxesoo3/j+ZybeM0=; b=BpufPC4SUkCcvuKI8KUagUvGhTzIjrge00chpho2FMqCRy7v5RfZMMzgAscE93tALSKN+1 XxLHyOiKd9Atc9LTyiimf+2rhhscg2ZDYYSWGb/e5rUDBHUfj+3dkNJpUhR60SC9w66v9M YlNEu/saZPSN+oljcdl/P1fvoDjSBqo= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:37 +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 Subject: [libvirt] [PATCH 07/19] qemu: Check for explicit failure of qemuBlockSnapshotAddBlockdev X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: cVEjqLi2NDaiMQuelb59mg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Check that the value is less than 0. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4d77fd6f6a..41a124d215 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15533,7 +15533,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, if (blockdev) { if (qemuBlockSnapshotAddBlockdev(actions, diskdata[i].disk, - diskdata[i].src)) + diskdata[i].src) < 0) goto cleanup; } else { if (qemuBlockSnapshotAddLegacy(actions, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171157; cv=none; d=zohomail.com; s=zohoarc; b=decdOc6opGVjWvPfXLUemlrohQt58KGWNVF/TlR9W4SwM4SlplLqZinKxfDkXy/dyvbl7pcp2S40Oyf3SrIHyiMo1PZUB7ApRV3/E/k0L6Jj9W6So63chcJGzAOoGNvKdP/caT+kBjgHz3/eG9u4n5hI2TboAmQ2fOau3NHUMfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171157; 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=xU3x0Roxh7RVJREyTUDKUn2D5IMEH8ARj/iQQZ72rWI=; b=Rbshijo6OM1v13Pyal+9LTGPtmubEA05AcSfPbUOJ3gtnihi+me2MePKF+i5Czol4V/MYVueEaiSOXmfJFm78g4wGp5xnfUv02fxZ6e/uSivsID9eaCCRpr46EqimHHj6pTpkEKZqisbyx5gysD2r8vbJHJXzpgNjbAz8bdzZZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1576171157841739.4521421072186; Thu, 12 Dec 2019 09:19:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-252-czhlGi_hOTClnN54f4UAow-1; Thu, 12 Dec 2019 12:19:14 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D10DE1005512; Thu, 12 Dec 2019 17:19:08 +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 A881561F37; Thu, 12 Dec 2019 17:19: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 4CDBE18089D6; Thu, 12 Dec 2019 17:19: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 xBCHJ2ut005274 for ; Thu, 12 Dec 2019 12:19:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3570C5C298; Thu, 12 Dec 2019 17:19:02 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id B16AA5C241 for ; Thu, 12 Dec 2019 17:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171156; 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=xU3x0Roxh7RVJREyTUDKUn2D5IMEH8ARj/iQQZ72rWI=; b=HE6RzrtAUA+y3JTsbVYcEKw0xFnNGuurS/oRpF+NB3avLbBaxVM8d0vNijISymWgQ09Vcn dWa8EXJwBUkUeEHQaPUR7lFWd5rdstRoW+UZaMGj2IB08Z531DmQGd3rX4DVB5eIcFwdBC 8lTqI0pZY4D5Wa+09sXvemfEu9oevIc= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:38 +0100 Message-Id: <384b8d9b41938c588bfdc346635c1f56661be1b5.1576170715.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 Subject: [libvirt] [PATCH 08/19] qemu: snapshot: Fold formatting of snapshot transaction into prepare func X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: czhlGi_hOTClnN54f4UAow-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qemuDomainSnapshotDiskPrepareOne is already called for each disk which is member of the snapshot so we don't need to iterate through the snapshot list again to generate members of the 'transaction' command for each snapshot. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 45 +++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 41a124d215..d2769dab1a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15285,7 +15285,8 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr d= river, virHashTablePtr blockNamedNodeData, bool reuse, bool blockdev, - qemuDomainAsyncJob asyncJob) + qemuDomainAsyncJob asyncJob, + virJSONValuePtr actions) { virDomainDiskDefPtr persistdisk; bool supportsCreate; @@ -15358,10 +15359,17 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr= driver, dd->prepared =3D true; - if (blockdev && - qemuDomainSnapshotDiskPrepareOneBlockdev(driver, vm, dd, cfg, reus= e, - blockNamedNodeData, async= Job) < 0) - return -1; + if (blockdev) { + if (qemuDomainSnapshotDiskPrepareOneBlockdev(driver, vm, dd, cfg, = reuse, + blockNamedNodeData, a= syncJob) < 0) + return -1; + + if (qemuBlockSnapshotAddBlockdev(actions, dd->disk, dd->src) < 0) + return -1; + } else { + if (qemuBlockSnapshotAddLegacy(actions, dd->disk, dd->src, reuse) = < 0) + return -1; + } return 0; } @@ -15383,7 +15391,8 @@ qemuDomainSnapshotDiskPrepare(virQEMUDriverPtr driv= er, virHashTablePtr blockNamedNodeData, qemuDomainAsyncJob asyncJob, qemuDomainSnapshotDiskDataPtr *rdata, - size_t *rndata) + size_t *rndata, + virJSONValuePtr actions) { size_t i; qemuDomainSnapshotDiskDataPtr data; @@ -15403,7 +15412,8 @@ qemuDomainSnapshotDiskPrepare(virQEMUDriverPtr driv= er, data + ndata++, blockNamedNodeData, reuse, blockdev, - asyncJob) < 0) + asyncJob, + actions) < 0) goto cleanup; } @@ -15516,7 +15526,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr= driver, * have to roll back later */ if (qemuDomainSnapshotDiskPrepare(driver, vm, snap, cfg, reuse, blockd= ev, blockNamedNodeData, asyncJob, - &diskdata, &ndiskdata) < 0) + &diskdata, &ndiskdata, actions) < 0) goto cleanup; /* check whether there's anything to do */ @@ -15525,25 +15535,6 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPt= r driver, goto cleanup; } - /* Based on earlier qemuDomainSnapshotPrepare, all disks in this list= are - * now either VIR_DOMAIN_SNAPSHOT_LOCATION_NONE, or - * VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL with a valid file name and - * qcow2 format. */ - for (i =3D 0; i < ndiskdata; i++) { - if (blockdev) { - if (qemuBlockSnapshotAddBlockdev(actions, - diskdata[i].disk, - diskdata[i].src) < 0) - goto cleanup; - } else { - if (qemuBlockSnapshotAddLegacy(actions, - diskdata[i].disk, - diskdata[i].src, - reuse) < 0) - goto cleanup; - } - } - if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto cleanup; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171168; cv=none; d=zohomail.com; s=zohoarc; b=Ryv8tSMmuIBNhF+m6mH8W5Vjod9t2TAo3Sh19GpOHa9UJ+P2HOg+ioNkCFxpenBJRZN14E7m0fJQha2/pl7sDNkW/pDwOlDOggJ1AZM2y8bPRmF9I5hMbI2GpLaZwswOlY+MDpit8HEIMt82tKzVQAr+g/IjpIgs4sZKBnF3xhw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171168; 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=9AIPJEaeKV2sIdmkTxvlLFfT2y8SgVfPPXq9odEfeWU=; b=Yb+aSmJZ6wcyoVHuuVkAaEFZr2EdhaO9HpzeRkQRrW2BUPAGnzVjet+AXHj3QKxpm5DhbxJHzKvPGFUkEnwfPrWbVnLZP1QJy+mh6aZgKYjxwc0uBM/VxU943DdyGC3Bj48IX4uFP4vyrbzEcD4isKDV3omg1xEcvyTcxFSZpYc= 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 1576171168118572.3492387306285; Thu, 12 Dec 2019 09:19:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-37-BRrni58bNNKGX-skoirv_g-1; Thu, 12 Dec 2019 12:19:25 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B3FDEDB94; Thu, 12 Dec 2019 17:19:12 +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 8AE2D60303; Thu, 12 Dec 2019 17:19:12 +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 3664883733; Thu, 12 Dec 2019 17:19: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 xBCHJ4jW005342 for ; Thu, 12 Dec 2019 12:19:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7E5D25C548; Thu, 12 Dec 2019 17:19:04 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 066965C298 for ; Thu, 12 Dec 2019 17:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171166; 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=9AIPJEaeKV2sIdmkTxvlLFfT2y8SgVfPPXq9odEfeWU=; b=SrU/30A5Z9pkEUE+A2kbKzydEpiIH8uV50WNgVnyQ57JxKyIDK1lkAhob8ZH2YGQ8jtNLB LUHrfpzi6NxIcY0r0NbvTlF51IFSgtPOnWb/MEvOVhjSfkXywOgeoNR1SIxvwodAwMbmEH hjs8k+1gopCg1D6pPFQD3PBgVKLARCA= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:39 +0100 Message-Id: <076e4cdd77be1cd338cd0622f7fcf93282532374.1576170715.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 Subject: [libvirt] [PATCH 09/19] qemu: monitor: Add 'granularity' parameter for block-dirty-bitmap-add 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-MC-Unique: BRrni58bNNKGX-skoirv_g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 4 ++-- src/qemu/qemu_checkpoint.c | 2 +- src/qemu/qemu_monitor.c | 6 ++++-- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- 7 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index c9709dc29a..5c9747f09d 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -201,7 +201,7 @@ qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskDa= ta *dd, dd->domdisk->src->nodeformat, dd->incrementalBitmap, false, - true) < 0) + true, 0) < 0) return -1; if (qemuMonitorTransactionBitmapMerge(actions, @@ -214,7 +214,7 @@ qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskDa= ta *dd, dd->store->nodeformat, dd->incrementalBitmap, false, - true) < 0) + true, 0) < 0) return -1; if (qemuMonitorTransactionBitmapMerge(actions, diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 38638c3b1e..97bc97bb8e 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -309,7 +309,7 @@ qemuCheckpointAddActions(virDomainObjPtr vm, if (disk->type !=3D VIR_DOMAIN_CHECKPOINT_TYPE_BITMAP) continue; node =3D qemuDomainDiskNodeFormatLookup(vm, disk->name); - if (qemuMonitorTransactionBitmapAdd(actions, node, disk->bitmap, t= rue, false) < 0) + if (qemuMonitorTransactionBitmapAdd(actions, node, disk->bitmap, t= rue, false, 0) < 0) return -1; /* We only want one active bitmap for a disk along the diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ea3e62dc8e..ccd20b3740 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4543,9 +4543,11 @@ qemuMonitorTransactionBitmapAdd(virJSONValuePtr acti= ons, const char *node, const char *name, bool persistent, - bool disabled) + bool disabled, + unsigned long long granularity) { - return qemuMonitorJSONTransactionBitmapAdd(actions, node, name, persis= tent, disabled); + return qemuMonitorJSONTransactionBitmapAdd(actions, node, name, persis= tent, + disabled, granularity); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 1c990923d6..3f3b81cddd 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1374,7 +1374,8 @@ qemuMonitorTransactionBitmapAdd(virJSONValuePtr actio= ns, const char *node, const char *name, bool persistent, - bool disabled); + bool disabled, + unsigned long long granularity); int qemuMonitorTransactionBitmapRemove(virJSONValuePtr actions, const char *node, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 856c2c2778..4e1bcaa30d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -9159,7 +9159,8 @@ qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr a= ctions, const char *node, const char *name, bool persistent, - bool disabled) + bool disabled, + unsigned long long granularity) { return qemuMonitorJSONTransactionAdd(actions, "block-dirty-bitmap-add", @@ -9167,6 +9168,7 @@ qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr a= ctions, "s:name", name, "b:persistent", persistent, "b:disabled", disabled, + "P:granularity", granularity, NULL); } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 44926464b9..61f5b0061d 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -636,7 +636,8 @@ qemuMonitorJSONTransactionBitmapAdd(virJSONValuePtr act= ions, const char *node, const char *name, bool persistent, - bool disabled); + bool disabled, + unsigned long long granularity); int qemuMonitorJSONTransactionBitmapRemove(virJSONValuePtr actions, const char *node, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 4f3bfad1d7..3b0f85e7c9 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2956,7 +2956,7 @@ testQemuMonitorJSONTransaction(const void *opaque) qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, "no= de2", "bitmap2") < 0) return -1; - if (qemuMonitorTransactionBitmapAdd(actions, "node1", "bitmap1", true,= true) < 0 || + if (qemuMonitorTransactionBitmapAdd(actions, "node1", "bitmap1", true,= true, 1234) < 0 || qemuMonitorTransactionBitmapRemove(actions, "node2", "bitmap2") < = 0 || qemuMonitorTransactionBitmapEnable(actions, "node3", "bitmap3") < = 0 || qemuMonitorTransactionBitmapDisable(actions, "node4", "bitmap4") <= 0 || --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171170; cv=none; d=zohomail.com; s=zohoarc; b=lHtHi+uvv1d9Ed/NDm8YQlSBqAsZiApYhx8RQaJ68WnoTICmNCiTLE35pkaJW5lHLLgXJEigibraxVXmG5A/pgULj4R2YPikvU2tRF6hWLyO3X+XNYg9hCZnRbIIf5Vi4sTtyJ9oeiGN0UIcJO0GgYN/zijWtinSX+drsip/SeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171170; 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=jXiifFm551yqNDN+XMggZ+siZMliUVBc5uphnslO4rI=; b=A5K+GSijpFKmXEDC3OW5Ff0dZPE9cQYamNXpIpfOYfvqNd/10RN51pEH5c2Fcb9vKQbWY9lxgc7NRAJ9qnNHPSlo979GajNr1YLUHMff1xJLJ6pXPYmtG/4n2t2S3k5hXe7qnENOpew1P6/jHvUAjEC/tLIE30rJHBnIQUb9Bqw= 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 1576171170294333.7611204802844; Thu, 12 Dec 2019 09:19:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-MpyI2VoqNZewPcy5fy1-nQ-1; Thu, 12 Dec 2019 12:19:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A554E107ACC7; Thu, 12 Dec 2019 17:19:19 +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 8120946E8A; Thu, 12 Dec 2019 17:19:19 +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 36B748373D; Thu, 12 Dec 2019 17:19: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 xBCHJ6KW005417 for ; Thu, 12 Dec 2019 12:19:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id CE0245C21B; Thu, 12 Dec 2019 17:19:06 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 56CC35C3F8 for ; Thu, 12 Dec 2019 17:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171169; 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=jXiifFm551yqNDN+XMggZ+siZMliUVBc5uphnslO4rI=; b=QeVQz1kDoip6+ESDtbYAOy6dBfJIUBSHdufYed75TrIiDmudddyBfJNjgzLs5V25hm5fEt eDAOFuyPA/e4sAwzLqpnYmuAYwJaEtcH9TcJpD6OqjE0TV9O4ruAZF8tVVXQWibEMJ/Cz7 UZZHHboZrbMRH1IG/FAMOZL/wQynhT8= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:40 +0100 Message-Id: <0a210d38e140b492af8e2ef248809549093208ea.1576170715.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 Subject: [libvirt] [PATCH 10/19] qemu: snapshot: Propagate active bitmaps through external snapshots X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: MpyI2VoqNZewPcy5fy1-nQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Re-create any active persistent bitmap in the snapshot overlay image so that tracking for a checkpoint is persisted. While this basically duplicates data in the allocation map it's currently the only possible way as qemu can't mirror the allocation map into a dirty bitmap if we'd ever want to do a backup. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_driver.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d2769dab1a..8ccd6b7c97 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15223,6 +15223,42 @@ qemuDomainSnapshotDiskCleanup(qemuDomainSnapshotDi= skDataPtr data, } +/** + * qemuDomainSnapshotDiskBitmapsPropagate: + * + * This function propagates any active persistent bitmap present in the or= iginal + * image into the new snapshot. We leave the original bitmap active as in = cases + * when the overlay is discarded (snapshot revert with abandoning the hist= ory) + * everything works as expected. + * */ +static int +qemuDomainSnapshotDiskBitmapsPropagate(qemuDomainSnapshotDiskDataPtr dd, + virJSONValuePtr actions, + virHashTablePtr blockNamedNodeData) +{ + qemuBlockNamedNodeDataPtr entry; + size_t i; + + if (!(entry =3D virHashLookup(blockNamedNodeData, dd->disk->src->nodef= ormat))) + return 0; + + for (i =3D 0; i < entry->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmap =3D entry->bitmaps[i]; + + /* we don't care about temporary, inconsistent, or disabled bitmap= s */ + if (!bitmap->persistent || !bitmap->recording || bitmap->inconsist= ent) + continue; + + if (qemuMonitorTransactionBitmapAdd(actions, dd->src->nodeformat, + bitmap->name, true, false, + bitmap->granularity) < 0) + return -1; + } + + return 0; +} + + static int qemuDomainSnapshotDiskPrepareOneBlockdev(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -15364,6 +15400,9 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr d= river, blockNamedNodeData, a= syncJob) < 0) return -1; + if (qemuDomainSnapshotDiskBitmapsPropagate(dd, actions, blockNamed= NodeData) < 0) + return -1; + if (qemuBlockSnapshotAddBlockdev(actions, dd->disk, dd->src) < 0) return -1; } else { --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171165; cv=none; d=zohomail.com; s=zohoarc; b=G6g3eaxrbVejYMuSCh1lh5VmwBseOBB6WLw2MIj1w5dWuGCwdKvDxeLogsoADcjKX4tokAfw27G1F/QziUISPGjzaRpXYWuuFQOwyKMvlkTnssgrX1pqRkcR4ZDrxifVCWApQCGnTTNFLUm1MY972PFa9QB1CfWp2uzgayQTd1Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171165; 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=NPqqEXigSKHMRD2R92Mn4+ONd5jK0oWt7eQzFGXJn/I=; b=a/PO4PKZBwxFq8oqxJE4UWKrc1bgsQukPIZFovBRq5Qa/OQ909zgMoNJHKChXWU2N7bsxvoux3pa0WFHG6R7aarljW2ZO8rDea/2m9l3EnJLL0l65XEF+EHHoMP0QPja0Z6WJhZUYQCmNj+jaRaw2lqUXHKIu/R3tkmvxUSVXlA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1576171165242760.5900680339748; Thu, 12 Dec 2019 09:19:25 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-70-9XY-uskFOuGTWHx2-8ZnDA-1; Thu, 12 Dec 2019 12:19:22 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 93257107AD30; Thu, 12 Dec 2019 17:19:16 +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 6D92846E8A; Thu, 12 Dec 2019 17:19:16 +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 2139218089D6; Thu, 12 Dec 2019 17:19:16 +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 xBCHJA5F005509 for ; Thu, 12 Dec 2019 12:19:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33E265C298; Thu, 12 Dec 2019 17:19:10 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61BA75C21B for ; Thu, 12 Dec 2019 17:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171163; 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=NPqqEXigSKHMRD2R92Mn4+ONd5jK0oWt7eQzFGXJn/I=; b=i6jXJDIWnEwt3ozmE02dRnFohSh0I0x/Hs5EkaRzTewUUddLXHlB6a1ef3tlEg/56i6S+R ScMdfpUjad61MsskIJR8acaXQ1OmWGxoy/ns/rkgpe6v6yYxG4ejvdv+zJ3c7Px5TdXwfv bwNJWCwbeEKYdIrpEz5bXIQqfHcWbaY= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:41 +0100 Message-Id: <087c2d333ca1d38ac6253ea09c96833c8453bf3e.1576170715.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 Subject: [libvirt] [PATCH 11/19] tests: qemublock: Add test case for detecting bitmaps as we create snapshots X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 9XY-uskFOuGTWHx2-8ZnDA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add test data gathered from a run of qemu after creating bitmaps and snapshots together in various combinations. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 1 + tests/qemublocktestdata/bitmap/snapshots.json | 836 ++++++++++++++++++ tests/qemublocktestdata/bitmap/snapshots.out | 14 + 3 files changed, 851 insertions(+) create mode 100644 tests/qemublocktestdata/bitmap/snapshots.json create mode 100644 tests/qemublocktestdata/bitmap/snapshots.out diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index e3aee03c81..25afef46bb 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -777,6 +777,7 @@ mymain(void) TEST_BITMAP_DETECT("basic"); TEST_BITMAP_DETECT("synthetic"); + TEST_BITMAP_DETECT("snapshots"); cleanup: virHashFree(diskxmljsondata.schema); diff --git a/tests/qemublocktestdata/bitmap/snapshots.json b/tests/qemubloc= ktestdata/bitmap/snapshots.json new file mode 100644 index 0000000000..87e77ad408 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots.json @@ -0,0 +1,836 @@ +[ + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911540", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "d", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "c", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911527", + "backing-filename": "/tmp/pull4.1575911527", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911550", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "in-use", + "auto" + ], + "name": "current", + "granularity": 65536 + }, + { + "flags": [ + "in-use" + ], + "name": "d", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911540", + "backing-filename": "/tmp/pull4.1575911540", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-format", + "backing_file_depth": 4, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911540", + "dirty-bitmaps": [ + { + "name": "d", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "current", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911550", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 393728, + "filename": "/tmp/pull4.1575911550", + "format": "file", + "actual-size": 212992, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-1-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911550", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911540", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 212992, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "d", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "c", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911527", + "backing-filename": "/tmp/pull4.1575911527", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-2-format", + "backing_file_depth": 3, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911527", + "dirty-bitmaps": [ + { + "name": "c", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "d", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911540", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 393728, + "filename": "/tmp/pull4.1575911540", + "format": "file", + "actual-size": 212992, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-2-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911540", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911527", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 217088, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "c", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "b", + "granularity": 65536 + }, + { + "flags": [ + + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.1575911522", + "backing-filename": "/tmp/pull4.1575911522", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-3-format", + "backing_file_depth": 2, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.1575911522", + "dirty-bitmaps": [ + { + "name": "a", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "b", + "recording": false, + "persistent": true, + "busy": false, + "status": "disabled", + "granularity": 65536, + "count": 0 + }, + { + "name": "c", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911527", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 459264, + "filename": "/tmp/pull4.1575911527", + "format": "file", + "actual-size": 217088, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-3-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911527", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "backing-image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "backing-filename-format": "qcow2", + "virtual-size": 10485760, + "filename": "/tmp/pull4.1575911522", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "full-backing-filename": "/tmp/pull4.qcow2", + "backing-filename": "/tmp/pull4.qcow2", + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-4-format", + "backing_file_depth": 1, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "backing_file": "/tmp/pull4.qcow2", + "dirty-bitmaps": [ + { + "name": "a", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911522", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 328192, + "filename": "/tmp/pull4.1575911522", + "format": "file", + "actual-size": 208896, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-4-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.1575911522", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 10485760, + "filename": "/tmp/pull4.qcow2", + "cluster-size": 65536, + "format": "qcow2", + "actual-size": 208896, + "format-specific": { + "type": "qcow2", + "data": { + "compat": "1.1", + "lazy-refcounts": false, + "bitmaps": [ + { + "flags": [ + "auto" + ], + "name": "a", + "granularity": 65536 + } + ], + "refcount-bits": 16, + "corrupt": false + } + }, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": true, + "node-name": "libvirt-5-format", + "backing_file_depth": 0, + "drv": "qcow2", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "dirty-bitmaps": [ + { + "name": "a", + "recording": true, + "persistent": true, + "busy": false, + "status": "active", + "granularity": 65536, + "count": 0 + } + ], + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + }, + { + "iops_rd": 0, + "detect_zeroes": "off", + "image": { + "virtual-size": 328192, + "filename": "/tmp/pull4.qcow2", + "format": "file", + "actual-size": 208896, + "dirty-flag": false + }, + "iops_wr": 0, + "ro": false, + "node-name": "libvirt-5-storage", + "backing_file_depth": 0, + "drv": "file", + "iops": 0, + "bps_wr": 0, + "write_threshold": 0, + "encrypted": false, + "bps": 0, + "bps_rd": 0, + "cache": { + "no-flush": false, + "direct": false, + "writeback": true + }, + "file": "/tmp/pull4.qcow2", + "encryption_key_missing": false + } +] diff --git a/tests/qemublocktestdata/bitmap/snapshots.out b/tests/qemublock= testdata/bitmap/snapshots.out new file mode 100644 index 0000000000..9e0bb36fc8 --- /dev/null +++ b/tests/qemublocktestdata/bitmap/snapshots.out @@ -0,0 +1,14 @@ +libvirt-1-format: + d: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + current: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 +libvirt-2-format: + c: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + d: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 +libvirt-3-format: + a: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + b: recod:0 busy:0 persist:1 inconist:0 gran:65536 dirty:0 + c: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 +libvirt-4-format: + a: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 +libvirt-5-format: + a: recod:1 busy:0 persist:1 inconist:0 gran:65536 dirty:0 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171173; cv=none; d=zohomail.com; s=zohoarc; b=MOMsh728xzZYS28P+DYqi5XaAV+vFuRCEMUA3SuJDtOyMprk7oVceqrgJ/qhwmOtC6o4PiTcHjZH3stz1WuhqrLK+kZ10IJeAdA8/2IQXhMpxGYgnMz6OaE9NTJ5CN98SbWeBuBULgTY15DKl4tlsc+qNUzVyZhr9d1HMq3ne/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171173; 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=7dL7pC+O1FPdzu9YYaw67sdLivfvSCQPiYBoF1RFV1U=; b=XKJwB03A/OIpgAktbcXV0B6o40TW9SbNRMb/yMqY4Lx6M0S9NNCjftXm38eCDv95WvPA4SsW6CtvArQYM27dY9/0J+hAXbN1+/FR9/aMi45acEht1dENZFnlrwR3As95JpBEWjsEwAyadrRJ95YrMwigzXA2trnCfZi/fGrPXXM= 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 1576171173423740.5316954145064; Thu, 12 Dec 2019 09:19:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-y3SkT6htMoqmwPiMNJ8iKg-1; Thu, 12 Dec 2019 12:19:30 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94620100550E; Thu, 12 Dec 2019 17:19: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 6B46E60303; Thu, 12 Dec 2019 17:19: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 1E4A1180BACE; Thu, 12 Dec 2019 17:19: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 xBCHJBli005531 for ; Thu, 12 Dec 2019 12:19:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0364B5C298; Thu, 12 Dec 2019 17:19:11 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F89D5C21B for ; Thu, 12 Dec 2019 17:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171172; 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=7dL7pC+O1FPdzu9YYaw67sdLivfvSCQPiYBoF1RFV1U=; b=W85P5mRruNLiwS3DcO3fyNCx8/p2PfeFmsfS9rxKX6TzcmQ53pGbf2phEH6Y+GP6IDORZ2 Gpwy/+/34n9oDUu9owupH5LHR3hNDwJfToFBXnH0qivMyacAmD8OzsyX2747dazDprJixe Eja9Mwov8LIjqeOjoPHN8fu1dSb2yu8= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:42 +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 Subject: [libvirt] [PATCH 12/19] qemu: backup: Return 'def' instead of 'obj' from qemuBackupBeginCollectIncrementalCheckpoints 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-MC-Unique: y3SkT6htMoqmwPiMNJ8iKg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The object itself has no extra value and it would make testing the code harder. Refactor it to remove just the definition pointer. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 5c9747f09d..1cd466d211 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -174,7 +174,7 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, static int qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, virJSONValuePtr actions, - virDomainMomentObjPtr *incremental) + virDomainMomentDefPtr *incremental) { g_autoptr(virJSONValue) mergebitmaps =3D NULL; g_autoptr(virJSONValue) mergebitmapsstore =3D NULL; @@ -188,7 +188,7 @@ qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskDa= ta *dd, while (*incremental) { if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, dd->domdisk->= src->nodeformat, - (*incremental= )->def->name) < 0) + (*incremental= )->name) < 0) return -1; incremental++; @@ -232,7 +232,7 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, virDomainBackupDiskDefPtr backupdisk, struct qemuBackupDiskData *dd, virJSONValuePtr actions, - virDomainMomentObjPtr *incremental, + virDomainMomentDefPtr *incremental, virQEMUDriverConfigPtr cfg, bool removeStore) { @@ -323,7 +323,7 @@ qemuBackupDiskPrepareDataOnePull(virJSONValuePtr action= s, static ssize_t qemuBackupDiskPrepareData(virDomainObjPtr vm, virDomainBackupDefPtr def, - virDomainMomentObjPtr *incremental, + virDomainMomentDefPtr *incremental, virJSONValuePtr actions, virQEMUDriverConfigPtr cfg, struct qemuBackupDiskData **rdd, @@ -505,24 +505,27 @@ qemuBackupBeginPullExportDisks(virDomainObjPtr vm, * @vm: domain object * @incrFrom: name of checkpoint representing starting point of incrementa= l backup * - * Returns a NULL terminated list of pointers to checkpoints in chronologi= cal - * order starting from the 'current' checkpoint until reaching @incrFrom. + * Returns a NULL terminated list of pointers to checkpoint definitions in + * chronological order starting from the 'current' checkpoint until reachi= ng + * @incrFrom. */ -static virDomainMomentObjPtr * +static virDomainMomentDefPtr * qemuBackupBeginCollectIncrementalCheckpoints(virDomainObjPtr vm, const char *incrFrom) { virDomainMomentObjPtr n =3D virDomainCheckpointGetCurrent(vm->checkpoi= nts); - g_autofree virDomainMomentObjPtr *incr =3D NULL; + g_autofree virDomainMomentDefPtr *incr =3D NULL; size_t nincr =3D 0; while (n) { - if (VIR_APPEND_ELEMENT_COPY(incr, nincr, n) < 0) + virDomainMomentDefPtr def =3D n->def; + + if (VIR_APPEND_ELEMENT_COPY(incr, nincr, def) < 0) return NULL; - if (STREQ(n->def->name, incrFrom)) { - virDomainMomentObjPtr terminator =3D NULL; - if (VIR_APPEND_ELEMENT_COPY(incr, nincr, terminator) < 0) + if (STREQ(def->name, incrFrom)) { + def =3D NULL; + if (VIR_APPEND_ELEMENT_COPY(incr, nincr, def) < 0) return NULL; return g_steal_pointer(&incr); @@ -648,7 +651,7 @@ qemuBackupBegin(virDomainObjPtr vm, bool pull =3D false; virDomainMomentObjPtr chk =3D NULL; g_autoptr(virDomainCheckpointDef) chkdef =3D NULL; - g_autofree virDomainMomentObjPtr *incremental =3D NULL; + g_autofree virDomainMomentDefPtr *incremental =3D NULL; g_autoptr(virJSONValue) actions =3D NULL; struct qemuBackupDiskData *dd =3D NULL; ssize_t ndd =3D 0; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171264; cv=none; d=zohomail.com; s=zohoarc; b=FTYfFzi2deNBesKA34MYLxMSg2yPzvkZ0PL/tCGqYVU1npOm2M/Q4tA1I/l5NWWTurJRBCizNKecHCfkaWwMoxpDNx6ugeJvGEEXe6XLarA9KHTx+AYiuutuJ3gd0FAHxaEw4ahXgZWpj1T+uJKuHn+58hPAULMB4k7slcD5JuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171264; 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=z3f8B/MiwhzSYihyAgdIW+7QVMuORcC43zIRUUeCWBY=; b=OzuKhviMXUOZOQydSH/U0LUAA9ypYd6WdS7tfKY5C+bmILXSPW8805pSI2aMkiUQASUkhTHRjoVHJ5oM8Ww2aLAWR+MtpcwXUNHjKPmRR1NCUfj6a4OBVzmphuNqIYbYY8Au7BwHLGa7mNVjXRDM0Zfk08x9305tqB0N+tHgzMs= 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 1576171264792496.17225823701585; Thu, 12 Dec 2019 09:21:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-71-5585NG8aNCeGylJ2GYlCJg-1; Thu, 12 Dec 2019 12:19:30 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2988107ACFA; Thu, 12 Dec 2019 17:19:21 +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 78ADF10016DA; Thu, 12 Dec 2019 17:19:21 +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 2F3CB62CF5; Thu, 12 Dec 2019 17:19: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 xBCHJB39005562 for ; Thu, 12 Dec 2019 12:19:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id D9F8D5C1C3; Thu, 12 Dec 2019 17:19:11 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6080666839 for ; Thu, 12 Dec 2019 17:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171263; 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=z3f8B/MiwhzSYihyAgdIW+7QVMuORcC43zIRUUeCWBY=; b=CSOBxvtYUEOFRIEk6ohGKZTxXDNoBhtLmVO/oNR4D38ep4ecwzx7BS9BKXVhmkRrnQQBQS tGfRzpttK4l/NZcB5eMwpBMkx3wwpbCdjxRhnOaiHhMiCTMVnh1G1tsxNdtr+ESLPpiuGR 6uejcfQCfoKk4dthEZcPNfXDx6avCak= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:43 +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 Subject: [libvirt] [PATCH 13/19] qemu: backup: Extract calculations of bitmaps to merge for incremental backup 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-MC-Unique: 5585NG8aNCeGylJ2GYlCJg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Separate the for now incomplete code that collects the bitmaps to be merged for an incremental backup into a separate function. This will allow to add testing prior to the improvement of the algorithm to include snapshots. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 1cd466d211..31949b5399 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -170,30 +170,43 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, } - -static int -qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, - virJSONValuePtr actions, - virDomainMomentDefPtr *incremental) +static virJSONValuePtr +qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental, + virStorageSourcePtr backingChain) { - g_autoptr(virJSONValue) mergebitmaps =3D NULL; - g_autoptr(virJSONValue) mergebitmapsstore =3D NULL; + g_autoptr(virJSONValue) ret =3D NULL; - if (!(mergebitmaps =3D virJSONValueNewArray())) - return -1; + if (!(ret =3D virJSONValueNewArray())) + return NULL; /* TODO: this code works only if the bitmaps are present on a single n= ode. * The algorithm needs to be changed so that it looks into the backing= chain * so that we can combine all relevant bitmaps for a given backing cha= in */ while (*incremental) { - if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(mergebitmaps, - dd->domdisk->= src->nodeformat, + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(ret, + backingChain-= >nodeformat, (*incremental= )->name) < 0) - return -1; + return NULL; incremental++; } + return g_steal_pointer(&ret); +} + + +static int +qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, + virJSONValuePtr actions, + virDomainMomentDefPtr *incremental) +{ + g_autoptr(virJSONValue) mergebitmaps =3D NULL; + g_autoptr(virJSONValue) mergebitmapsstore =3D NULL; + + if (!(mergebitmaps =3D qemuBackupDiskPrepareOneBitmapsChain(incrementa= l, + dd->domdisk-= >src))) + return -1; + if (!(mergebitmapsstore =3D virJSONValueCopy(mergebitmaps))) return -1; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171204; cv=none; d=zohomail.com; s=zohoarc; b=DbZ000rANN8G/DcFNkUdKnPQI6RYZ7kgYOYjFNYfbG25JMBNkspd4AIAe0VuftYIBms9wdtZ2V+Jy9+vUM5RF1hcmB7yvLFVtfh2Tv6Xvt0xRqMMfirAlD8h+CA3nQs6K5Lf1j1iPjGeERpPd8CR8sPrt/5EX+HVXuXu9A/08HU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171204; 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=kQUTfeh96eHdXOJr4ZalP2gFRd7oasrOvZ/g/QfyfkI=; b=BdPrWpETU61RDFQuBBQlEvkQ8K7YTJ2ZqVOqva+c8TpRTU+HkgvmWGtwjMh3Qq1kS9u/0DXftkyk1kakKEaX/1EzIFwh3iRU2L+NDMYMJTrHn4r+4DXq7CcHIUcnNE7OkvYLqu0WY8MrmtNH7VFfZ3Ejh/D8QjqDy6j1Bmb/zFE= 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 1576171204324547.8620591339392; Thu, 12 Dec 2019 09:20:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-0cF3Hi5mNJaL4SxTH4OFOA-1; Thu, 12 Dec 2019 12:19:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8BCB01854322; Thu, 12 Dec 2019 17:19:25 +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 632F860BB4; Thu, 12 Dec 2019 17:19:25 +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 22F131803C32; Thu, 12 Dec 2019 17:19:25 +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 xBCHJEdb005621 for ; Thu, 12 Dec 2019 12:19:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 273425C298; Thu, 12 Dec 2019 17:19:14 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A40F65C21B for ; Thu, 12 Dec 2019 17:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171202; 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=kQUTfeh96eHdXOJr4ZalP2gFRd7oasrOvZ/g/QfyfkI=; b=dT4LSaGiaSixaSXo3zOhwQ8MGFKBQftDw3lHp1kttMCjFbNjk/ZZf+4z+93+xY5HFAXsQC 3ylLbYdcDsX7+fzBbnFUBoHV65JqxSRG90715GwN+WdJBnFspjteMGy5rjbsD/iOWqK75V ArnWAL+c10ASszqqrFr6Waf1Wb1lCfM= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:44 +0100 Message-Id: <45699d06becdb82007c12984ecc6786e9fcd5afe.1576170715.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 Subject: [libvirt] [PATCH 14/19] qemu: backup: Propagate bitmap metadata into qemuBackupDiskPrepareOneBitmapsChain 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-MC-Unique: 0cF3Hi5mNJaL4SxTH4OFOA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The function will require the bitmap topology for the full implementation. To facilitate testing, add the propagation of the necessary data beforehand so that the test code can stay unchanged during the changes.t Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 31949b5399..fac6592366 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -172,7 +172,9 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, static virJSONValuePtr qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental, - virStorageSourcePtr backingChain) + virStorageSourcePtr backingChain, + virHashTablePtr blockNamedNodeData G_= GNUC_UNUSED, + const char *diskdst G_GNUC_UNUSED) { g_autoptr(virJSONValue) ret =3D NULL; @@ -198,13 +200,16 @@ qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentD= efPtr *incremental, static int qemuBackupDiskPrepareOneBitmaps(struct qemuBackupDiskData *dd, virJSONValuePtr actions, - virDomainMomentDefPtr *incremental) + virDomainMomentDefPtr *incremental, + virHashTablePtr blockNamedNodeData) { g_autoptr(virJSONValue) mergebitmaps =3D NULL; g_autoptr(virJSONValue) mergebitmapsstore =3D NULL; if (!(mergebitmaps =3D qemuBackupDiskPrepareOneBitmapsChain(incrementa= l, - dd->domdisk-= >src))) + dd->domdisk-= >src, + blockNamedNo= deData, + dd->domdisk-= >dst))) return -1; if (!(mergebitmapsstore =3D virJSONValueCopy(mergebitmaps))) @@ -246,6 +251,7 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, struct qemuBackupDiskData *dd, virJSONValuePtr actions, virDomainMomentDefPtr *incremental, + virHashTablePtr blockNamedNodeData, virQEMUDriverConfigPtr cfg, bool removeStore) { @@ -274,7 +280,8 @@ qemuBackupDiskPrepareDataOne(virDomainObjPtr vm, if (incremental) { dd->incrementalBitmap =3D g_strdup_printf("backup-%s", dd->domdisk= ->dst); - if (qemuBackupDiskPrepareOneBitmaps(dd, actions, incremental) < 0) + if (qemuBackupDiskPrepareOneBitmaps(dd, actions, incremental, + blockNamedNodeData) < 0) return -1; } @@ -337,6 +344,7 @@ static ssize_t qemuBackupDiskPrepareData(virDomainObjPtr vm, virDomainBackupDefPtr def, virDomainMomentDefPtr *incremental, + virHashTablePtr blockNamedNodeData, virJSONValuePtr actions, virQEMUDriverConfigPtr cfg, struct qemuBackupDiskData **rdd, @@ -359,7 +367,8 @@ qemuBackupDiskPrepareData(virDomainObjPtr vm, ndisks++; if (qemuBackupDiskPrepareDataOne(vm, backupdisk, dd, actions, - incremental, cfg, removeStore) < = 0) + incremental, blockNamedNodeData, + cfg, removeStore) < 0) goto error; if (def->type =3D=3D VIR_DOMAIN_BACKUP_TYPE_PULL) { @@ -745,8 +754,14 @@ qemuBackupBegin(virDomainObjPtr vm, goto endjob; } - if ((ndd =3D qemuBackupDiskPrepareData(vm, def, incremental, actions, = cfg, &dd, - reuse)) <=3D 0) { + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BA= CKUP) < 0) + goto endjob; + blockNamedNodeData =3D qemuMonitorBlockGetNamedNodeData(priv->mon); + if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeD= ata) + goto endjob; + + if ((ndd =3D qemuBackupDiskPrepareData(vm, def, incremental, blockName= dNodeData, + actions, cfg, &dd, reuse)) <=3D 0= ) { if (ndd =3D=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("no disks selected for backup")); @@ -755,12 +770,6 @@ qemuBackupBegin(virDomainObjPtr vm, goto endjob; } - if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, QEMU_ASYNC_JOB_BA= CKUP) < 0) - goto endjob; - blockNamedNodeData =3D qemuMonitorBlockGetNamedNodeData(priv->mon); - if (qemuDomainObjExitMonitor(priv->driver, vm) < 0 || !blockNamedNodeD= ata) - goto endjob; - if (qemuBackupDiskPrepareStorage(vm, dd, ndd, blockNamedNodeData, reus= e) < 0) goto endjob; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171227; cv=none; d=zohomail.com; s=zohoarc; b=e9cgLasArjazAuZAZb7MHi//i8oROPWtzAyhYJM6zclNUNESqRiYPz/xw/lYohoZtUGM28GVYHrPkyW0vFbsYYXsYcpG44BBLtz1tU1gXOzi3pkbsBxEQ+txvqjBQmmRA+quo0LTKLKxgcXWP45SGoMu3X5Frq5LS4EGcScZzWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171227; 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=nFCpmEDNYFLBdwz2T5K7NMem+oiJLFczQ5ge7R/FipQ=; b=ECfIWol6iWqM9bviDtafJTyNv0ilpBH/GkO3GbU47cu5Jni1qsuFJbhW94kr8cujbSUwzMPb49/QrUBpVLHttsuwxeTLxBUwfKaqmm8ZiJ07pV2ZKUPYpHBSIdCpkKWmqoBEV/7ajWISSff5RWu2n1TkttgUc0WehwRLzUG0EJ0= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576171227465945.3884801734192; Thu, 12 Dec 2019 09:20:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-326-a-awh_hPN5qHEGwU6mgQ3g-1; Thu, 12 Dec 2019 12:19:35 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 618D1800C7F; Thu, 12 Dec 2019 17:19:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34EC010013A1; Thu, 12 Dec 2019 17:19:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D9C91ADA7C; Thu, 12 Dec 2019 17:19:28 +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 xBCHJG52005692 for ; Thu, 12 Dec 2019 12:19:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6724C5C21B; Thu, 12 Dec 2019 17:19:16 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38665C298 for ; Thu, 12 Dec 2019 17:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171226; 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=nFCpmEDNYFLBdwz2T5K7NMem+oiJLFczQ5ge7R/FipQ=; b=dvrEiaewRzkfhR7l7GKJn/dy6UZq25BYSj66TcacvF3tIPO2xV44qx58Ivf5bgsJwOcQ44 15lQBL/YE+gBQvUomLoLPBtuioSzQS0GPrHDmNcdr0AxKECilHCYVzkzidMfNBngqkpcFN WPz3s4gxf0SYgLQyVG6s+oMuHwsaQ0Q= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:45 +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 Subject: [libvirt] [PATCH 15/19] qemu: backup: Export qemuBackupDiskPrepareOneBitmapsChain for tests 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-MC-Unique: a-awh_hPN5qHEGwU6mgQ3g-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 2 +- src/qemu/qemu_backup.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index fac6592366..14cf6bbef0 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -170,7 +170,7 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, } -static virJSONValuePtr +virJSONValuePtr qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental, virStorageSourcePtr backingChain, virHashTablePtr blockNamedNodeData G_= GNUC_UNUSED, diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index 0f76abe067..df67b849be 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -44,3 +44,10 @@ int qemuBackupGetJobInfoStats(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainJobInfoPtr jobInfo); + +/* exported for testing */ +virJSONValuePtr +qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental, + virStorageSourcePtr backingChain, + virHashTablePtr blockNamedNodeData, + const char *diskdst); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171181; cv=none; d=zohomail.com; s=zohoarc; b=VHeWJs3pA3IjJJm8x2Pp3fzr+OilZzpcQwfumue4WkzsqtT+X4ClE/89WPFOCNb0S89BsUc3pZXzr0vEuMVep1SMWrR+cTiK5+6hw3GqYkklbXcGFUHvuxDrVlWvnmPZWhMPKis2c9kobvIf7Q14gkRXroQgCOGF7okO34PqQqM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171181; 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=rSEjyrY8zdkhWB5iArrSQCS49O60KI9hchp+Z3tkfoA=; b=K65ftIPQHIH3yzY+IDMEiB0TdPbsGBosFYTvYPePVKom3jB39a7eMudlxc6uR83lI9nznFTQwVigC4ORPRMhxmtoG0X4vq66H5Wadrykuk30mlp9GGZHMUFe9ctdY2D3f9Mp0o1WPbmqWIPp7l0DTDYhqiaZdajCyLeRSNOFzh4= 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 1576171181948642.292098517194; Thu, 12 Dec 2019 09:19:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-67-sGX-JShOMv6LVWpVQ7E9MQ-1; Thu, 12 Dec 2019 12:19:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 719181007274; Thu, 12 Dec 2019 17:19: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 4116061341; Thu, 12 Dec 2019 17:19: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 DF31A1803C41; Thu, 12 Dec 2019 17:19: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 xBCHJIDq005755 for ; Thu, 12 Dec 2019 12:19:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id A013B5C298; Thu, 12 Dec 2019 17:19:18 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 282255C21B for ; Thu, 12 Dec 2019 17:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171180; 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=rSEjyrY8zdkhWB5iArrSQCS49O60KI9hchp+Z3tkfoA=; b=DVpzBDYJJf16sglpXSvswxcZbmOw9G9zYDdZmAHknSf0Kspy8MZlfsSLi+1gHXV9zKV9mw IrnmClhi7MwIEi3zsHP0Yf+qJtTqFMzRIqAfpqFLrzMfXMWwvtTh8kKfvpSEg0P0dQeipn xmENQwYhHaEaG7fuWVQ5pgRIXF9I1Rw= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:46 +0100 Message-Id: <2002649e724f3b5417186aaa933bed55a261fa4c.1576170715.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 Subject: [libvirt] [PATCH 16/19] tests: qemublock: Add testing of bitmap merging for incremental backups 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-MC-Unique: sGX-JShOMv6LVWpVQ7E9MQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add test code which will crawl a fake internal list of checkpoints and generate the list of bitmaps for merging to gather the final bitmap for the backup. The initial tests cover the basic case of all bitmaps being present in the top layer of the backing chain. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 160 ++++++++++++++++++ .../backupmerge/basic-deep-out.json | 22 +++ .../backupmerge/basic-flat-out.json | 6 + .../backupmerge/basic-intermediate-out.json | 10 ++ 4 files changed, 198 insertions(+) create mode 100644 tests/qemublocktestdata/backupmerge/basic-deep-out.json create mode 100644 tests/qemublocktestdata/backupmerge/basic-flat-out.json create mode 100644 tests/qemublocktestdata/backupmerge/basic-intermediate-= out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 25afef46bb..659ce327dc 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -28,6 +28,7 @@ # include "qemu/qemu_block.h" # include "qemu/qemu_qapi.h" # include "qemu/qemu_monitor_json.h" +# include "qemu/qemu_backup.h" # include "qemu/qemu_command.h" @@ -558,6 +559,145 @@ testQemuDetectBitmaps(const void *opaque) } +static virStorageSourcePtr +testQemuBackupIncrementalBitmapCalculateGetFakeImage(size_t idx) +{ + virStorageSourcePtr ret; + + if (!(ret =3D virStorageSourceNew())) + abort(); + + ret->type =3D VIR_STORAGE_TYPE_FILE; + ret->format =3D VIR_STORAGE_FILE_QCOW2; + ret->path =3D g_strdup_printf("/image%zu", idx); + ret->nodestorage =3D g_strdup_printf("libvirt-%zu-storage", idx); + ret->nodeformat =3D g_strdup_printf("libvirt-%zu-format", idx); + + return ret; +} + + +static virStorageSourcePtr +testQemuBackupIncrementalBitmapCalculateGetFakeChain(void) +{ + virStorageSourcePtr ret; + virStorageSourcePtr n; + size_t i; + + n =3D ret =3D testQemuBackupIncrementalBitmapCalculateGetFakeImage(1); + + for (i =3D 2; i < 10; i++) { + n->backingStore =3D testQemuBackupIncrementalBitmapCalculateGetFak= eImage(i); + n =3D n->backingStore; + } + + return ret; +} + + +typedef virDomainMomentDefPtr testMomentList; + +static void +testMomentListFree(testMomentList *list) +{ + testMomentList *tmp =3D list; + + if (!list) + return; + + while (*tmp) { + virObjectUnref(*tmp); + tmp++; + } + + g_free(list); +} + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(testMomentList, testMomentListFree); + +static virDomainMomentDefPtr +testQemuBackupGetIncrementalMoment(const char *name) +{ + virDomainCheckpointDefPtr checkpoint =3D NULL; + + if (!(checkpoint =3D virDomainCheckpointDefNew())) + abort(); + + checkpoint->parent.name =3D g_strdup(name); + + return (virDomainMomentDefPtr) checkpoint; +} + + +static virDomainMomentDefPtr * +testQemuBackupGetIncremental(const char *incFrom) +{ + const char *checkpoints[] =3D {"current", "d", "c", "b", "a"}; + virDomainMomentDefPtr *incr; + size_t i; + + incr =3D g_new0(virDomainMomentDefPtr, G_N_ELEMENTS(checkpoints) + 1); + + for (i =3D 0; i < G_N_ELEMENTS(checkpoints); i++) { + incr[i] =3D testQemuBackupGetIncrementalMoment(checkpoints[i]); + + if (STREQ(incFrom, checkpoints[i])) + break; + } + + return incr; +} + +static const char *backupDataPrefix =3D "qemublocktestdata/backupmerge/"; + +struct testQemuBackupIncrementalBitmapCalculateData { + const char *name; + virStorageSourcePtr chain; + const char *incremental; + const char *nodedatafile; +}; + + +static int +testQemuBackupIncrementalBitmapCalculate(const void *opaque) +{ + const struct testQemuBackupIncrementalBitmapCalculateData *data =3D op= aque; + g_autoptr(virJSONValue) nodedatajson =3D NULL; + g_autoptr(virHashTable) nodedata =3D NULL; + g_autoptr(virJSONValue) mergebitmaps =3D NULL; + g_autofree char *actual =3D NULL; + g_autofree char *expectpath =3D NULL; + g_autoptr(testMomentList) incremental =3D NULL; + + expectpath =3D g_strdup_printf("%s/%s%s-out.json", abs_srcdir, + backupDataPrefix, 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; + } + + incremental =3D testQemuBackupGetIncremental(data->incremental); + + if (!(mergebitmaps =3D qemuBackupDiskPrepareOneBitmapsChain(incrementa= l, + data->chain, + nodedata, + "testdisk"))= ) { + VIR_TEST_VERBOSE("failed to calculate merged bitmaps"); + return -1; + } + + if (!(actual =3D virJSONValueToString(mergebitmaps, true))) + return -1; + + return virTestCompareToFile(actual, expectpath); +} + + static int mymain(void) { @@ -566,12 +706,16 @@ mymain(void) struct testBackingXMLjsonXMLdata xmljsonxmldata; struct testQemuDiskXMLToJSONData diskxmljsondata; struct testQemuImageCreateData imagecreatedata; + struct testQemuBackupIncrementalBitmapCalculateData backupbitmapcalcda= ta; char *capslatest_x86_64 =3D NULL; virQEMUCapsPtr caps_x86_64 =3D NULL; + g_autoptr(virStorageSource) bitmapSourceChain =3D NULL; if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; + bitmapSourceChain =3D testQemuBackupIncrementalBitmapCalculateGetFakeC= hain(); + diskxmljsondata.driver =3D &driver; imagecreatedata.driver =3D &driver; @@ -779,6 +923,22 @@ mymain(void) TEST_BITMAP_DETECT("synthetic"); TEST_BITMAP_DETECT("snapshots"); +# define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named)= \ + do { \ + backupbitmapcalcdata.name =3D testname; \ + backupbitmapcalcdata.chain =3D source; \ + backupbitmapcalcdata.incremental =3D incrbackup; \ + backupbitmapcalcdata.nodedatafile =3D named; \ + if (virTestRun("incremental backup bitmap " testname, \ + testQemuBackupIncrementalBitmapCalculate, \ + &backupbitmapcalcdata) < 0) \ + ret =3D -1; \ + } while (0) + + TEST_BACKUP_BITMAP_CALCULATE("basic-flat", bitmapSourceChain, "current= ", "basic"); + TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, = "d", "basic"); + TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "ba= sic"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/backupmerge/basic-deep-out.json b/test= s/qemublocktestdata/backupmerge/basic-deep-out.json new file mode 100644 index 0000000000..28c3d16259 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/basic-deep-out.json @@ -0,0 +1,22 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + }, + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-1-format", + "name": "c" + }, + { + "node": "libvirt-1-format", + "name": "b" + }, + { + "node": "libvirt-1-format", + "name": "a" + } +] diff --git a/tests/qemublocktestdata/backupmerge/basic-flat-out.json b/test= s/qemublocktestdata/backupmerge/basic-flat-out.json new file mode 100644 index 0000000000..b89252e284 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/basic-flat-out.json @@ -0,0 +1,6 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + } +] diff --git a/tests/qemublocktestdata/backupmerge/basic-intermediate-out.jso= n b/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json new file mode 100644 index 0000000000..0dffcafd5f --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/basic-intermediate-out.json @@ -0,0 +1,10 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + }, + { + "node": "libvirt-1-format", + "name": "d" + } +] --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171172; cv=none; d=zohomail.com; s=zohoarc; b=a8ju5Y5vpJzd6SSQHqwU4AMVOLa7vtxnWJ43KZ2+Blo42lqcyETiHJLll9vfP95rzy7ouEEgzy7p1+um2+hxZkggrBxh5G9HNhdvgiSPMMZ/l36NNFOWxXystTjV5n/nfcoq5890CsdkHril0uAzhGTOCo3XVl/R3QK32mgVJJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171172; 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=zmx/r5QP3gv0MIIWg2fpoGWQ+eX9yDksTCKNiZAwp1o=; b=kV1aJfsCiT4+c0l6mhVqTjSMepacyfDHgt3gf/WIc83wAmiqdJQFGTbgI7nxrNmiq3TZnLZ5W4KgSnuQ7sbd78bijYXKZ3Eu8BGQt+VEz6nEFbgAtuqqWjpoToQmXoQ830XGnlQZErzaXpemjYkdw41mQ41nKstgvcgBg2I6WTM= 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 1576171172873413.6176915622385; Thu, 12 Dec 2019 09:19:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-203-GRpTv0lkPG6qpdqTHYjEWw-1; Thu, 12 Dec 2019 12:19:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A570DDBAB; Thu, 12 Dec 2019 17:19: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 814DF60BF3; Thu, 12 Dec 2019 17:19: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 35A69180880B; Thu, 12 Dec 2019 17:19:22 +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 xBCHJKR4005817 for ; Thu, 12 Dec 2019 12:19:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id DB2C75C3F8; Thu, 12 Dec 2019 17:19:20 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 639015C21B for ; Thu, 12 Dec 2019 17:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171171; 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=zmx/r5QP3gv0MIIWg2fpoGWQ+eX9yDksTCKNiZAwp1o=; b=T0LvT2Mfv5Qr3Sv2P/sVOp4mR++j1D6Chlccc1amsPoMK6p1+2D7RY9H36Ufb6RaKPCsJ3 SfvO7MWQ+7ZNNvo/nmas8TNq4+KTy9U1xNMSErCVVNTQNA8oFc+wWKVvAA6fn0BVrENYDA 0ve1LNliifnOIHfm6u/o5LtUkd7kOIs= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:47 +0100 Message-Id: <46729712c707e0189b93463a5d57e312a21cc2aa.1576170715.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 Subject: [libvirt] [PATCH 17/19] qemu: block: Introduce qemuBlockNamedNodeDataGetBitmapByName X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: GRpTv0lkPG6qpdqTHYjEWw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function looks up a named bitmap for a virStorageSource in the data returned from query-named-block-nodes. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_block.c | 32 ++++++++++++++++++++++++++++++++ src/qemu/qemu_block.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index ada2c52947..629a09b897 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2612,3 +2612,35 @@ qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver, return ret; } + + +/** + * qemuBlockNamedNodeDataGetBitmapByName: + * @blockNamedNodeData: hash table returned by qemuMonitorBlockGetNamedNod= eData + * @src: disk source to find the bitmap for + * @bitmap: name of the bitmap to find + * + * Looks up a bitmap named @bitmap of the @src image. + */ +qemuBlockNamedNodeDataBitmapPtr +qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData, + virStorageSourcePtr src, + const char *bitmap) +{ + qemuBlockNamedNodeDataPtr nodedata; + size_t i; + + if (!(nodedata =3D virHashLookup(blockNamedNodeData, src->nodeformat))) + return NULL; + + for (i =3D 0; i < nodedata->nbitmaps; i++) { + qemuBlockNamedNodeDataBitmapPtr bitmapdata =3D nodedata->bitmaps[i= ]; + + if (STRNEQ(bitmapdata->name, bitmap)) + continue; + + return bitmapdata; + } + + return NULL; +} diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 5854641027..1a38e0eccf 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -203,3 +203,8 @@ qemuBlockRemoveImageMetadata(virQEMUDriverPtr driver, virDomainObjPtr vm, const char *diskTarget, virStorageSourcePtr src); + +qemuBlockNamedNodeDataBitmapPtr +qemuBlockNamedNodeDataGetBitmapByName(virHashTablePtr blockNamedNodeData, + virStorageSourcePtr src, + const char *bitmap); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171269; cv=none; d=zohomail.com; s=zohoarc; b=ZMh+886U/r2x2/yFK/4fhRkeVMSV0jHcA17tIPCAn1tpWvXmvg1Y4cnnGdc7nGXaq1Jz8PhvDlxpVs9/xi+9rABDI+9SefOqRCdpijdL9SpefZQHBU8h36wuwPDahcwZWBLWG/qI+OL2idDsWsmCtBXpxa8h5832LnO3kFS52Qc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171269; 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=+I1D3UGJmwvMQ0E72Bwi5yG5v0jzUs1Dx37WJADfqdQ=; b=ONUoVlqj4aIkkIr7ymZfRI33ZEtO7dkNZAMVyFmqpoGBODwTTnv6pvQXpssqRYeTUORX0K5UYrpTtkuR98pcW8r6UM+DDZvg6zzP1ZMYWWJux65iOOuw7GvaWoJf8IXekbLEKdRgDgm81bAPnLsMYJ8dlk7OUeewPkGk9X3YmIY= 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 1576171269522410.66970783394015; Thu, 12 Dec 2019 09:21:09 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-rYUnARsUPvG7LyGUpeATWw-1; Thu, 12 Dec 2019 12:19:39 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87C03800C78; Thu, 12 Dec 2019 17:19:33 +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 5B3C05C3F8; Thu, 12 Dec 2019 17:19:33 +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 08115ADA83; Thu, 12 Dec 2019 17:19:33 +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 xBCHJNQf005879 for ; Thu, 12 Dec 2019 12:19:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1EB1F5C548; Thu, 12 Dec 2019 17:19:23 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C68E5C3F8 for ; Thu, 12 Dec 2019 17:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171268; 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=+I1D3UGJmwvMQ0E72Bwi5yG5v0jzUs1Dx37WJADfqdQ=; b=Qg7FaC9QyZoX/rkaY234q4fqcsrCpcfPxSSDIJlkDPLb8LMXPHej3C2ZitzwqgW9ribU4s D28KxvNPg6KyHm/qPG9QDA5r8TTTcmRjp/+f7L+YO2uIm4xQFlM5CMr1cdAmq15wVLVAkR JlNnxnrUj+63g3/9I26HdYaBEy79vSo= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18:48 +0100 Message-Id: <573b535dfc566145533bf97703f081c3fc35ab29.1576170715.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 Subject: [libvirt] [PATCH 18/19] qemu: backup: Merge bitmaps accross the backing chain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: rYUnARsUPvG7LyGUpeATWw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To allow backups work accross external snapshots we need to improve the algorithm which calculates which bitmaps to merge. The algorithm must look for appropriately named bitmaps in the image and possibly descend into a backing image if the current image does not have the bitmap. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- src/qemu/qemu_backup.c | 62 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 14cf6bbef0..294d5999a0 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -173,24 +173,70 @@ qemuBackupDiskDataCleanup(virDomainObjPtr vm, virJSONValuePtr qemuBackupDiskPrepareOneBitmapsChain(virDomainMomentDefPtr *incremental, virStorageSourcePtr backingChain, - virHashTablePtr blockNamedNodeData G_= GNUC_UNUSED, - const char *diskdst G_GNUC_UNUSED) + virHashTablePtr blockNamedNodeData, + const char *diskdst) { + qemuBlockNamedNodeDataBitmapPtr bitmap; g_autoptr(virJSONValue) ret =3D NULL; + size_t incridx =3D 0; if (!(ret =3D virJSONValueNewArray())) return NULL; - /* TODO: this code works only if the bitmaps are present on a single n= ode. - * The algorithm needs to be changed so that it looks into the backing= chain - * so that we can combine all relevant bitmaps for a given backing cha= in */ - while (*incremental) { + if (!(bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNamedNodeD= ata, + backingChain, + incremental[0]->n= ame))) { + virReportError(VIR_ERR_INVALID_ARG, + _("failed to find bitmap '%s' in image '%s%u'"), + incremental[0]->name, diskdst, backingChain->id); + return NULL; + } + + while (bitmap) { + if (bitmap->inconsistent) { + virReportError(VIR_ERR_INVALID_ARG, + _("bitmap '%s' for image '%s%u' is inconsistent= "), + bitmap->name, diskdst, backingChain->id); + return NULL; + } + if (qemuMonitorTransactionBitmapMergeSourceAddBitmap(ret, backingChain-= >nodeformat, - (*incremental= )->name) < 0) + bitmap->name)= < 0) return NULL; - incremental++; + if (backingChain->backingStore && + (bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNamedNo= deData, + backingChain->= backingStore, + incremental[in= cridx]->name))) { + backingChain =3D backingChain->backingStore; + continue; + } + + if (incremental[incridx + 1]) { + if ((bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNam= edNodeData, + backingCha= in, + incrementa= l[incridx + 1]->name))) { + incridx++; + continue; + } + + if (backingChain->backingStore && + (bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNam= edNodeData, + backingCha= in->backingStore, + incrementa= l[incridx + 1]->name))) { + incridx++; + backingChain =3D backingChain->backingStore; + continue; + } + + virReportError(VIR_ERR_INVALID_ARG, + _("failed to find bitmap '%s' in image '%s%u'"), + incremental[incridx]->name, diskdst, backingCha= in->id); + return NULL; + } else { + break; + } } return g_steal_pointer(&ret); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 20:24:47 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=1576171293; cv=none; d=zohomail.com; s=zohoarc; b=OWYbHHeGVULsRmSHc8lUrjjJHEv623KTgNaB82eaBH8k3pCib7VXLpus0P0kdfF3kkfkM3u1XHtUPbJjLEeejlO1AnbIXFPQr7PWx1tmM1VDzR5Dk8fA9VCNZY4lE9X3OxIVYQBRioZXwjVsMNaCqOF9IoT9MfGYzIk9UpffV+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576171293; 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=C39sucSN/0BS3aYQkXlVVy5gt1VX8Dle+GIBDxa6+0k=; b=PZTZmuM/6qN1/g18Fr8p3k5hZRz0FDAVvHdvToq1NnsrWCPKRVdfhO+kIyOKKg1NebaH3ejEfWMn5u+xMFAoP3jTuWSR6KUbjbO2NcsCexvO6Di9gczX9oedrPvpflDhbVOmgoBTvUoHkhj6esaPPuV1MgdicIvZ3yLVjyqNY/c= 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 1576171293613976.2491903130797; Thu, 12 Dec 2019 09:21:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-3MGgCN_1P7amK3FSB1hQIA-1; Thu, 12 Dec 2019 12:19:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F5C5DBA7; Thu, 12 Dec 2019 17:19:33 +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 0241A60C85; Thu, 12 Dec 2019 17:19:33 +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 AD7F2ADA81; Thu, 12 Dec 2019 17:19: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 xBCHJPb3005947 for ; Thu, 12 Dec 2019 12:19:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 59E7B5C3F8; Thu, 12 Dec 2019 17:19:25 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D65C95C548 for ; Thu, 12 Dec 2019 17:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576171292; 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=C39sucSN/0BS3aYQkXlVVy5gt1VX8Dle+GIBDxa6+0k=; b=VCydwjrH+gVkkl82uYSZs8mvLW/0mX7RE0zv3QTJE03+3as6Ek65twWZXGhqc0tIP7Fan6 Mw0OX+3OzHyoLMxzjROrAIeJ4qfxM2yijDN/g9cwztrvae+RAqgL70M3xOjduD7xIcm+CD Xfu2oVwLqkFEi7gLJhNPBvOiVqY2OOs= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 12 Dec 2019 18:18: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 Subject: [libvirt] [PATCH 19/19] tests: qemublock: Add tests for cross-snapshot incremental backups X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 3MGgCN_1P7amK3FSB1hQIA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemublocktest.c | 4 ++ .../backupmerge/snapshot-deep-out.json | 38 +++++++++++++++++++ .../backupmerge/snapshot-flat-out.json | 6 +++ .../snapshot-intermediate-out.json | 14 +++++++ 4 files changed, 62 insertions(+) create mode 100644 tests/qemublocktestdata/backupmerge/snapshot-deep-out.j= son create mode 100644 tests/qemublocktestdata/backupmerge/snapshot-flat-out.j= son create mode 100644 tests/qemublocktestdata/backupmerge/snapshot-intermedia= te-out.json diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 659ce327dc..905a5b6ed2 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -939,6 +939,10 @@ mymain(void) TEST_BACKUP_BITMAP_CALCULATE("basic-intermediate", bitmapSourceChain, = "d", "basic"); TEST_BACKUP_BITMAP_CALCULATE("basic-deep", bitmapSourceChain, "a", "ba= sic"); + TEST_BACKUP_BITMAP_CALCULATE("snapshot-flat", bitmapSourceChain, "curr= ent", "snapshots"); + TEST_BACKUP_BITMAP_CALCULATE("snapshot-intermediate", bitmapSourceChai= n, "d", "snapshots"); + TEST_BACKUP_BITMAP_CALCULATE("snapshot-deep", bitmapSourceChain, "a", = "snapshots"); + cleanup: virHashFree(diskxmljsondata.schema); qemuTestDriverFree(&driver); diff --git a/tests/qemublocktestdata/backupmerge/snapshot-deep-out.json b/t= ests/qemublocktestdata/backupmerge/snapshot-deep-out.json new file mode 100644 index 0000000000..526fc8d55b --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshot-deep-out.json @@ -0,0 +1,38 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + }, + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "c" + }, + { + "node": "libvirt-3-format", + "name": "b" + }, + { + "node": "libvirt-3-format", + "name": "a" + }, + { + "node": "libvirt-4-format", + "name": "a" + }, + { + "node": "libvirt-5-format", + "name": "a" + } +] diff --git a/tests/qemublocktestdata/backupmerge/snapshot-flat-out.json b/t= ests/qemublocktestdata/backupmerge/snapshot-flat-out.json new file mode 100644 index 0000000000..b89252e284 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshot-flat-out.json @@ -0,0 +1,6 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + } +] diff --git a/tests/qemublocktestdata/backupmerge/snapshot-intermediate-out.= json b/tests/qemublocktestdata/backupmerge/snapshot-intermediate-out.json new file mode 100644 index 0000000000..537d776ec6 --- /dev/null +++ b/tests/qemublocktestdata/backupmerge/snapshot-intermediate-out.json @@ -0,0 +1,14 @@ +[ + { + "node": "libvirt-1-format", + "name": "current" + }, + { + "node": "libvirt-1-format", + "name": "d" + }, + { + "node": "libvirt-2-format", + "name": "d" + } +] --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list