From: Peter Krempa Date: Thu, 5 Dec 2013 17:33:01 +0000 (+0100) Subject: conf: Fix XML formatting of RNG device info X-Git-Tag: CVE-2013-6436~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be904e4eeb83cb5513af8dad01fdfbb924f87bb1;p=thirdparty%2Flibvirt.git conf: Fix XML formatting of RNG device info https://bugzilla.redhat.com/show_bug.cgi?id=1035118 When outputting the XML for the RNG device, the code didn't format the PCI address info. Additionally the schema wasn't expecting the info although it was being parsed and used internally. Fix those mistakes and add test for the PCI info section. --- diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 80848d2054..38c680146d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3956,6 +3956,12 @@ + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 65bd9b12e3..0268847d8e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15832,6 +15832,11 @@ virDomainRNGDefFormat(virBufferPtr buf, break; } + if (virDomainDeviceInfoIsSet(&def->info, flags)) { + if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0) + return -1; + } + virBufferAddLit(buf, " \n"); return 0; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args index 01e9f89611..4ae6257f7f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.args @@ -4,4 +4,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \ -object rng-random,id=rng0 \ --device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x4 +-device virtio-rng-pci,rng=rng0,bus=pci.0,addr=0x7 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml index 0852deaa0e..0a7bf6188f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-rng-default.xml @@ -18,6 +18,7 @@ +