libvirt/tests
Eric Blake 6cc4d6a3fe storage: use valid XML for awkward volume names
$ touch /var/lib/libvirt/images/'a<b>c'
$ virsh pool-refresh default
$ virsh vol-dumpxml 'a<b>c' default | head -n2
<volume>
  <name>a<b>c</name>

Oops.  That's not valid XML.  And when we fix the XML
generation, it fails RelaxNG validation.

I'm also tired of seeing <key>(null)</key> in the example
output for volume xml; while we used NULLSTR() to avoid
a NULL deref rather than relying on glibc's printf
extension behavior, it's even better if we avoid the issue
in the first place.  But this requires being careful that
we don't invalidate any storage backends that were relying
on key being unassigned during virStoragVolCreateXML[From].

I would have split this into two patches (one for escaping,
one for avoiding <key>(null)</key>), but since they both
end up touching a lot of the same test files, I ended up
merging it into one.

Note that this patch allows pretty much any volume name
that can appear in a directory (excluding . and .. because
those are special), but does nothing to change the current
(unenforced) RelaxNG claim that pool names will consist
only of letters, numbers, _, -, and +.  Tightening the C
code to match RelaxNG patterns and/or relaxing the grammar
to match the C code for pool names is a task for another
day (but remember, we DID recently tighten C code for
domain names to exclude a leading '.').

