render / rpms / libvirt

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