render / rpms / libvirt

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