render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c401cc
From 3150dcdf63874bde7ba3f7e279a0b3b69edf230f Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <3150dcdf63874bde7ba3f7e279a0b3b69edf230f.1386348947.git.jdenemar@redhat.com>
c401cc
From: Peter Krempa <pkrempa@redhat.com>
c401cc
Date: Fri, 6 Dec 2013 11:24:11 +0100
c401cc
Subject: [PATCH] conf: Fix XML formatting of RNG device info
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1035118
c401cc
c401cc
When outputting the XML for the RNG device, the code didn't format the
c401cc
PCI address info. Additionally the schema wasn't expecting the info
c401cc
although it was being parsed and used internally. Fix those mistakes and
c401cc
add test for the PCI info section.
c401cc
c401cc
(cherry picked from commit be904e4eeb83cb5513af8dad01fdfbb924f87bb1)
c401cc
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 docs/schemas/domaincommon.rng                               | 6 ++++++
c401cc
 src/conf/domain_conf.c                                      | 5 +++++
c401cc
 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args | 2 +-
c401cc
 tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml  | 1 +
c401cc
 4 files changed, 13 insertions(+), 1 deletion(-)
c401cc
c401cc
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
c401cc
index 4e61d7c..36a4b94 100644
c401cc
--- a/docs/schemas/domaincommon.rng
c401cc
+++ b/docs/schemas/domaincommon.rng
c401cc
@@ -3905,6 +3905,12 @@
c401cc
         <optional>
c401cc
           <ref name="rng-rate"/>
c401cc
         </optional>
c401cc
+        <optional>
c401cc
+          <ref name="alias"/>
c401cc
+        </optional>
c401cc
+        <optional>
c401cc
+          <ref name="address"/>
c401cc
+        </optional>
c401cc
       </interleave>
c401cc
     </element>
c401cc
   </define>
c401cc
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
c401cc
index 8307fee..c0c4add 100644
c401cc
--- a/src/conf/domain_conf.c
c401cc
+++ b/src/conf/domain_conf.c
c401cc
@@ -15628,6 +15628,11 @@ virDomainRNGDefFormat(virBufferPtr buf,
c401cc
         break;
c401cc
     }
c401cc
 
c401cc
+    if (virDomainDeviceInfoIsSet(&def->info, flags)) {
c401cc
+        if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
c401cc
+            return -1;
c401cc
+    }
c401cc
+
c401cc
     virBufferAddLit(buf, "    </rng>\n");
c401cc
 
c401cc
     return 0;
c401cc
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
c401cc
index a5f04fd..ccf63eb 100644
c401cc
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
c401cc
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args
c401cc
@@ -3,4 +3,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu \
c401cc
 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
c401cc
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
c401cc
 -object rng-random,id=rng0 \
c401cc
--device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4
c401cc
+-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7
c401cc
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml
c401cc
index 0852dea..0a7bf61 100644
c401cc
--- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml
c401cc
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml
c401cc
@@ -18,6 +18,7 @@
c401cc
     <memballoon model='virtio'/>
c401cc
     <rng model='virtio'>
c401cc
       <backend model='random'/>
c401cc
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
c401cc
     </rng>
c401cc
   </devices>
c401cc
 </domain>
c401cc
-- 
c401cc
1.8.4.5
c401cc