render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
a41c76
From 32e26f3aff542e642641c32d9fa65577c891e337 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <32e26f3aff542e642641c32d9fa65577c891e337@dist-git>
a41c76
From: Peter Krempa <pkrempa@redhat.com>
a41c76
Date: Wed, 19 Feb 2020 15:10:21 +0100
a41c76
Subject: [PATCH] qemu: domain: Store nodenames of slice in status XML
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
The storage slice will require a specific node name in cases when the
a41c76
image format is not raw. Store and format them in the status XML.
a41c76
a41c76
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
(cherry picked from commit f36d751fa6d091af5f1c2331f607e0ec3d8993fb)
a41c76
a41c76
https://bugzilla.redhat.com/show_bug.cgi?id=1791788
a41c76
Message-Id: <83b00663d313ed032a6b7723b8427c3224f2c9c8.1582120424.git.pkrempa@redhat.com>
a41c76
Reviewed-by: Ján Tomko <jtomko@redhat.com>
a41c76
---
a41c76
 src/qemu/qemu_domain.c                    | 7 +++++++
a41c76
 tests/qemustatusxml2xmldata/modern-in.xml | 4 ++++
a41c76
 2 files changed, 11 insertions(+)
a41c76
a41c76
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
a41c76
index 7b414b79c7..948bf3011c 100644
a41c76
--- a/src/qemu/qemu_domain.c
a41c76
+++ b/src/qemu/qemu_domain.c
a41c76
@@ -2348,6 +2348,9 @@ qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt,
a41c76
     src->nodeformat = virXPathString("string(./nodenames/nodename[@type='format']/@name)", ctxt);
a41c76
     src->tlsAlias = virXPathString("string(./objects/TLSx509/@alias)", ctxt);
a41c76
 
a41c76
+    if (src->sliceStorage)
a41c76
+        src->sliceStorage->nodename = virXPathString("string(./nodenames/nodename[@type='slice-storage']/@name)", ctxt);
a41c76
+
a41c76
     if (src->pr)
a41c76
         src->pr->mgralias = virXPathString("string(./reservations/@mgralias)", ctxt);
a41c76
 
a41c76
@@ -2407,6 +2410,10 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
a41c76
     virBufferEscapeString(&nodenamesChildBuf, "<nodename type='storage' name='%s'/>\n", src->nodestorage);
a41c76
     virBufferEscapeString(&nodenamesChildBuf, "<nodename type='format' name='%s'/>\n", src->nodeformat);
a41c76
 
a41c76
+    if (src->sliceStorage)
a41c76
+        virBufferEscapeString(&nodenamesChildBuf, "<nodename type='slice-storage' name='%s'/>\n",
a41c76
+                              src->sliceStorage->nodename);
a41c76
+
a41c76
     virXMLFormatElement(buf, "nodenames", NULL, &nodenamesChildBuf);
a41c76
 
a41c76
     if (src->pr)
a41c76
diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxml2xmldata/modern-in.xml
a41c76
index 8a2718293f..c8d21ceada 100644
a41c76
--- a/tests/qemustatusxml2xmldata/modern-in.xml
a41c76
+++ b/tests/qemustatusxml2xmldata/modern-in.xml
a41c76
@@ -312,6 +312,9 @@
a41c76
         <backingStore type='file' index='1'>
a41c76
           <format type='qcow2'/>
a41c76
           <source file='/var/lib/libvirt/images/base.qcow2'>
a41c76
+            <slices>
a41c76
+              <slice type='storage' offset='1234' size='3456'/>
a41c76
+            </slices>
a41c76
             <seclabel model='dac' relabel='yes'>
a41c76
               <label>qemu:qemu</label>
a41c76
             </seclabel>
a41c76
@@ -322,6 +325,7 @@
a41c76
               <nodenames>
a41c76
                 <nodename type='storage' name='test-storage'/>
a41c76
                 <nodename type='format' name='test-format'/>
a41c76
+                <nodename type='slice-storage' name='test-slice-storage'/>
a41c76
               </nodenames>
a41c76
               <reservations mgralias='test-alias'/>
a41c76
               <relPath>base.qcow2</relPath>
a41c76
-- 
a41c76
2.25.0
a41c76