From nobody Fri May 3 20:21:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1610630133; cv=none; d=zohomail.com; s=zohoarc; b=Oi8nBZ7UmmUZBkdpJKLv6jZBo620VC7QSr1tXHqFVmJOyCVhvCLGItExhaAJR0sjnEMdzVMqeVopbgHromJJMDmVpoJRCk/alJo0LPn2t9v+6SR0knxtJUxrG4O5V5grZrHhBb/beIDpPvVdpJKcPGNxzTrJVltDHJuPbPfAv9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610630133; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=yE3UZUuTYQd6MZdpYQCSfssMmjUwppuYXagjSGKetUE=; b=a17Uw3aQaQH2IAUNKD8m2D6GuIPb172qTeOc57poPN+aXrEHWiPNOo6cxx5kBRmFzMB2t2zQJfgZGV5SZEkhrFUQY+Sw9WqMbrsJbALl2rjKQkx8Bkg95fQh+NrquyggGq+p6PJR0TaqTi0tdO7KslecVHPElgzUNDseAT5m6eU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610630133596210.18819578568844; Thu, 14 Jan 2021 05:15: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-250-nT6RfLe6P-OP2EgSWF_NRw-1; Thu, 14 Jan 2021 08:15:30 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE0CD9CC03; Thu, 14 Jan 2021 13:15:24 +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 753B15D9DD; Thu, 14 Jan 2021 13:15: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 C50134BB7B; Thu, 14 Jan 2021 13:15:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10EDFM2P020823 for ; Thu, 14 Jan 2021 08:15:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 33655614FD; Thu, 14 Jan 2021 13:15:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E85D60867 for ; Thu, 14 Jan 2021 13:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610630132; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yE3UZUuTYQd6MZdpYQCSfssMmjUwppuYXagjSGKetUE=; b=WhkdvKaFlt5xzqWHODjXfu2KayrQHlymH17vl2iHuxk+VGr7KYu4w8UCoTZHQGkZC5n3w/ GAdj3jJh7V6/NG9pw9GQrdLHzZqo8zEns1ocN9VF28B/ADZsg2w1Z/dmRLuePwI4Eslc5+ IWEtPeJL6k5OmSyP1cU6bWexSQ3Gbpk= X-MC-Unique: nT6RfLe6P-OP2EgSWF_NRw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH (for 7.0?) ] conf: disk: Parse and format also for Date: Thu, 14 Jan 2021 14:15:17 +0100 Message-Id: <622a935fcc9a4f53dbccc76ea1959cd2e5846252.1610630049.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 154df5840d added support for as property of a . Since the same parser is used to parse the XML used with virDomainBlockCopy it starts the copy job with the appropriate cache configured, but the doesn't show this configuration nor it's preserved if libvirtd is restarted during the mirror. Add parsing, formatting and tests for for a . Signed-off-by: Peter Krempa Reviewed-by: Jiri Denemark --- Since was introduced in this release we should probably fix this too prior to the release. src/conf/domain_conf.c | 22 ++++++++++++++++++- tests/qemuxml2argvdata/disk-mirror.xml | 14 ++++++++++++ .../qemuxml2xmloutdata/disk-mirror-active.xml | 18 ++++++++++++++- .../disk-mirror-inactive.xml | 9 +++++++- 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 349fc28c2a..01b7187637 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8784,6 +8784,12 @@ virDomainDiskDefMirrorParse(virDomainDiskDefPtr def, return -1; } + if (virParseScaledValue("./format/metadata_cache/max_size", NULL, + ctxt, + &def->mirror->metadataCacheMaxSize, + 1, ULLONG_MAX, false) < 0) + return -1; + return 0; } @@ -24283,6 +24289,8 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) formatAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) formatChildBuf =3D VIR_BUFFER_INIT_CHILD(&childBuf); const char *formatStr =3D NULL; /* For now, mirroring is currently output-only: we only output it @@ -24311,7 +24319,19 @@ virDomainDiskDefFormatMirror(virBufferPtr buf, virBufferEscapeString(&attrBuf, " ready=3D'%s'", virDomainDiskMirrorStateTypeToString(disk->m= irrorState)); - virBufferEscapeString(&childBuf, "\n", formatStr); + virBufferEscapeString(&formatAttrBuf, " type=3D'%s'", formatStr); + if (disk->mirror->metadataCacheMaxSize > 0) { + g_auto(virBuffer) metadataCacheChildBuf =3D VIR_BUFFER_INIT_CHILD(= &formatChildBuf); + + virBufferAsprintf(&metadataCacheChildBuf, + "%llu\n", + disk->mirror->metadataCacheMaxSize); + + virXMLFormatElement(&formatChildBuf, "metadata_cache", NULL, &meta= dataCacheChildBuf); + } + + virXMLFormatElement(&childBuf, "format", &formatAttrBuf, &formatChildB= uf); + if (virDomainDiskSourceFormat(&childBuf, disk->mirror, "source", 0, tr= ue, flags, false, false, xmlopt) < 0) return -1; diff --git a/tests/qemuxml2argvdata/disk-mirror.xml b/tests/qemuxml2argvdat= a/disk-mirror.xml index 2d61fe29c3..73886e99f4 100644 --- a/tests/qemuxml2argvdata/disk-mirror.xml +++ b/tests/qemuxml2argvdata/disk-mirror.xml @@ -54,6 +54,20 @@ + + + + + + + 1234 + + + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-mirror-active.xml b/tests/qemuxm= l2xmloutdata/disk-mirror-active.xml index 17fb061d49..0e2669398c 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-active.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-active.xml @@ -61,6 +61,22 @@
+ + + + + + + + 1234 + + + + + + +
+
@@ -71,7 +87,7 @@ -
+
diff --git a/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml b/tests/qemu= xml2xmloutdata/disk-mirror-inactive.xml index 157ffcf6b2..6c7f92c1cc 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml @@ -43,6 +43,13 @@
+ + + + + +
+
@@ -53,7 +60,7 @@ -
+
--=20 2.29.2