From nobody Mon Feb 9 07:39:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1532534332924367.0566276132714; Wed, 25 Jul 2018 08:58:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64E3A3001777; Wed, 25 Jul 2018 15:58:51 +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 24801308BDB4; Wed, 25 Jul 2018 15:58:51 +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 C8EE538B7; Wed, 25 Jul 2018 15:58:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6PFwSQC025691 for ; Wed, 25 Jul 2018 11:58:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D8D37C4B; Wed, 25 Jul 2018 15:58:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id E38F117336; Wed, 25 Jul 2018 15:58:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 25 Jul 2018 17:57:44 +0200 Message-Id: <10374201f05e44631f8229aa6f3ab314d38ae312.1532533587.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH RFC 13/39] conf: domain: Format out user provided backing chains in XML 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 25 Jul 2018 15:58:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a user configures the backing chain in the XML we should not ignore it. We already do parse it but don't format it out. As a safety-precaution don't attempt to format detected chain into the inactive XML. Signed-off-by: Peter Krempa Reviewed-by: J=EF=BF=BDn Tomko --- src/conf/domain_conf.c | 8 ++- .../disk-backing-chains-inactive.xml | 35 ++++++++++ .../disk-backing-chains-index-active.xml | 80 ++++++++++++++++++= ++++ .../disk-backing-chains-index-inactive.xml | 80 ++++++++++++++++++= ++++ .../disk-backing-chains-noindex-active.xml | 80 ++++++++++++++++++= ++++ .../disk-backing-chains-noindex-inactive.xml | 80 ++++++++++++++++++= ++++ tests/qemuxml2xmloutdata/disk-mirror-inactive.xml | 4 ++ .../disk-mirror-old-inactive.xml | 4 ++ 8 files changed, 369 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 33b0b4ab68..55f356ef23 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23669,10 +23669,15 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, unsigned int flags) { const char *format; + bool inactive =3D flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE; if (!backingStore) return 0; + /* don't write detected backing chain members to inactive xml */ + if (inactive && backingStore->detected) + return 0; + if (backingStore->type =3D=3D VIR_STORAGE_TYPE_NONE) { virBufferAddLit(buf, "\n"); return 0; @@ -23938,8 +23943,7 @@ virDomainDiskDefFormat(virBufferPtr buf, /* Don't format backingStore to inactive XMLs until the code for * persistent storage of backing chains is ready. */ - if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE) && - virDomainDiskBackingStoreFormat(buf, def->src->backingStore, + if (virDomainDiskBackingStoreFormat(buf, def->src->backingStore, xmlopt, flags) < 0) return -1; diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml b/te= sts/qemuxml2xmloutdata/disk-backing-chains-inactive.xml index a9db12ba4d..c1af58ff6f 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-inactive.xml @@ -19,6 +19,10 @@ + + + +
@@ -27,6 +31,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,6 +64,7 @@ +
@@ -48,6 +78,11 @@ + + + + +
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml = b/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml index db70ae2b53..724afa4e83 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-index-active.xml @@ -19,6 +19,10 @@ + + + +
@@ -27,6 +31,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,6 +64,7 @@ +
@@ -48,6 +78,11 @@ + + + + +
@@ -60,6 +95,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xm= l b/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml index db70ae2b53..29d1ad002d 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-index-inactive.xml @@ -19,6 +19,10 @@ + + + +
@@ -27,6 +31,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,6 +64,7 @@ +
@@ -48,6 +78,11 @@ + + + + +
@@ -60,6 +95,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xm= l b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml index db70ae2b53..29d1ad002d 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-active.xml @@ -19,6 +19,10 @@ + + + +
@@ -27,6 +31,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,6 +64,7 @@ +
@@ -48,6 +78,11 @@ + + + + +
@@ -60,6 +95,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.= xml b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml index db70ae2b53..29d1ad002d 100644 --- a/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-backing-chains-noindex-inactive.xml @@ -19,6 +19,10 @@ + + + +
@@ -27,6 +31,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -35,6 +64,7 @@ +
@@ -48,6 +78,11 @@ + + + + +
@@ -60,6 +95,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml b/tests/qemu= xml2xmloutdata/disk-mirror-inactive.xml index cc7aed0873..5c9b72738d 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-inactive.xml @@ -17,12 +17,14 @@ +
+
@@ -30,12 +32,14 @@ +
+
diff --git a/tests/qemuxml2xmloutdata/disk-mirror-old-inactive.xml b/tests/= qemuxml2xmloutdata/disk-mirror-old-inactive.xml index cc7aed0873..5c9b72738d 100644 --- a/tests/qemuxml2xmloutdata/disk-mirror-old-inactive.xml +++ b/tests/qemuxml2xmloutdata/disk-mirror-old-inactive.xml @@ -17,12 +17,14 @@ +
+
@@ -30,12 +32,14 @@ +
+
--=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list