* src/conf/storage_conf.c (virStoragePoolSourceFormat)
(virStoragePoolDefFormat, virStorageVolTargetDefFormat)
(virStorageVolDefFormat): Escape user-controlled strings.
(virStorageVolDefParseXML): Parse key, for use in unit tests.
* src/storage/storage_driver.c (storageVolCreateXML)
(storageVolCreateXMLFrom): Ensure parsed key doesn't confuse
volume creation.
* docs/schemas/basictypes.rng (volName): Relax definition.
* tests/storagepoolxml2xmltest.c (mymain): Test it.
* tests/storagevolxml2xmltest.c (mymain): Likewise.
* tests/storagepoolxml2xmlin/pool-dir-naming.xml: New file.
* tests/storagepoolxml2xmlout/pool-dir-naming.xml: Likewise.
* tests/storagevolxml2xmlin/vol-file-naming.xml: Likewise.
* tests/storagevolxml2xmlout/vol-file-naming.xml: Likewise.
* tests/storagevolxml2xmlout/vol-*.xml: Fix fallout.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-11-21 17:29:47 -07:00
..
capabilityschemadata capabilities: add baselabel per sec driver/virt type to secmodel 2013-10-29 07:06:04 -06:00
commanddata
confdata
cputestdata cpu: Add cpu test cases for PPC CPU driver. 2013-09-05 12:31:10 +01:00
domainschemadata
domainsnapshotxml2xmlin
domainsnapshotxml2xmlout
fchostdata/fc_host
interfaceschemadata
lxcxml2xmldata Allow root directory in filesystem source dir schema 2013-11-07 18:43:15 +01:00
lxcxml2xmloutdata Allow root directory in filesystem source dir schema 2013-11-07 18:43:15 +01:00
networkxml2confdata Add forwarder attribute to <dns/> element 2013-09-17 17:47:33 -06:00
networkxml2xmlin Add forwarder attribute to <dns/> element 2013-09-17 17:47:33 -06:00
networkxml2xmlout Add forwarder attribute to <dns/> element 2013-09-17 17:47:33 -06:00
networkxml2xmlupdatein Test network update XML parsing 2013-08-28 08:05:46 +02:00
networkxml2xmlupdateout Test network update XML parsing 2013-08-28 08:05:46 +02:00
nodedevschemadata nodedev: add iommuGroup to node device object 2013-06-26 14:10:56 -04:00
nodeinfodata
nwfilterxml2xmlin
nwfilterxml2xmlout
qemucapabilitiesdata qemu: don't use deprecated -no-kvm-pit-reinjection 2013-11-05 16:04:06 +01:00
qemuhelpdata qemu: Support setting the 'removable' flag for USB disks 2013-09-02 14:45:38 +02:00
qemuhotplugtestdata qemuhotplugtest: Add tests for virtio SCSI disk hotplug 2013-08-26 16:09:56 +02:00
qemumonitorjsondata qemu: Add monitor APIs to fetch CPUID data from QEMU 2013-11-08 09:44:36 +01:00
qemuxml2argvdata qemu: Add support for virt machine type with virtio-mmio devices on armv7 2013-11-20 14:31:17 -05:00
qemuxml2xmloutdata Add pcihole64 element to root PCI controllers 2013-08-27 17:42:29 +02:00
qemuxmlnsdata qemu: Set QEMU_AUDIO_DRV=none with -nographic 2013-09-02 16:53:39 -04:00
securityselinuxlabeldata selinux: enhance test to cover nfs label failure 2013-08-20 10:46:58 -06:00
sexpr2xmldata
storagepoolschemadata
storagepoolxml2xmlin storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
storagepoolxml2xmlout storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
storagevolschemadata
storagevolxml2argvdata Always specify qcow2 compat level on qemu-img command line 2013-08-27 12:45:58 +02:00
storagevolxml2xmlin storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
storagevolxml2xmlout storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
sysinfodata Implement minimal sysinfo for AArch64 platforms. 2013-10-15 16:59:43 -04:00
virpcitestdata virpcitest: Introduce testVirPCIDeviceReset 2013-11-06 09:34:17 +01:00
vmwareverdata VMware: Add Fusion version test 2013-09-30 16:58:37 -05:00
vmx2xmldata esx: Fix floppy.fileName handling in the vmx file parser 2013-10-15 11:39:02 +01:00
xencapsdata
xmconfigdata
xml2sexprdata
xml2vmxdata esx: Fix floppy.fileName handling in the vmx file parser 2013-10-15 11:39:02 +01:00
.valgrind.supp valgrind: Adjust filter for _dl_allocate_tls 2013-08-01 17:04:28 -04:00
capabilityschematest
commandhelper.c testutils: Resolve Coverity issues 2013-07-11 14:18:11 -04:00
commandtest.c Make virCommand env handling robust in setuid env 2013-10-21 14:03:52 +01:00
cpuset virBitmapParse: Fix behavior in case of error and fix up callers 2013-08-22 11:38:36 +02:00
cputest.c maint: avoid 'const fooPtr' in tests 2013-10-14 14:34:37 -06:00
define-dev-segfault
domainschematest LXC: Fix handling of RAM filesystem size units 2013-10-09 17:44:45 +02:00
domainsnapshotschematest
domainsnapshotxml2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
esxutilstest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
eventtest.c Convert 'int i' to 'size_t i' in tests/ files 2013-07-10 17:40:13 +01:00
fchosttest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
fdstreamtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
int-overflow
interfaceschematest
interfacexml2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
jsontest.c Error out on unterminated arrays and objects in JSON parser 2013-11-20 12:35:44 +01:00
libvirtd-fail
libvirtd-pool
libvirtdconftest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
lxcxml2xmltest.c Allow root directory in filesystem source dir schema 2013-11-07 18:43:15 +01:00
Makefile.am qemu: Add monitor APIs to fetch CPUID data from QEMU 2013-11-08 09:44:36 +01:00
metadatatest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
networkschematest
networkxml2conftest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
networkxml2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
networkxml2xmlupdatetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
nodedevschematest
nodedevxml2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
nodeinfotest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
nwfilterschematest
nwfilterxml2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
object-locking.ml
oomtrace.pl
openvzutilstest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
openvzutilstest.conf
pkix_asn1_tab.c
qemuagenttest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
qemuargv2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
qemucapabilitiestest.c maint: avoid further typedef accidents 2013-10-30 17:02:12 -06:00
qemuhelptest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
qemuhotplugtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
qemumonitorjsontest.c qemumonitorjsontest: Introduce GetNonExistingCPUData test 2013-11-19 16:30:28 +01:00
qemumonitortest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
qemumonitortestutils.c Remove (nearly) all use of getuid()/getgid() 2013-10-21 14:03:52 +01:00
qemumonitortestutils.h tests: Learn qemuMonitorTestNew optional greeting 2013-10-01 10:48:47 +02:00
qemuxml2argvtest.c qemu: Add support for virt machine type with virtio-mmio devices on armv7 2013-11-20 14:31:17 -05:00
qemuxml2xmltest.c virSecurityLabelDefParseXML: Don't parse label on model='none' 2013-11-11 16:01:25 +01:00
qemuxmlnstest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
read-bufsiz
read-non-seekable
reconnect.c test: Refactor setting of dummy error handlers 2013-09-17 16:45:53 +02:00
schematestutils.sh tests: skip schema validation tests if xmllint is missing 2013-08-23 15:23:44 -06:00
seclabeltest.c
securityselinuxhelper.c tests: avoid compile failure on linux kernels older than 2.6.19 2013-10-07 08:40:30 -06:00
securityselinuxlabeltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
securityselinuxtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
sexpr2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
shunloadhelper.c
shunloadtest.c build: fix shunloadtest breakage 2013-07-29 13:09:39 -06:00
sockettest.c virsocket: Introduce virSocketAddrIsWildcard 2013-10-11 11:05:06 +02:00
ssh.c build: fix shunloadtest breakage 2013-07-29 13:09:39 -06:00
start
statstest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
storagebackendsheepdogtest.c
storagepoolschematest
storagepoolxml2xmltest.c storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
storagevolschematest
storagevolxml2argvtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
storagevolxml2xmltest.c storage: use valid XML for awkward volume names 2013-11-21 17:29:47 -07:00
sysinfotest.c maint: fix comma style issues: tests, tools 2013-11-20 09:14:55 -07:00
test_conf.c viralloc: Report OOM error on failure 2013-07-10 11:07:31 +02:00
test_conf.sh
test-lib.sh test-lib: Make case skipping possible 2013-09-13 10:25:56 +02:00
testutils.c Remove test case average timing 2013-10-08 12:39:30 +01:00
testutils.h Remove test case average timing 2013-10-08 12:39:30 +01:00
testutilslxc.c
testutilslxc.h
testutilsqemu.c qemu: Don't add default memballoon device on ARM 2013-09-02 16:53:39 -04:00
testutilsqemu.h
testutilsxen.c
testutilsxen.h
utiltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
vcpupin
viratomictest.c maint: fix comma style issues: tests, tools 2013-11-20 09:14:55 -07:00
virauthconfigtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virbitmaptest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virbuftest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
vircgroupmock.c maint: fix comma style issues: tests, tools 2013-11-20 09:14:55 -07:00
vircgrouptest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virdbustest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virdrivermoduletest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virendiantest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virhashdata.h
virhashtest.c maint: avoid 'const fooPtr' in hashes 2013-10-14 11:40:24 -06:00
viridentitytest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virkeycodetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virkeyfiletest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virlockspacetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virlogtest.c Fix flaw in detecting log format 2013-10-14 10:31:01 +01:00
virnetmessagetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virnetserverclientmock.c Add test case for virNetServerClient object identity code 2013-09-24 09:37:26 +01:00
virnetserverclienttest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virnetsockettest.c Remove (nearly) all use of getuid()/getgid() 2013-10-21 14:03:52 +01:00
virnettlscontexttest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virnettlshelpers.c Fix parallel runs of TLS test suites 2013-08-09 11:54:41 +01:00
virnettlshelpers.h Fix parallel runs of TLS test suites 2013-08-09 11:54:41 +01:00
virnettlssessiontest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virpcimock.c tests: Fix virtpcitest in VPATH 2013-11-07 11:13:46 +01:00
virpcitest.c virpcitest: Introduce testVirPCIDeviceReset 2013-11-06 09:34:17 +01:00
virportallocatortest.c Return -1 in virPortAllocatorAcquire if all ports are used 2013-11-18 12:28:07 +01:00
virsh-all tests: Skip virsh-all test as expensive 2013-08-12 18:47:56 +02:00
virsh-optparse
virsh-schedinfo
virsh-synopsis
virsh-undefine
virsh-uriprecedence tests: Don't test user config file if ran as root 2013-09-13 10:25:56 +02:00
virshtest.c virsh: allow alias to expand to opt=value pair 2013-10-24 11:17:41 +01:00
virstoragetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virstringtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virsystemdmock.c Add checking of dbus_message_iter_append_basic return value 2013-09-20 12:38:24 +01:00
virsystemdtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
virt-aa-helper-test
virtimetest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
viruritest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
vmwarevertest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
vmx2xmltest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
xencapstest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
xmconfigtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
xml2sexprtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00
xml2vmxtest.c Remove test case average timing 2013-10-08 12:39:30 +01:00