[libvirt] [PATCH 1/2] maint: use common xml quoting style

According to the official XML specification [1], attributes can be specified with either ' or " (where the difference is that you can use '"' or '"' but must use """, and conversely for "'" or "'" vs. '''). But our code generation in src/conf prefers to output the '' notation, as it is easier to write C string literals for that style. Using a consistent style throughout libvirt will make it easier for users to copy-and-paste without wondering why we switch quoting styles mid-stream. [1] http://www.w3.org/TR/xml11/#NT-Reference Mechanical conversion done with: $ find -name '*.xml' | \ xargs sed -i 's/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g' followed by inspecting the results, and touching up the change in tests/xml2sexprdata/xml2sexpr-escape.xml to fix 'make check'. * cfg.mk (sc_rng_quote_style): Enforce the rule. * examples/xml/storage/*.xml: Fix fallout. * examples/xml/test/*.xml: Likewise. * python/libvirt-*override-api.xml: Likewise. * src/network/default.xml: Likewise. * tests/*/*.xml: Likewise. --- cfg.mk | 7 ++ examples/xml/storage/pool-dir.xml | 2 +- examples/xml/storage/pool-fs.xml | 4 +- examples/xml/storage/pool-logical.xml | 4 +- examples/xml/storage/pool-netfs.xml | 6 +- examples/xml/storage/vol-cow.xml | 6 +- examples/xml/storage/vol-qcow.xml | 6 +- examples/xml/storage/vol-qcow2.xml | 6 +- examples/xml/storage/vol-raw.xml | 6 +- examples/xml/storage/vol-sparse.xml | 4 +- examples/xml/storage/vol-vmdk.xml | 6 +- examples/xml/test/testnode.xml | 14 ++-- examples/xml/test/testnodeinline.xml | 66 ++++++++++---------- python/libvirt-override-api.xml | 20 +++--- python/libvirt-qemu-override-api.xml | 2 +- src/network/default.xml | 6 +- .../networkxml2argvdata/nat-network-dns-hosts.xml | 2 +- tests/networkxml2xmlin/8021Qbh-net.xml | 16 +++--- tests/networkxml2xmlin/direct-net.xml | 4 +- tests/networkxml2xmlin/host-bridge-net.xml | 4 +- tests/networkxml2xmlin/isolated-network.xml | 6 +- tests/networkxml2xmlin/nat-network.xml | 20 +++--- tests/networkxml2xmlin/netboot-network.xml | 12 ++-- tests/networkxml2xmlin/netboot-proxy-network.xml | 10 ++-- tests/networkxml2xmlin/routed-network.xml | 6 +- tests/networkxml2xmlin/vepa-net.xml | 24 ++++---- tests/nwfilterxml2xmlin/stp-test.xml | 4 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml | 6 +- tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml | 6 +- .../qemuxml2argv-cpu-topology1.xml | 2 +- .../qemuxml2argv-cpu-topology2.xml | 2 +- .../qemuxml2argv-cpu-topology3.xml | 2 +- .../qemuxml2argv-numatune-memory.xml | 2 +- tests/storagepoolxml2xmlin/pool-iscsi-auth.xml | 4 +- .../pool-iscsi-vendor-product.xml | 4 +- tests/storagepoolxml2xmlin/pool-iscsi.xml | 4 +- tests/storagepoolxml2xmlin/pool-logical-create.xml | 6 +- tests/storagepoolxml2xmlin/pool-mpath.xml | 2 +- tests/storagepoolxml2xmlin/pool-scsi.xml | 4 +- tests/storagevolxml2xmlin/vol-file.xml | 2 +- tests/storagevolxml2xmlin/vol-qcow2.xml | 2 +- tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml | 12 ++-- tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml | 2 +- .../xml2sexpr-disk-drv-blktap-qcow.xml | 2 +- .../xml2sexpr-disk-drv-blktap-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml | 2 +- .../xml2sexpr-disk-drv-blktap2-raw.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml | 2 +- tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml | 2 +- tests/xml2sexprdata/xml2sexpr-escape.xml | 2 +- tests/xml2sexprdata/xml2sexpr-net-bridged.xml | 10 ++-- tests/xml2sexprdata/xml2sexpr-net-e1000.xml | 10 ++-- tests/xml2sexprdata/xml2sexpr-net-routed.xml | 12 ++-- tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml | 2 +- tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml | 2 +- .../xml2vmxdata/xml2vmx-serial-network-client.xml | 4 +- .../xml2vmxdata/xml2vmx-serial-network-server.xml | 4 +- 58 files changed, 201 insertions(+), 194 deletions(-) diff --git a/cfg.mk b/cfg.mk index 817b5f3..c964c27 100644 --- a/cfg.mk +++ b/cfg.mk @@ -419,6 +419,13 @@ sc_TAB_in_indentation: halt='indent with space, not TAB, in C, sh, html, py, and RNG schemas' \ $(_sc_search_regexp) +# In xml files, prefer name='abc' over name="abc" +sc_rng_quote_style: + @prohibit='\b[-a-zA-Z0-9_]+="' \ + in_vc_files='\.(xml)$$' \ + halt='use name='\'val\'', not name="val", in xml' \ + $(_sc_search_regexp) + ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper diff --git a/examples/xml/storage/pool-dir.xml b/examples/xml/storage/pool-dir.xml index 47a3bfa..4c10792 100644 --- a/examples/xml/storage/pool-dir.xml +++ b/examples/xml/storage/pool-dir.xml @@ -1,4 +1,4 @@ -<pool type="dir"> +<pool type='dir'> <name>virtimages</name> <target> <path>/var/lib/virt/images</path> diff --git a/examples/xml/storage/pool-fs.xml b/examples/xml/storage/pool-fs.xml index b0417d9..c8037f9 100644 --- a/examples/xml/storage/pool-fs.xml +++ b/examples/xml/storage/pool-fs.xml @@ -1,7 +1,7 @@ -<pool type="fs"> +<pool type='fs'> <name>virtimages</name> <source> - <device path="/dev/VolGroup00/VirtImages"/> + <device path='/dev/VolGroup00/VirtImages'/> </source> <target> <path>/var/lib/virt/images</path> diff --git a/examples/xml/storage/pool-logical.xml b/examples/xml/storage/pool-logical.xml index c33e903..16c34cb 100644 --- a/examples/xml/storage/pool-logical.xml +++ b/examples/xml/storage/pool-logical.xml @@ -1,7 +1,7 @@ -<pool type="logical"> +<pool type='logical'> <name>HostVG</name> <source> - <device path="/dev/sda1"/> + <device path='/dev/sda1'/> </source> <target> <path>/dev/HostVG</path> diff --git a/examples/xml/storage/pool-netfs.xml b/examples/xml/storage/pool-netfs.xml index d1df2e2..0585492 100644 --- a/examples/xml/storage/pool-netfs.xml +++ b/examples/xml/storage/pool-netfs.xml @@ -1,8 +1,8 @@ -<pool type="netfs"> +<pool type='netfs'> <name>virtimages</name> <source> - <host name="nfs.example.com"/> - <directory path="/var/lib/virt/images"/> + <host name='nfs.example.com'/> + <directory path='/var/lib/virt/images'/> </source> <target> <path>/var/lib/virt/images</path> diff --git a/examples/xml/storage/vol-cow.xml b/examples/xml/storage/vol-cow.xml index 1d80a01..e584362 100644 --- a/examples/xml/storage/vol-cow.xml +++ b/examples/xml/storage/vol-cow.xml @@ -1,10 +1,10 @@ -<volume type="file"> +<volume type='file'> <name>cow.img</name> <storage> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> </storage> <target> - <format type="cow"/> + <format type='cow'/> </target> </volume> diff --git a/examples/xml/storage/vol-qcow.xml b/examples/xml/storage/vol-qcow.xml index af2011d..879cfcd 100644 --- a/examples/xml/storage/vol-qcow.xml +++ b/examples/xml/storage/vol-qcow.xml @@ -1,10 +1,10 @@ -<volume type="file"> +<volume type='file'> <name>qcow.img</name> <storage> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> </storage> <target> - <format type="qcow"/> + <format type='qcow'/> </target> </volume> diff --git a/examples/xml/storage/vol-qcow2.xml b/examples/xml/storage/vol-qcow2.xml index 9d944a7..7d806f5 100644 --- a/examples/xml/storage/vol-qcow2.xml +++ b/examples/xml/storage/vol-qcow2.xml @@ -1,10 +1,10 @@ -<volume type="file"> +<volume type='file'> <name>qcow2.img</name> <storage> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> </storage> <target> - <format type="qcow2"/> + <format type='qcow2'/> </target> </volume> diff --git a/examples/xml/storage/vol-raw.xml b/examples/xml/storage/vol-raw.xml index 59d4b45..8b08090 100644 --- a/examples/xml/storage/vol-raw.xml +++ b/examples/xml/storage/vol-raw.xml @@ -1,7 +1,7 @@ -<volume type="file"> +<volume type='file'> <name>raw.img</name> <storage> - <allocation unit="M">10</allocation> - <capacity unit="M">1000</capacity> + <allocation unit='M'>10</allocation> + <capacity unit='M'>1000</capacity> </storage> </volume> diff --git a/examples/xml/storage/vol-sparse.xml b/examples/xml/storage/vol-sparse.xml index c529a49..40e286a 100644 --- a/examples/xml/storage/vol-sparse.xml +++ b/examples/xml/storage/vol-sparse.xml @@ -1,7 +1,7 @@ -<volume type="file"> +<volume type='file'> <name>sparse.img</name> <storage> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> </storage> </volume> diff --git a/examples/xml/storage/vol-vmdk.xml b/examples/xml/storage/vol-vmdk.xml index 5af0a84..2aa8e0b 100644 --- a/examples/xml/storage/vol-vmdk.xml +++ b/examples/xml/storage/vol-vmdk.xml @@ -1,10 +1,10 @@ -<volume type="file"> +<volume type='file'> <name>vmdk3.img</name> <storage> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> </storage> <target> - <format type="vmdk"/> + <format type='vmdk'/> </target> </volume> diff --git a/examples/xml/test/testnode.xml b/examples/xml/test/testnode.xml index 001e353..ad02da5 100644 --- a/examples/xml/test/testnode.xml +++ b/examples/xml/test/testnode.xml @@ -7,14 +7,14 @@ virsh -c test://absolute/path/to/this/dir/testnode.xml nodeinfo --> - <domain file="testdomfv0.xml"/> - <domain file="testdomfc4.xml"/> - <network file="testnetpriv.xml"/> - <network file="testnetdef.xml"/> - <pool file="testpool.xml"> - <volume file="testvol.xml"/> + <domain file='testdomfv0.xml'/> + <domain file='testdomfc4.xml'/> + <network file='testnetpriv.xml'/> + <network file='testnetdef.xml'/> + <pool file='testpool.xml'> + <volume file='testvol.xml'/> </pool> - <device file="testdev.xml"/> + <device file='testdev.xml'/> <cpu> <mhz>6000</mhz> diff --git a/examples/xml/test/testnodeinline.xml b/examples/xml/test/testnodeinline.xml index b353f39..2de8773 100644 --- a/examples/xml/test/testnodeinline.xml +++ b/examples/xml/test/testnodeinline.xml @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version='1.0'?> <node> <!-- This file gives an example config for the mock 'test' backend driver to libvirt. This is intended to allow relible unit testing @@ -8,13 +8,13 @@ virsh -connect test:////path/to/this/dir/testnode.xml nodeinfo --> - <domain type="test"> + <domain type='test'> <name>fv0</name> <uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid> <os> <type>hvm</type> <loader>/usr/lib/xen/boot/hvmloader</loader> - <boot dev="hd"/> + <boot dev='hd'/> </os> <memory>524288</memory> <maxMemory>1524288</maxMemory> @@ -29,28 +29,28 @@ </features> <devices> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> - <interface type="bridge"> - <source bridge="xenbr0"/> - <mac address="00:16:3e:5d:c7:9e"/> - <script path="vif-bridge"/> + <interface type='bridge'> + <source bridge='xenbr0'/> + <mac address='00:16:3e:5d:c7:9e'/> + <script path='vif-bridge'/> </interface> - <disk type="file"> - <source file="/root/fv0"/> - <target dev="hda"/> + <disk type='file'> + <source file='/root/fv0'/> + <target dev='hda'/> </disk> - <disk type="file" device="cdrom"> - <source file="/root/fc5-x86_64-boot.iso"/> - <target dev="hdc"/> + <disk type='file' device='cdrom'> + <source file='/root/fc5-x86_64-boot.iso'/> + <target dev='hdc'/> <readonly/> </disk> - <disk type="file" device="floppy"> - <source file="/root/fd.img"/> - <target dev="fda"/> + <disk type='file' device='floppy'> + <source file='/root/fd.img'/> + <target dev='fda'/> </disk> - <graphics type="vnc" port="5904"/> + <graphics type='vnc' port='5904'/> </devices> </domain> - <domain type="test"> + <domain type='test'> <name>fc4</name> <uuid>EF86180145B911CB88E3AFBFE5370493</uuid> <os> @@ -64,36 +64,36 @@ <currentMemory>131072</currentMemory> <vcpu>1</vcpu> <devices> - <disk type="file"> - <source file="/u/fc4.img"/> - <target dev="sda1"/> + <disk type='file'> + <source file='/u/fc4.img'/> + <target dev='sda1'/> </disk> - <interface type="bridge"> - <source bridge="xenbr0"/> - <mac address="aa:00:00:00:00:11"/> - <script path="/etc/xen/scripts/vif-bridge"/> + <interface type='bridge'> + <source bridge='xenbr0'/> + <mac address='aa:00:00:00:00:11'/> + <script path='/etc/xen/scripts/vif-bridge'/> </interface> - <console tty="/dev/pts/5"/> + <console tty='/dev/pts/5'/> </devices> </domain> <network> <name>private</name> <uuid>004b22212d78c30f5aa5f03c87d21e69</uuid> - <bridge name="brpriv"/> - <ip address="192.168.124.1" netmask="255.255.255.0"> + <bridge name='brpriv'/> + <ip address='192.168.124.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.124.128" end="192.168.124.253"/> + <range start='192.168.124.128' end='192.168.124.253'/> </dhcp> </ip> </network> <network> <name>default</name> <uuid>004b96e12d78c30f5aa5f03c87d21e69</uuid> - <bridge name="brdefault"/> - <forward dev="eth0"/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <bridge name='brdefault'/> + <forward dev='eth0'/> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.128" end="192.168.122.253"/> + <range start='192.168.122.128' end='192.168.122.253'/> </dhcp> </ip> </network> diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index 7c18763..1c78de4 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -1,20 +1,20 @@ -<?xml version="1.0"?> +<?xml version='1.0'?> <api name='libvir-python'> <symbols> - <function name="virConnectGetVersion" file='python'> + <function name='virConnectGetVersion' file='python'> <info>Returns the running hypervisor version of the connection host</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='int' info="0 on success, -1 on error"/> + <return type='int' info='0 on success, -1 on error'/> </function> - <function name="virConnectGetLibVersion" file='python'> + <function name='virConnectGetLibVersion' file='python'> <info>Returns the libvirt version of the connection host</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='int' info="0 on success, -1 on error"/> + <return type='int' info='0 on success, -1 on error'/> </function> - <function name="virConnectListDomainsID" file='python'> + <function name='virConnectListDomainsID' file='python'> <info>Returns the list of the ID of the domains on the hypervisor</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> - <return type='int *' info="the list of ID or None in case of error"/> + <return type='int *' info='the list of ID or None in case of error'/> </function> <function name='virConnectListDefinedDomains' file='python'> <info>list the defined domains, stores the pointers to the names in @names</info> @@ -160,12 +160,12 @@ <return type='virDomainMemoryStats' info='a dictionary of statistics'/> <arg name='domain' type='virDomainPtr' info='a domain object'/> </function> - <function name="virNodeGetCellsFreeMemory" file='python'> + <function name='virNodeGetCellsFreeMemory' file='python'> <info>Returns the available memory for a list of cells</info> <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> <arg name='startCell' type='int' info='first cell in the list'/> <arg name='maxCells' type='int' info='number of cell in the list'/> - <return type='int *' info="the list available memory in the cells"/> + <return type='int *' info='the list available memory in the cells'/> </function> <function name='virDomainGetSchedulerParameters' file='python'> <info>Get the scheduler parameters, the @params array will be filled with the values.</info> @@ -374,7 +374,7 @@ <arg name='dom' type='virDomainPtr' info='dummy domain pointer'/> <arg name='snap' type='virDomainSnapshotPtr' info='pointer to the snapshot'/> <arg name='flags' type='unsigned int' info='flags'/> - <return type='int' info="0 on success, -1 on error"/> + <return type='int' info='0 on success, -1 on error'/> </function> <function name='virDomainGetBlockJobInfo' file='python'> <info>Get progress information for a block job</info> diff --git a/python/libvirt-qemu-override-api.xml b/python/libvirt-qemu-override-api.xml index d69acea..d4bce23 100644 --- a/python/libvirt-qemu-override-api.xml +++ b/python/libvirt-qemu-override-api.xml @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version='1.0'?> <api name='libvir-qemu-python'> <symbols> <function name='virDomainQemuMonitorCommand' file='python-qemu'> diff --git a/src/network/default.xml b/src/network/default.xml index 9cfc01e..2c44f13 100644 --- a/src/network/default.xml +++ b/src/network/default.xml @@ -1,10 +1,10 @@ <network> <name>default</name> - <bridge name="virbr0" /> + <bridge name='virbr0' /> <forward/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> + <range start='192.168.122.2' end='192.168.122.254' /> </dhcp> </ip> </network> diff --git a/tests/networkxml2argvdata/nat-network-dns-hosts.xml b/tests/networkxml2argvdata/nat-network-dns-hosts.xml index 2180a5d..cbde112 100644 --- a/tests/networkxml2argvdata/nat-network-dns-hosts.xml +++ b/tests/networkxml2argvdata/nat-network-dns-hosts.xml @@ -3,7 +3,7 @@ <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9c</uuid> <forward dev='eth0' mode='nat'/> <bridge name='virbr0' stp='on' delay='0' /> - <domain name="example.com"/> + <domain name='example.com'/> <dns> <host ip='192.168.122.1'> <hostname>host</hostname> diff --git a/tests/networkxml2xmlin/8021Qbh-net.xml b/tests/networkxml2xmlin/8021Qbh-net.xml index 2d779dc..33930d5 100644 --- a/tests/networkxml2xmlin/8021Qbh-net.xml +++ b/tests/networkxml2xmlin/8021Qbh-net.xml @@ -1,14 +1,14 @@ <network> <name>8021Qbh-net</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8c</uuid> - <forward mode="private" dev="eth1"> - <interface dev="eth1"/> - <interface dev="eth2"/> - <interface dev="eth3"/> - <interface dev="eth4"/> - <interface dev="eth5"/> + <forward mode='private' dev='eth1'> + <interface dev='eth1'/> + <interface dev='eth2'/> + <interface dev='eth3'/> + <interface dev='eth4'/> + <interface dev='eth5'/> </forward> - <virtualport type="802.1Qbh"> - <parameters profileid="spongebob24"/> + <virtualport type='802.1Qbh'> + <parameters profileid='spongebob24'/> </virtualport> </network> diff --git a/tests/networkxml2xmlin/direct-net.xml b/tests/networkxml2xmlin/direct-net.xml index d73c454..86e1206 100644 --- a/tests/networkxml2xmlin/direct-net.xml +++ b/tests/networkxml2xmlin/direct-net.xml @@ -1,7 +1,7 @@ <network> <name>direct-net</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8f</uuid> - <forward mode="bridge"> - <interface dev="eth10"/> + <forward mode='bridge'> + <interface dev='eth10'/> </forward> </network> diff --git a/tests/networkxml2xmlin/host-bridge-net.xml b/tests/networkxml2xmlin/host-bridge-net.xml index 960bc2d..c76d64a 100644 --- a/tests/networkxml2xmlin/host-bridge-net.xml +++ b/tests/networkxml2xmlin/host-bridge-net.xml @@ -1,6 +1,6 @@ <network> <name>host-bridge-net</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8e</uuid> - <forward mode="bridge"/> - <bridge name="br0"/> + <forward mode='bridge'/> + <bridge name='br0'/> </network> diff --git a/tests/networkxml2xmlin/isolated-network.xml b/tests/networkxml2xmlin/isolated-network.xml index 0d562ea..ec9e4e2 100644 --- a/tests/networkxml2xmlin/isolated-network.xml +++ b/tests/networkxml2xmlin/isolated-network.xml @@ -1,11 +1,11 @@ <network> <name>private</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr2" /> + <bridge name='virbr2' /> <mac address='52:54:00:17:3F:37'/> - <ip address="192.168.152.1" netmask="255.255.255.0"> + <ip address='192.168.152.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.152.2" end="192.168.152.254" /> + <range start='192.168.152.2' end='192.168.152.254' /> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/nat-network.xml b/tests/networkxml2xmlin/nat-network.xml index 23f7fcb..1f1c605 100644 --- a/tests/networkxml2xmlin/nat-network.xml +++ b/tests/networkxml2xmlin/nat-network.xml @@ -1,21 +1,21 @@ <network> <name>default</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr0" /> - <forward mode="nat" dev="eth1"/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <bridge name='virbr0' /> + <forward mode='nat' dev='eth1'/> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> - <host mac="00:16:3e:77:e2:ed" name="a.example.com" ip="192.168.122.10" /> - <host mac="00:16:3e:3e:a9:1a" name="b.example.com" ip="192.168.122.11" /> + <range start='192.168.122.2' end='192.168.122.254' /> + <host mac='00:16:3e:77:e2:ed' name='a.example.com' ip='192.168.122.10' /> + <host mac='00:16:3e:3e:a9:1a' name='b.example.com' ip='192.168.122.11' /> </dhcp> </ip> - <ip family="ipv4" address="192.168.123.1" netmask="255.255.255.0"> + <ip family='ipv4' address='192.168.123.1' netmask='255.255.255.0'> </ip> - <ip family="ipv6" address="2001:db8:ac10:fe01::1" prefix="64"> + <ip family='ipv6' address='2001:db8:ac10:fe01::1' prefix='64'> </ip> - <ip family="ipv6" address="2001:db8:ac10:fd01::1" prefix="64"> + <ip family='ipv6' address='2001:db8:ac10:fd01::1' prefix='64'> </ip> - <ip family="ipv4" address="10.24.10.1"> + <ip family='ipv4' address='10.24.10.1'> </ip> </network> diff --git a/tests/networkxml2xmlin/netboot-network.xml b/tests/networkxml2xmlin/netboot-network.xml index ed75663..d6b842c 100644 --- a/tests/networkxml2xmlin/netboot-network.xml +++ b/tests/networkxml2xmlin/netboot-network.xml @@ -1,14 +1,14 @@ <network> <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr1" stp='off' delay='1'/> - <domain name="example.com"/> + <bridge name='virbr1' stp='off' delay='1'/> + <domain name='example.com'/> <forward/> - <ip address="192.168.122.1" netmask="255.255.255.0"> - <tftp root="/var/lib/tftproot" /> + <ip address='192.168.122.1' netmask='255.255.255.0'> + <tftp root='/var/lib/tftproot' /> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> - <bootp file="pxeboot.img" /> + <range start='192.168.122.2' end='192.168.122.254' /> + <bootp file='pxeboot.img' /> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/netboot-proxy-network.xml b/tests/networkxml2xmlin/netboot-proxy-network.xml index ecb6738..f07a4b2 100644 --- a/tests/networkxml2xmlin/netboot-proxy-network.xml +++ b/tests/networkxml2xmlin/netboot-proxy-network.xml @@ -1,13 +1,13 @@ <network> <name>netboot</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr1" stp='off' delay='1'/> - <domain name="example.com"/> + <bridge name='virbr1' stp='off' delay='1'/> + <domain name='example.com'/> <forward/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> - <bootp file="pxeboot.img" server="10.20.30.40" /> + <range start='192.168.122.2' end='192.168.122.254' /> + <bootp file='pxeboot.img' server='10.20.30.40' /> </dhcp> </ip> </network> diff --git a/tests/networkxml2xmlin/routed-network.xml b/tests/networkxml2xmlin/routed-network.xml index 61d73c0..5e47038 100644 --- a/tests/networkxml2xmlin/routed-network.xml +++ b/tests/networkxml2xmlin/routed-network.xml @@ -1,9 +1,9 @@ <network> <name>local</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a9b</uuid> - <bridge name="virbr1" /> + <bridge name='virbr1' /> <mac address='12:34:56:78:9A:BC'/> - <forward mode="route" dev="eth1"/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <forward mode='route' dev='eth1'/> + <ip address='192.168.122.1' netmask='255.255.255.0'> </ip> </network> diff --git a/tests/networkxml2xmlin/vepa-net.xml b/tests/networkxml2xmlin/vepa-net.xml index b1a40c6..5672ed3 100644 --- a/tests/networkxml2xmlin/vepa-net.xml +++ b/tests/networkxml2xmlin/vepa-net.xml @@ -1,22 +1,22 @@ <network> <name>vepa-net</name> <uuid>81ff0d90-c91e-6742-64da-4a736edb9a8b</uuid> - <forward mode="vepa"> - <interface dev="eth1"/> - <interface dev="eth2"/> - <interface dev="eth3"/> + <forward mode='vepa'> + <interface dev='eth1'/> + <interface dev='eth2'/> + <interface dev='eth3'/> </forward> - <virtualport type="802.1Qbg"> - <parameters managerid="11" typeid="1193047" typeidversion="2" instanceid="b153fa89-1b87-9719-ec12-99e0054fb844"/> + <virtualport type='802.1Qbg'> + <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='b153fa89-1b87-9719-ec12-99e0054fb844'/> </virtualport> - <portgroup name="bob" default="yes"> - <virtualport type="802.1Qbg"> - <parameters managerid="12" typeid="2193047" typeidversion="3" instanceid="5d00e0ba-e15c-959c-fbb6-b595b0655735"/> + <portgroup name='bob' default='yes'> + <virtualport type='802.1Qbg'> + <parameters managerid='12' typeid='2193047' typeidversion='3' instanceid='5d00e0ba-e15c-959c-fbb6-b595b0655735'/> </virtualport> </portgroup> - <portgroup name="alice"> - <virtualport type="802.1Qbg"> - <parameters managerid="13" typeid="3193047" typeidversion="4" instanceid="70bf45f9-01a8-f5ee-3c0f-e25a0a2e44a6"/> + <portgroup name='alice'> + <virtualport type='802.1Qbg'> + <parameters managerid='13' typeid='3193047' typeidversion='4' instanceid='70bf45f9-01a8-f5ee-3c0f-e25a0a2e44a6'/> </virtualport> </portgroup> </network> diff --git a/tests/nwfilterxml2xmlin/stp-test.xml b/tests/nwfilterxml2xmlin/stp-test.xml index de9d3e2..3056df8 100644 --- a/tests/nwfilterxml2xmlin/stp-test.xml +++ b/tests/nwfilterxml2xmlin/stp-test.xml @@ -8,14 +8,14 @@ <rule action='return' direction='out'> <stp srcmacaddr='1:2:3:4:5:6' srcmacmask='ff:ff:ff:ff:ff:ff' root-priority='0x1234' root-priority-hi='0x2345' - root-address="6:5:4:3:2:1" root-address-mask='ff:ff:ff:ff:ff:ff' + root-address='6:5:4:3:2:1' root-address-mask='ff:ff:ff:ff:ff:ff' root-cost='0x11223344' root-cost-hi='0x22334455' /> </rule> <rule action='reject' direction='in'> <stp srcmacaddr='1:2:3:4:5:6' srcmacmask='ff:ff:ff:ff:ff:ff' sender-priority='0x1234' - sender-address="6:5:4:3:2:1" + sender-address='6:5:4:3:2:1' port='123' port-hi='234' age='5544' age-hi='5555' max-age='7777' max-age-hi='8888' diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml index 9fcdda8..de03711 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa1.xml @@ -9,10 +9,10 @@ <boot dev='network'/> </os> <cpu> - <topology sockets="2" cores="4" threads="2"/> + <topology sockets='2' cores='4' threads='2'/> <numa> - <cell cpus="0-7" memory="109550"/> - <cell cpus="8-15" memory="109550"/> + <cell cpus='0-7' memory='109550'/> + <cell cpus='8-15' memory='109550'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml index 9fcdda8..de03711 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-numa2.xml @@ -9,10 +9,10 @@ <boot dev='network'/> </os> <cpu> - <topology sockets="2" cores="4" threads="2"/> + <topology sockets='2' cores='4' threads='2'/> <numa> - <cell cpus="0-7" memory="109550"/> - <cell cpus="8-15" memory="109550"/> + <cell cpus='0-7' memory='109550'/> + <cell cpus='8-15' memory='109550'/> </numa> </cpu> <clock offset='utc'/> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml index 6b37207..7530950 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology1.xml @@ -9,7 +9,7 @@ <boot dev='network'/> </os> <cpu> - <topology sockets="3" cores="2" threads="1"/> + <topology sockets='3' cores='2' threads='1'/> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml index 9f09e81..904d4fe 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology2.xml @@ -10,7 +10,7 @@ </os> <cpu match='exact'> <model>core2duo</model> - <topology sockets="1" cores="2" threads="3"/> + <topology sockets='1' cores='2' threads='3'/> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml index 6b37207..7530950 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-cpu-topology3.xml @@ -9,7 +9,7 @@ <boot dev='network'/> </os> <cpu> - <topology sockets="3" cores="2" threads="1"/> + <topology sockets='3' cores='2' threads='1'/> </cpu> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml index 66ec6d0..dff63e4 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml @@ -5,7 +5,7 @@ <currentMemory>219136</currentMemory> <vcpu>2</vcpu> <numatune> - <memory mode="strict" nodeset="0-5,^4"/> + <memory mode='strict' nodeset='0-5,^4'/> </numatune> <os> <type arch='i686' machine='pc'>hvm</type> diff --git a/tests/storagepoolxml2xmlin/pool-iscsi-auth.xml b/tests/storagepoolxml2xmlin/pool-iscsi-auth.xml index f7d4d52..f0755bf 100644 --- a/tests/storagepoolxml2xmlin/pool-iscsi-auth.xml +++ b/tests/storagepoolxml2xmlin/pool-iscsi-auth.xml @@ -2,8 +2,8 @@ <name>virtimages</name> <uuid>e9392370-2917-565e-692b-d057f46512d6</uuid> <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> <auth type='chap' login='foobar' passwd='frobbar'/> </source> <target> diff --git a/tests/storagepoolxml2xmlin/pool-iscsi-vendor-product.xml b/tests/storagepoolxml2xmlin/pool-iscsi-vendor-product.xml index 01fbd9b..3889464 100644 --- a/tests/storagepoolxml2xmlin/pool-iscsi-vendor-product.xml +++ b/tests/storagepoolxml2xmlin/pool-iscsi-vendor-product.xml @@ -2,8 +2,8 @@ <name>virtimages</name> <uuid>e9392370-2917-565e-692b-d057f46512d6</uuid> <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> <auth type='chap' login='foobar' passwd='frobbar'/> <vendor name='test-vendor'/> <product name='test-product'/> diff --git a/tests/storagepoolxml2xmlin/pool-iscsi.xml b/tests/storagepoolxml2xmlin/pool-iscsi.xml index 37a16f7..c22b02e 100644 --- a/tests/storagepoolxml2xmlin/pool-iscsi.xml +++ b/tests/storagepoolxml2xmlin/pool-iscsi.xml @@ -2,8 +2,8 @@ <name>virtimages</name> <uuid>e9392370-2917-565e-692b-d057f46512d6</uuid> <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> </source> <target> <path>/dev/disk/by-path</path> diff --git a/tests/storagepoolxml2xmlin/pool-logical-create.xml b/tests/storagepoolxml2xmlin/pool-logical-create.xml index 4c67089..9b3a6f3 100644 --- a/tests/storagepoolxml2xmlin/pool-logical-create.xml +++ b/tests/storagepoolxml2xmlin/pool-logical-create.xml @@ -5,9 +5,9 @@ <allocation>99220455424</allocation> <available>671088640</available> <source> - <device path="/dev/sdb1"/> - <device path="/dev/sdb2"/> - <device path="/dev/sdb3"/> + <device path='/dev/sdb1'/> + <device path='/dev/sdb2'/> + <device path='/dev/sdb3'/> </source> <target> <path>/dev/HostVG</path> diff --git a/tests/storagepoolxml2xmlin/pool-mpath.xml b/tests/storagepoolxml2xmlin/pool-mpath.xml index a5fbbcb..7144cc3 100644 --- a/tests/storagepoolxml2xmlin/pool-mpath.xml +++ b/tests/storagepoolxml2xmlin/pool-mpath.xml @@ -1,4 +1,4 @@ -<pool type="mpath"> +<pool type='mpath'> <name>mpath</name> <uuid>e9392370-2917-565e-692b-d057f46512d6</uuid> <target> diff --git a/tests/storagepoolxml2xmlin/pool-scsi.xml b/tests/storagepoolxml2xmlin/pool-scsi.xml index 3650e43..85720d0 100644 --- a/tests/storagepoolxml2xmlin/pool-scsi.xml +++ b/tests/storagepoolxml2xmlin/pool-scsi.xml @@ -1,8 +1,8 @@ -<pool type="scsi"> +<pool type='scsi'> <name>hba0</name> <uuid>e9392370-2917-565e-692b-d057f46512d6</uuid> <source> - <adapter name="host0"/> + <adapter name='host0'/> </source> <target> <path>/dev/disk/by-path</path> diff --git a/tests/storagevolxml2xmlin/vol-file.xml b/tests/storagevolxml2xmlin/vol-file.xml index d7de0aa..f9a3635 100644 --- a/tests/storagevolxml2xmlin/vol-file.xml +++ b/tests/storagevolxml2xmlin/vol-file.xml @@ -1,7 +1,7 @@ <volume> <name>sparse.img</name> <source/> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> <allocation>0</allocation> <target> <path>/var/lib/libvirt/images/sparse.img</path> diff --git a/tests/storagevolxml2xmlin/vol-qcow2.xml b/tests/storagevolxml2xmlin/vol-qcow2.xml index b4924de..22ce6a0 100644 --- a/tests/storagevolxml2xmlin/vol-qcow2.xml +++ b/tests/storagevolxml2xmlin/vol-qcow2.xml @@ -3,7 +3,7 @@ <key>/var/lib/libvirt/images/OtherDemo.img</key> <source> </source> - <capacity unit="G">5</capacity> + <capacity unit='G'>5</capacity> <allocation>294912</allocation> <target> <path>/var/lib/libvirt/images/OtherDemo.img</path> diff --git a/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml index 83daf82..73cfda7 100644 --- a/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml +++ b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml @@ -17,12 +17,12 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <interface type="bridge"> - <mac address="00:11:22:33:44:55"/> - <source bridge="xenbr2"/> - <ip address="192.0.2.1"/> - <script path="vif-bridge"/> - <target dev="vif4.0"/> + <interface type='bridge'> + <mac address='00:11:22:33:44:55'/> + <source bridge='xenbr2'/> + <ip address='192.0.2.1'/> + <script path='vif-bridge'/> + <target dev='vif4.0'/> </interface> <console tty='/dev/pts/4'/> </devices> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml index 97d88e0..1cdc850 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blkback.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='block' device='disk'> - <driver name="phy"/> + <driver name='phy'/> <source dev='/dev/MainVG/GuestLV'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml index 008658c..91e22c7 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-qcow.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="tap" type="qcow"/> + <driver name='tap' type='qcow'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml index 630b3f9..218a8e4 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap-raw.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="tap" type="aio"/> + <driver name='tap' type='aio'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml index 324b6d0..4b9a88b 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="tap"/> + <driver name='tap'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2-raw.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2-raw.xml index 0cc37cc..6a18368 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2-raw.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2-raw.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="tap2" type="aio"/> + <driver name='tap2' type='aio'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml index 67cce17..44d0ee7 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-blktap2.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="tap2"/> + <driver name='tap2'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml b/tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml index 978ca7c..cd5d7cc 100644 --- a/tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml +++ b/tests/xml2sexprdata/xml2sexpr-disk-drv-loop.xml @@ -14,7 +14,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='file' device='disk'> - <driver name="file"/> + <driver name='file'/> <source file='/root/some.img'/> <target dev='xvda'/> </disk> diff --git a/tests/xml2sexprdata/xml2sexpr-escape.xml b/tests/xml2sexprdata/xml2sexpr-escape.xml index 6eed578..bca2c81 100644 --- a/tests/xml2sexprdata/xml2sexpr-escape.xml +++ b/tests/xml2sexprdata/xml2sexpr-escape.xml @@ -5,7 +5,7 @@ <type>hvm</type> <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel> <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd> - <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> <loader>/usr/lib/xen/boot/hvmloader</loader> </os> <memory>430080</memory> diff --git a/tests/xml2sexprdata/xml2sexpr-net-bridged.xml b/tests/xml2sexprdata/xml2sexpr-net-bridged.xml index 5f68a6d..80a91ac 100644 --- a/tests/xml2sexprdata/xml2sexpr-net-bridged.xml +++ b/tests/xml2sexprdata/xml2sexpr-net-bridged.xml @@ -17,11 +17,11 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <interface type="bridge"> - <mac address="00:11:22:33:44:55"/> - <source bridge="xenbr2"/> - <script path="vif-bridge"/> - <target dev="vif4.0"/> + <interface type='bridge'> + <mac address='00:11:22:33:44:55'/> + <source bridge='xenbr2'/> + <script path='vif-bridge'/> + <target dev='vif4.0'/> </interface> <console tty='/dev/pts/4'/> </devices> diff --git a/tests/xml2sexprdata/xml2sexpr-net-e1000.xml b/tests/xml2sexprdata/xml2sexpr-net-e1000.xml index 6e9ce94..3916d54 100644 --- a/tests/xml2sexprdata/xml2sexpr-net-e1000.xml +++ b/tests/xml2sexprdata/xml2sexpr-net-e1000.xml @@ -17,12 +17,12 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <interface type="bridge"> - <mac address="00:11:22:33:44:55"/> - <source bridge="xenbr2"/> - <script path="vif-bridge"/> + <interface type='bridge'> + <mac address='00:11:22:33:44:55'/> + <source bridge='xenbr2'/> + <script path='vif-bridge'/> <model type='e1000'/> - <target dev="vif4.0"/> + <target dev='vif4.0'/> </interface> <console tty='/dev/pts/4'/> </devices> diff --git a/tests/xml2sexprdata/xml2sexpr-net-routed.xml b/tests/xml2sexprdata/xml2sexpr-net-routed.xml index 778c911..1fa24e6 100644 --- a/tests/xml2sexprdata/xml2sexpr-net-routed.xml +++ b/tests/xml2sexprdata/xml2sexpr-net-routed.xml @@ -17,12 +17,12 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <interface type="ethernet"> - <mac address="00:11:22:33:44:55"/> - <ip address="172.14.5.6"/> - <source dev="eth3"/> - <script path="vif-routed"/> - <target dev="vif4.0"/> + <interface type='ethernet'> + <mac address='00:11:22:33:44:55'/> + <ip address='172.14.5.6'/> + <source dev='eth3'/> + <script path='vif-routed'/> + <target dev='vif4.0'/> </interface> <console tty='/dev/pts/4'/> </devices> diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml index c17d9d5..ec12fb3 100644 --- a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml +++ b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new-auto.xml @@ -18,6 +18,6 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <graphics type='vnc' port='-1' autoport='yes' listen="127.0.0.1" passwd="123456" keymap="ja"/> + <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' passwd='123456' keymap='ja'/> </devices> </domain> diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml index a8430eb..5b0d19a 100644 --- a/tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml +++ b/tests/xml2sexprdata/xml2sexpr-pv-vfb-new.xml @@ -18,6 +18,6 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <graphics type='vnc' port='5906' listen="127.0.0.1" passwd="123456" keymap="ja"/> + <graphics type='vnc' port='5906' listen='127.0.0.1' passwd='123456' keymap='ja'/> </devices> </domain> diff --git a/tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml b/tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml index a8430eb..5b0d19a 100644 --- a/tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml +++ b/tests/xml2sexprdata/xml2sexpr-pv-vfb-orig.xml @@ -18,6 +18,6 @@ <source file='/root/some.img'/> <target dev='xvda'/> </disk> - <graphics type='vnc' port='5906' listen="127.0.0.1" passwd="123456" keymap="ja"/> + <graphics type='vnc' port='5906' listen='127.0.0.1' passwd='123456' keymap='ja'/> </devices> </domain> diff --git a/tests/xml2vmxdata/xml2vmx-serial-network-client.xml b/tests/xml2vmxdata/xml2vmx-serial-network-client.xml index e2a5afe..a40b135 100644 --- a/tests/xml2vmxdata/xml2vmx-serial-network-client.xml +++ b/tests/xml2vmxdata/xml2vmx-serial-network-client.xml @@ -7,8 +7,8 @@ </os> <devices> <serial type='tcp'> - <source mode="connect" host="192.168.0.17" service="42001"/> - <protocol type="raw"/> + <source mode='connect' host='192.168.0.17' service='42001'/> + <protocol type='raw'/> <target port='0'/> </serial> </devices> diff --git a/tests/xml2vmxdata/xml2vmx-serial-network-server.xml b/tests/xml2vmxdata/xml2vmx-serial-network-server.xml index a17e2fe..2d33073 100644 --- a/tests/xml2vmxdata/xml2vmx-serial-network-server.xml +++ b/tests/xml2vmxdata/xml2vmx-serial-network-server.xml @@ -7,8 +7,8 @@ </os> <devices> <serial type='tcp'> - <source mode="bind" host="0.0.0.0" service="42001"/> - <protocol type="tls"/> + <source mode='bind' host='0.0.0.0' service='42001'/> + <protocol type='tls'/> <target port='0'/> </serial> </devices> -- 1.7.7.3

See the previous patch for rationale. Done with: $ find docs -name '*.rng' | \ xargs sed -i 's/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g' * cfg.mk (sc_rng_quote_style): Extend the rule. * docs/schemas/*.rng: Fix fallout. --- Alas, this diffstat is too big to send to the list uncompressed; I've trimmed the email to the most important part of the patch. cfg.mk | 2 +- docs/schemas/basictypes.rng | 128 ++-- docs/schemas/capability.rng | 20 +- docs/schemas/domain.rng | 6 +- docs/schemas/domaincommon.rng | 1718 ++++++++++++++++++------------------ docs/schemas/domainsnapshot.rng | 6 +- docs/schemas/interface.rng | 272 +++--- docs/schemas/network.rng | 114 ++-- docs/schemas/networkcommon.rng | 84 +- docs/schemas/nodedev.rng | 42 +- docs/schemas/nwfilter.rng | 936 ++++++++++---------- docs/schemas/secret.rng | 4 +- docs/schemas/storageencryption.rng | 6 +- docs/schemas/storagepool.rng | 24 +- docs/schemas/storagevol.rng | 22 +- 15 files changed, 1692 insertions(+), 1692 deletions(-) diff --git a/cfg.mk b/cfg.mk index c964c27..30c838b 100644 --- a/cfg.mk +++ b/cfg.mk @@ -422,7 +422,7 @@ sc_TAB_in_indentation: # In xml files, prefer name='abc' over name="abc" sc_rng_quote_style: @prohibit='\b[-a-zA-Z0-9_]+="' \ - in_vc_files='\.(xml)$$' \ + in_vc_files='\.(rng|xml)$$' \ halt='use name='\'val\'', not name="val", in xml' \ $(_sc_search_regexp) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 3b4b952..be29be9 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -1,135 +1,135 @@ -<?xml version="1.0"?> +<?xml version='1.0'?> <!-- network-related definitions used in multiple grammars --> -<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> +<grammar xmlns='http://relaxng.org/ns/structure/1.0' datatypeLibrary='http://www.w3.org/2001/XMLSchema-datatypes'> <!-- Our unsignedInt doesn"t allow a leading "+" in its lexical form --> - <define name="unsignedInt"> - <data type="unsignedInt"> - <param name="pattern">[0-9]+</param> + <define name='unsignedInt'> + <data type='unsignedInt'> + <param name='pattern'>[0-9]+</param> </data> </define> .... [ rest of patch is entirely mechanical, per the instructions in the commit message ] -- 1.7.7.3

On Mon, Dec 05, 2011 at 02:48:31PM -0700, Eric Blake wrote:
See the previous patch for rationale. Done with:
$ find docs -name '*.rng' | \ xargs sed -i 's/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g'
* cfg.mk (sc_rng_quote_style): Extend the rule. * docs/schemas/*.rng: Fix fallout. ---
Alas, this diffstat is too big to send to the list uncompressed; I've trimmed the email to the most important part of the patch.
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 12/05/2011 02:48 PM, Eric Blake wrote:
According to the official XML specification [1], attributes can be specified with either ' or " (where the difference is that you can use '"' or '"' but must use """, and conversely for "'" or "'" vs. '''). But our code generation in src/conf prefers to output the '' notation, as it is easier to write C string literals for that style. Using a consistent style throughout libvirt will make it easier for users to copy-and-paste without wondering why we switch quoting styles mid-stream.
[1] http://www.w3.org/TR/xml11/#NT-Reference
Mechanical conversion done with:
$ find -name '*.xml' | \ xargs sed -i 's/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g'
followed by inspecting the results, and touching up the change in tests/xml2sexprdata/xml2sexpr-escape.xml to fix 'make check'.
* cfg.mk (sc_rng_quote_style): Enforce the rule. * examples/xml/storage/*.xml: Fix fallout. * examples/xml/test/*.xml: Likewise. * python/libvirt-*override-api.xml: Likewise. * src/network/default.xml: Likewise. * tests/*/*.xml: Likewise.
I also meant to say: Proposed for post-0.9.8 (no need for this much churn pre-release). Also,
+# In xml files, prefer name='abc' over name="abc" +sc_rng_quote_style: + @prohibit='\b[-a-zA-Z0-9_]+="' \ + in_vc_files='\.(xml)$$' \ + halt='use name='\'val\'', not name="val", in xml' \ + $(_sc_search_regexp)
This rule is poorly named; it should be sc_xml_quote_style. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

See the previous patch for rationale. Done with: $ find docs -name '*.html.in' | \ xargs sed -i '/</ s/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g' * cfg.mk (sc_xml_quote_style): Extend the rule. * docs/*.html.in: Fix fallout. --- I'm not as worried about the overall html file being a consistent style as I am the html-ized example texts. The change was intentionally limited to lines starting with '<', to minimize the size of the diff, even if it did pick up a few changes that aren't user-visible. cfg.mk | 4 + docs/csharp.html.in | 2 +- docs/drvqemu.html.in | 4 +- docs/drvvbox.html.in | 12 ++-- docs/drvxen.html.in | 4 +- docs/formatcaps.html.in | 18 +++--- docs/formatdomain.html.in | 124 +++++++++++++++++----------------- docs/formatnetwork.html.in | 74 ++++++++++---------- docs/formatstorage.html.in | 22 +++--- docs/formatstorageencryption.html.in | 2 +- docs/news.html.in | 2 +- docs/storage.html.in | 34 +++++----- 12 files changed, 153 insertions(+), 149 deletions(-) diff --git a/cfg.mk b/cfg.mk index 8591f12..c0d638b 100644 --- a/cfg.mk +++ b/cfg.mk @@ -425,6 +425,10 @@ sc_xml_quote_style: in_vc_files='\.(rng|xml)$$' \ halt='use name='\'val\'', not name="val", in xml' \ $(_sc_search_regexp) + @prohibit='<.*\b[-a-zA-Z0-9_]+="' \ + in_vc_files='\.html\.in$$' \ + halt='use name='\'val\'', not name="val", in html-ized xml' \ + $(_sc_search_regexp) ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\ |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper diff --git a/docs/csharp.html.in b/docs/csharp.html.in index 62da6a8..8d664e7 100644 --- a/docs/csharp.html.in +++ b/docs/csharp.html.in @@ -121,7 +121,7 @@ git clone git://libvirt.org/libvirt-csharp.git <p> The C# bindings are the work of Arnaud Champion - <<a href="mailto:arnaud.champion AT devatom.fr">arnaud.champion AT devatom.fr</a>>, + <<a href='mailto:arnaud.champion AT devatom.fr'>arnaud.champion AT devatom.fr</a>>, based upon the previous work of Jaromír Červenka. </p> diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in index 4da3817..97e1df5 100644 --- a/docs/drvqemu.html.in +++ b/docs/drvqemu.html.in @@ -553,9 +553,9 @@ $ virsh domxml-to-native qemu-argv demo.xml <memory>131072</memory> <vcpu>1</vcpu> <os> - <type arch="i686">hvm</type> + <type arch='i686'>hvm</type> </os> - <clock sync="localtime"/> + <clock sync='localtime'/> <devices> <emulator>/usr/bin/qemu-kvm</emulator> <disk type='file' device='disk'> diff --git a/docs/drvvbox.html.in b/docs/drvvbox.html.in index db82d2a..4d3b551 100644 --- a/docs/drvvbox.html.in +++ b/docs/drvvbox.html.in @@ -100,14 +100,14 @@ vbox+ssh://user@example.com/session (remote access, SSH tunnelled) <target port='1'/> </parallel> - <serial type="dev"> - <source path="/dev/ttyS0"/> - <target port="0"/> + <serial type='dev'> + <source path='/dev/ttyS0'/> + <target port='0'/> </serial> - <serial type="pipe"> - <source path="/tmp/serial.txt"/> - <target port="1"/> + <serial type='pipe'> + <source path='/tmp/serial.txt'/> + <target port='1'/> </serial> <hostdev mode='subsystem' type='usb'> diff --git a/docs/drvxen.html.in b/docs/drvxen.html.in index 631f7ed..6d6a70a 100644 --- a/docs/drvxen.html.in +++ b/docs/drvxen.html.in @@ -247,7 +247,7 @@ vif = [ "mac=00:16:3e:60:36:ba,bridge=virbr0,script=vif-bridge,vifname=vif5.0" ] <acpi/> <apic/> </features> - <clock sync="localtime"/> + <clock sync='localtime'/> <devices> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> <interface type='bridge'> @@ -301,7 +301,7 @@ vif = [ "mac=00:16:3e:60:36:ba,bridge=virbr0,script=vif-bridge,vifname=vif5.0" ] <acpi/> <apic/> </features> - <clock sync="localtime"/> + <clock sync='localtime'/> <devices> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> <interface type='bridge'> diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in index 9d42426..0538eba 100644 --- a/docs/formatcaps.html.in +++ b/docs/formatcaps.html.in @@ -15,7 +15,7 @@ associated to the current connection. For example in the case of a 64 bits machine with hardware virtualization capabilities enabled in the chip and BIOS you will see</p> <pre><capabilities> - <span style="color: #E50000"><host> + <span style='color: #E50000'><host> <cpu> <arch>x86_64</arch> <features> @@ -23,8 +23,8 @@ BIOS you will see</p> </features> <model>core2duo</model> <vendor>Intel</vendor> - <topology sockets="1" cores="2" threads="1"/> - <feature name="lahf_lm"/> + <topology sockets='1' cores='2' threads='1'/> + <feature name='lahf_lm'/> <feature name='xtpr'/> ... </cpu> @@ -36,11 +36,11 @@ BIOS you will see</p> </host></span> <!-- xen-3.0-x86_64 --> - <span style="color: #0000E5"><guest> + <span style='color: #0000E5'><guest> <os_type>xen</os_type> - <arch name="x86_64"> + <arch name='x86_64'> <wordsize>64</wordsize> - <domain type="xen"></domain> + <domain type='xen'></domain> <emulator>/usr/lib64/xen/bin/qemu-dm</emulator> </arch> <features> @@ -48,11 +48,11 @@ BIOS you will see</p> </guest></span> <!-- hvm-3.0-x86_32 --> - <span style="color: #00B200"><guest> + <span style='color: #00B200'><guest> <os_type>hvm</os_type> - <arch name="i686"> + <arch name='i686'> <wordsize>32</wordsize> - <domain type="xen"></domain> + <domain type='xen'></domain> <emulator>/usr/lib/xen/bin/qemu-dm</emulator> <machine>pc</machine> <machine>isapc</machine> diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 204373e..2141de4 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -287,7 +287,7 @@ <pre> <domain> ... - <vcpu cpuset="1-4,^3,6" current="1">2</vcpu> + <vcpu cpuset='1-4,^3,6' current='1'>2</vcpu> ... </domain> </pre> @@ -316,10 +316,10 @@ <domain> ... <cputune> - <vcpupin vcpu="0" cpuset="1-4,^2"/> - <vcpupin vcpu="1" cpuset="0,1"/> - <vcpupin vcpu="2" cpuset="2,3"/> - <vcpupin vcpu="3" cpuset="0,4"/> + <vcpupin vcpu='0' cpuset='1-4,^2'/> + <vcpupin vcpu='1' cpuset='0,1'/> + <vcpupin vcpu='2' cpuset='2,3'/> + <vcpupin vcpu='3' cpuset='0,4'/> <shares>2048</shares> <period>1000000</period> <quota>-1</quota> @@ -473,7 +473,7 @@ <domain> ... <numatune> - <memory mode="strict" nodeset="1-4,^3"/> + <memory mode='strict' nodeset='1-4,^3'/> </numatune> ... </domain> @@ -537,7 +537,7 @@ the same host file system, which is why this tuning parameter is at the global domain level rather than associated with each guest disk device (contrast this to - the <a href="#elementsDisks"><code><iotune></code></a> + the <a href='#elementsDisks'><code><iotune></code></a> element which can apply to an individual <code><disk></code>). Each <code>device</code> element has two @@ -798,11 +798,11 @@ <pre> ... - <clock offset="localtime"> - <timer name="rtc" tickpolicy="catchup" track="guest"> + <clock offset='localtime'> + <timer name='rtc' tickpolicy='catchup' track='guest'> <catchup threshold=123 slew=120 limit=10000/> </timer> - <timer name="pit" tickpolicy="delay"/> + <timer name='pit' tickpolicy='delay'/> </clock> ...</pre> @@ -946,7 +946,7 @@ ... <devices> <disk type='file' snapshot='external'> - <driver name="tap" type="aio" cache="default"/> + <driver name='tap' type='aio' cache='default'/> <source file='/var/lib/xen/images/fv0'/ startupPolicy='optional'> <target dev='hda' bus='ide'/> <iotune> @@ -965,21 +965,21 @@ </disk> ... <disk type='network'> - <driver name="qemu" type="raw" io="threads" ioeventfd="on" event_idx="off"/> - <source protocol="sheepdog" name="image_name"> - <host name="hostname" port="7000"/> + <driver name='qemu' type='raw' io='threads' ioeventfd='on' event_idx='off'/> + <source protocol='sheepdog' name='image_name'> + <host name='hostname' port='7000'/> </source> - <target dev="hdb" bus="ide"/> + <target dev='hdb' bus='ide'/> <boot order='1'/> <transient/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <disk type='network'> - <driver name="qemu" type="raw"/> - <source protocol="rbd" name="image_name2"> - <host name="hostname" port="7000"/> + <driver name='qemu' type='raw'/> + <source protocol='rbd' name='image_name2'> + <host name='hostname' port='7000'/> </source> - <target dev="hdd" bus="ide"/> + <target dev='hdd' bus='ide'/> <auth username='myuser'> <secret type='ceph' usage='mypassid'/> </auth> @@ -1075,7 +1075,7 @@ <dd>The optional <code>iotune</code> element provides the ability to provide additional per-device I/O tuning, with values that can vary for each device (contrast this to - the <a href="#elementsBlockTuning"><code><blkiotune></code></a> + the <a href='#elementsBlockTuning'><code><blkiotune></code></a> element, which applies globally to the domain). Currently, the only tuning available is Block I/O throttling for qemu. This element has optional sub-elements; any sub-element not @@ -1854,7 +1854,7 @@ <interface type='network'> <source network='default' portgroup='engineering'/> <target dev='vnet7'/> - <mac address="00:11:22:33:44:55"/> + <mac address='00:11:22:33:44:55'/> <virtualport type='802.1Qbg'> <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/> </virtualport> @@ -1894,7 +1894,7 @@ <interface type='bridge'> <source bridge='br0'/> <target dev='vnet7'/> - <mac address="00:11:22:33:44:55"/> + <mac address='00:11:22:33:44:55'/> </interface> </devices> ...</pre> @@ -1916,7 +1916,7 @@ <interface type='user'/> ... <interface type='user'> - <mac address="00:11:22:33:44:55"/> + <mac address='00:11:22:33:44:55'/> </interface> </devices> ...</pre> @@ -2045,8 +2045,8 @@ ... <interface type='direct'> <source dev='eth0.2' mode='vepa'/> - <virtualport type="802.1Qbg"> - <parameters managerid="11" typeid="1193047" typeidversion="2" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"/> + <virtualport type='802.1Qbg'> + <parameters managerid='11' typeid='1193047' typeidversion='2' instanceid='09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f'/> </virtualport> </interface> </devices> @@ -2925,9 +2925,9 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="file"> - <source path="/var/log/vm/vm-serial.log"/> - <target port="1"/> + <serial type='file'> + <source path='/var/log/vm/vm-serial.log'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -2944,7 +2944,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <serial type='vc'> - <target port="1"/> + <target port='1'/> </serial> </devices> ...</pre> @@ -2960,7 +2960,7 @@ qemu-kvm -net nic,model=? /dev/null ... <devices> <serial type='null'> - <target port="1"/> + <target port='1'/> </serial> </devices> ...</pre> @@ -2976,9 +2976,9 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="pty"> - <source path="/dev/pts/3"/> - <target port="1"/> + <serial type='pty'> + <source path='/dev/pts/3'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3003,9 +3003,9 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="dev"> - <source path="/dev/ttyS0"/> - <target port="1"/> + <serial type='dev'> + <source path='/dev/ttyS0'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3020,9 +3020,9 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="pipe"> - <source path="/tmp/mypipe"/> - <target port="1"/> + <serial type='pipe'> + <source path='/tmp/mypipe'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3037,10 +3037,10 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="tcp"> - <source mode="connect" host="0.0.0.0" service="2445"/> - <protocol type="raw"/> - <target port="1"/> + <serial type='tcp'> + <source mode='connect' host='0.0.0.0' service='2445'/> + <protocol type='raw'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3052,10 +3052,10 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="tcp"> - <source mode="bind" host="127.0.0.1" service="2445"/> - <protocol type="raw"/> - <target port="1"/> + <serial type='tcp'> + <source mode='bind' host='127.0.0.1' service='2445'/> + <protocol type='raw'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3070,16 +3070,16 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="tcp"> - <source mode="connect" host="0.0.0.0" service="2445"/> - <protocol type="telnet"/> - <target port="1"/> + <serial type='tcp'> + <source mode='connect' host='0.0.0.0' service='2445'/> + <protocol type='telnet'/> + <target port='1'/> </serial> ... - <serial type="tcp"> - <source mode="bind" host="127.0.0.1" service="2445"/> - <protocol type="telnet"/> - <target port="1"/> + <serial type='tcp'> + <source mode='bind' host='127.0.0.1' service='2445'/> + <protocol type='telnet'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3094,10 +3094,10 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="udp"> - <source mode="bind" host="0.0.0.0" service="2445"/> - <source mode="connect" host="0.0.0.0" service="2445"/> - <target port="1"/> + <serial type='udp'> + <source mode='bind' host='0.0.0.0' service='2445'/> + <source mode='connect' host='0.0.0.0' service='2445'/> + <target port='1'/> </serial> </devices> ...</pre> @@ -3112,9 +3112,9 @@ qemu-kvm -net nic,model=? /dev/null <pre> ... <devices> - <serial type="unix"> - <source mode="bind" path="/tmp/foo"/> - <target port="1"/> + <serial type='unix'> + <source mode='bind' path='/tmp/foo'/> + <target port='1'/> </serial> </devices> ...</pre> diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 02302fa..8ec3c29 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -57,9 +57,9 @@ <pre> ... - <bridge name="virbr0" stp="on" delay="5"/> - <domain name="example.com"/> - <forward mode="nat" dev="eth0"/> + <bridge name='virbr0' stp='on' delay='5'/> + <domain name='example.com'/> + <forward mode='nat' dev='eth0'/> ...</pre> <dl> @@ -274,11 +274,11 @@ <pre> ... <forward mode='private'/> - <interface dev="eth20"/> - <interface dev="eth21"/> - <interface dev="eth22"/> - <interface dev="eth23"/> - <interface dev="eth24"/> + <interface dev='eth20'/> + <interface dev='eth21'/> + <interface dev='eth22'/> + <interface dev='eth23'/> + <interface dev='eth24'/> </forward> <b><portgroup name='engineering' default='yes'> <virtualport type='802.1Qbh'> @@ -342,21 +342,21 @@ <pre> ... <mac address='00:16:3E:5D:C7:9E'/> - <domain name="example.com"/> + <domain name='example.com'/> <dns> - <txt name="example" value="example value" /> + <txt name='example' value='example value' /> <host ip='192.168.122.2'> <hostname>myhost</hostname> <hostname>myhostalias</hostname> </dns> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.100" end="192.168.122.254" /> - <host mac="00:16:3e:77:e2:ed" name="foo.example.com" ip="192.168.122.10" /> - <host mac="00:16:3e:3e:a9:1a" name="bar.example.com" ip="192.168.122.11" /> + <range start='192.168.122.100' end='192.168.122.254' /> + <host mac='00:16:3e:77:e2:ed' name='foo.example.com' ip='192.168.122.10' /> + <host mac='00:16:3e:3e:a9:1a' name='bar.example.com' ip='192.168.122.11' /> </dhcp> </ip> - <ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" /> + <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64' /> </network></pre> <dl> @@ -489,14 +489,14 @@ <pre> <network> <name>default</name> - <bridge name="virbr0" /> - <forward mode="nat"/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <bridge name='virbr0' /> + <forward mode='nat'/> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> + <range start='192.168.122.2' end='192.168.122.254' /> </dhcp> </ip> - <ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" /> + <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64' /> </network></pre> <h3><a name="examplesRoute">Routed network config</a></h3> @@ -513,14 +513,14 @@ <pre> <network> <name>local</name> - <bridge name="virbr1" /> - <forward mode="route" dev="eth1"/> - <ip address="192.168.122.1" netmask="255.255.255.0"> + <bridge name='virbr1' /> + <forward mode='route' dev='eth1'/> + <ip address='192.168.122.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.122.2" end="192.168.122.254" /> + <range start='192.168.122.2' end='192.168.122.254' /> </dhcp> </ip> - <ip family="ipv6" address="2001:db8:ca2:2::1" prefix="64" /> + <ip family='ipv6' address='2001:db8:ca2:2::1' prefix='64' /> </network></pre> <h3><a name="examplesPrivate">Isolated network config</a></h3> @@ -536,13 +536,13 @@ <pre> <network> <name>private</name> - <bridge name="virbr2" /> - <ip address="192.168.152.1" netmask="255.255.255.0"> + <bridge name='virbr2' /> + <ip address='192.168.152.1' netmask='255.255.255.0'> <dhcp> - <range start="192.168.152.2" end="192.168.152.254" /> + <range start='192.168.152.2' end='192.168.152.254' /> </dhcp> </ip> - <ip family="ipv6" address="2001:db8:ca2:3::1" prefix="64" /> + <ip family='ipv6' address='2001:db8:ca2:3::1' prefix='64' /> </network></pre> <h3><a name="examplesBridge">Using an existing host bridge</a></h3> @@ -559,8 +559,8 @@ <pre> <network> <name>host-bridge</name> - <forward mode="bridge"/> - <bridge name="br0"/> + <forward mode='bridge'/> + <bridge name='br0'/> </network></pre> <h3><a name="examplesDirect">Using a macvtap "direct" connection</a></h3> @@ -589,12 +589,12 @@ <pre> <network> <name>direct-macvtap</name> - <forward mode="bridge"> - <interface dev="eth20"/> - <interface dev="eth21"/> - <interface dev="eth22"/> - <interface dev="eth23"/> - <interface dev="eth24"/> + <forward mode='bridge'> + <interface dev='eth20'/> + <interface dev='eth21'/> + <interface dev='eth22'/> + <interface dev='eth23'/> + <interface dev='eth24'/> </forward> </network></pre> diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in index f13ca6a..88f30cc 100644 --- a/docs/formatstorage.html.in +++ b/docs/formatstorage.html.in @@ -23,7 +23,7 @@ <h3><a name="StoragePoolFirst">General metadata</a></h3> <pre> - <pool type="iscsi"> + <pool type='iscsi'> <name>virtimages</name> <uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid> <allocation>10000000</allocation> @@ -68,10 +68,10 @@ <pre> ... <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> - <vendor name="Acme"/> - <product name="model"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> + <vendor name='Acme'/> + <product name='model'/> </source> ...</pre> @@ -212,7 +212,7 @@ <name>sparse.img</name> <key>/var/lib/xen/images/sparse.img</key> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> ...</pre> <dl> @@ -363,7 +363,7 @@ <h3><a name="exampleFile">File based storage pool</a></h3> <pre> - <pool type="dir"> + <pool type='dir'> <name>virtimages</name> <target> <path>/var/lib/virt/images</path> @@ -373,11 +373,11 @@ <h3><a name="exampleISCSI">iSCSI based storage pool</a></h3> <pre> - <pool type="iscsi"> + <pool type='iscsi'> <name>virtimages</name> <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> </source> <target> <path>/dev/disk/by-path</path> @@ -390,7 +390,7 @@ <volume> <name>sparse.img</name> <allocation>0</allocation> - <capacity unit="T">1</capacity> + <capacity unit='T'>1</capacity> <target> <path>/var/lib/virt/images/sparse.img</path> <permissions> diff --git a/docs/formatstorageencryption.html.in b/docs/formatstorageencryption.html.in index 9557a22..9a96763 100644 --- a/docs/formatstorageencryption.html.in +++ b/docs/formatstorageencryption.html.in @@ -33,7 +33,7 @@ </p> <h3><a name="StorageEncryptionDefault">"default" format</a></h3> <p> - <code><encryption type="default"/></code> can be specified only + <code><encryption type='default'/></code> can be specified only when creating a volume. If the volume is successfully created, the encryption formats, parameters and secrets will be auto-generated by libvirt and the attached <code>encryption</code> tag will be updated. diff --git a/docs/news.html.in b/docs/news.html.in index bf97e95..9af5041 100644 --- a/docs/news.html.in +++ b/docs/news.html.in @@ -3920,7 +3920,7 @@ and check the <a href="http://libvirt.org/git/?p=libvirt.git;a=log">GIT log</a> Make checks for inactive QEMU guest more robust (Daniel P. Berrange),<br/> Improve some error messages about unsupported APIs/URIs (Daniel P. Berrange),<br/> Index hashes by UUID instead of name (Jiri Denemark),<br/> - Allow one-or-more <boot dev="..."/> entries (Philipp Hahn),<br/> + Allow one-or-more <boot dev='...'/> entries (Philipp Hahn),<br/> virsh: add --uuid option to vol-pool (Justin Clift),<br/> nwfilter: add XML attribute to control iptables state match (Stefan Berger),<br/> virsh: ensure persistence and autostart are shown for dominfo and pool-info (Justin Clift),<br/> diff --git a/docs/storage.html.in b/docs/storage.html.in index a9c7f1c..1890c82 100644 --- a/docs/storage.html.in +++ b/docs/storage.html.in @@ -46,7 +46,7 @@ libvirt. <h3>Example pool input definition</h3> <pre> - <pool type="dir"> + <pool type='dir'> <name>virtimages</name> <target> <path>/var/lib/virt/images</path> @@ -98,10 +98,10 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="fs"> + <pool type='fs'> <name>virtimages</name> <source> - <device path="/dev/VolGroup00/VirtImages"/> + <device path='/dev/VolGroup00/VirtImages'/> </source> <target> <path>/var/lib/virt/images</path> @@ -167,11 +167,11 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="netfs"> + <pool type='netfs'> <name>virtimages</name> <source> - <host name="nfs.example.com"/> - <dir path="/var/lib/virt/images"/> + <host name='nfs.example.com'/> + <dir path='/var/lib/virt/images'/> </source> <target> <path>/var/lib/virt/images</path> @@ -208,12 +208,12 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="logical"> + <pool type='logical'> <name>HostVG</name> <source> - <device path="/dev/sda1"/> - <device path="/dev/sdb1"/> - <device path="/dev/sdc1"/> + <device path='/dev/sda1'/> + <device path='/dev/sdb1'/> + <device path='/dev/sdc1'/> </source> <target> <path>/dev/HostVG</path> @@ -242,7 +242,7 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="disk"> + <pool type='disk'> <name>sda</name> <source> <device path='/dev/sda'/> @@ -330,11 +330,11 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="iscsi"> + <pool type='iscsi'> <name>virtimages</name> <source> - <host name="iscsi.example.com"/> - <device path="demo-target"/> + <host name='iscsi.example.com'/> + <device path='demo-target'/> </source> <target> <path>/dev/disk/by-path</path> @@ -363,10 +363,10 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="scsi"> + <pool type='scsi'> <name>virtimages</name> <source> - <adapter name="host0"/> + <adapter name='host0'/> </source> <target> <path>/dev/disk/by-path</path> @@ -398,7 +398,7 @@ libvirt. <h3>Example pool input</h3> <pre> - <pool type="mpath"> + <pool type='mpath'> <name>virtimages</name> <target> <path>/dev/mapper</path> -- 1.7.7.3

On Mon, Dec 05, 2011 at 03:08:55PM -0700, Eric Blake wrote:
See the previous patch for rationale. Done with:
$ find docs -name '*.html.in' | \ xargs sed -i '/</ s/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g'
* cfg.mk (sc_xml_quote_style): Extend the rule. * docs/*.html.in: Fix fallout. ---
I'm not as worried about the overall html file being a consistent style as I am the html-ized example texts. The change was intentionally limited to lines starting with '<', to minimize the size of the diff, even if it did pick up a few changes that aren't user-visible.
cfg.mk | 4 + docs/csharp.html.in | 2 +- docs/drvqemu.html.in | 4 +- docs/drvvbox.html.in | 12 ++-- docs/drvxen.html.in | 4 +- docs/formatcaps.html.in | 18 +++--- docs/formatdomain.html.in | 124 +++++++++++++++++----------------- docs/formatnetwork.html.in | 74 ++++++++++---------- docs/formatstorage.html.in | 22 +++--- docs/formatstorageencryption.html.in | 2 +- docs/news.html.in | 2 +- docs/storage.html.in | 34 +++++----- 12 files changed, 153 insertions(+), 149 deletions(-)
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Mon, Dec 05, 2011 at 02:48:30PM -0700, Eric Blake wrote:
According to the official XML specification [1], attributes can be specified with either ' or " (where the difference is that you can use '"' or '"' but must use """, and conversely for "'" or "'" vs. '''). But our code generation in src/conf prefers to output the '' notation, as it is easier to write C string literals for that style. Using a consistent style throughout libvirt will make it easier for users to copy-and-paste without wondering why we switch quoting styles mid-stream.
[1] http://www.w3.org/TR/xml11/#NT-Reference
Mechanical conversion done with:
$ find -name '*.xml' | \ xargs sed -i 's/\([a-zA-Z0-9_]*=\)"\([^"]*\)"/\1'\''\2'\''/g'
followed by inspecting the results, and touching up the change in tests/xml2sexprdata/xml2sexpr-escape.xml to fix 'make check'.
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Mon, Dec 05, 2011 at 02:48:30PM -0700, Eric Blake wrote:
According to the official XML specification [1], attributes can be specified with either ' or " (where the difference is that you can use '"' or '"' but must use """, and conversely for "'" or "'" vs. '''). But our code generation in src/conf prefers to output the '' notation, as it is easier to write C string literals for that style. Using a consistent style throughout libvirt will make it easier for users to copy-and-paste without wondering why we switch quoting styles mid-stream. [...] diff --git a/tests/xml2sexprdata/xml2sexpr-escape.xml b/tests/xml2sexprdata/xml2sexpr-escape.xml index 6eed578..bca2c81 100644 --- a/tests/xml2sexprdata/xml2sexpr-escape.xml +++ b/tests/xml2sexprdata/xml2sexpr-escape.xml @@ -5,7 +5,7 @@ <type>hvm</type> <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel> <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd> - <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> <loader>/usr/lib/xen/boot/hvmloader</loader>
Actually I dislike for this kind of things. It's semantically equivalent, and I don't think we should try to enforce arbitrary requirements which are not needed. This is actually more confusing for people who do know the XML spec, "why isn't my example good" it actually is! The choice of quotes is on purpose to allow easy serialization when you have ' or " in an attribute value. Requiring the user to escape is kind of wrong IMHO. Also the automatic rule won't be able to distinguish " and " within attribute text content from those within element text content, and we certainly don't want to make a simili parser in perl or regexps. Also if someone uses an XML editor on one of our fragment it's very likely that the ' will be turned into " because the distinction is not part of the XML infoset (i.e. the amount of data an XML parser should report to the application) and the tool will serialize back using his own preferences, and that's just fine. I think the inconvenients in that case are not worth the possible improvement. Danil -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On 12/07/2011 08:10 PM, Daniel Veillard wrote:
On Mon, Dec 05, 2011 at 02:48:30PM -0700, Eric Blake wrote:
According to the official XML specification [1], attributes can be specified with either ' or " (where the difference is that you can use '"' or '"' but must use """, and conversely for "'" or "'" vs. '''). But our code generation in src/conf prefers to output the '' notation, as it is easier to write C string literals for that style. Using a consistent style throughout libvirt will make it easier for users to copy-and-paste without wondering why we switch quoting styles mid-stream. [...] diff --git a/tests/xml2sexprdata/xml2sexpr-escape.xml b/tests/xml2sexprdata/xml2sexpr-escape.xml index 6eed578..bca2c81 100644 --- a/tests/xml2sexprdata/xml2sexpr-escape.xml +++ b/tests/xml2sexprdata/xml2sexpr-escape.xml @@ -5,7 +5,7 @@ <type>hvm</type> <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel> <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd> - <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> + <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5.91/x86_64/os&version="devel" </cmdline> <loader>/usr/lib/xen/boot/hvmloader</loader>
Actually I dislike for this kind of things. It's semantically equivalent, and I don't think we should try to enforce arbitrary requirements which are not needed. This is actually more confusing for people who do know the XML spec, "why isn't my example good" it actually is! The choice of quotes is on purpose to allow easy serialization when you have ' or " in an attribute value. Requiring the user to escape is kind of wrong IMHO.
But the fact that we _didn't_ have any ' or " in attribute values in all of the conversion is a testament to the fact that we don't want to choose attributes with quoting in the attribute value.
Also the automatic rule won't be able to distinguish " and " within attribute text content from those within element text content, and we certainly don't want to make a simili parser in perl or regexps. Also if someone uses an XML editor on one of our fragment it's very likely that the ' will be turned into " because the distinction is not part of the XML infoset (i.e. the amount of data an XML parser should report to the application) and the tool will serialize back using his own preferences, and that's just fine.
I think the inconvenients in that case are not worth the possible improvement.
One of the improvements, which I already have noticed since I wrote the patch, is that it is easier to search the rng files for a particular macro definition. That is, if you KNOW that a syntax-check rule enforced the style of <define name='blah'>...</define>, it is easier to see <ref name='blah'/> and search for the definition; whereas pre-patch, you could see <ref name='blah'/> but not know whether to search for name='blah' or name="blah" to find the counterpart <define>. Notice that my syntax-check is not documenting anything contrary to the user; that is, no where did I change documentation to suggest to the user that they must prefer '' over "". Rather it is just presenting a consistent interface (since 'virsh dumpxml dom' always outputs name='value', then the web pages that document how to interpret 'virsh dumpxml' output should also use name='value'). We could drop the changes to the tests directory, if you'd like (that is, use just patches 2 and 3 for the ease of rng searching and for the consistent documentation, but leaving the test directory as a way to prove that the quoting style doesn't matter). But if you're dead set against this series, I guess it won't hurt things to drop it (I can continue to do a regex search for name=['"]blah when looking for a <def name='blah'> counterpart in rng, which is particularly hard to type at a shell command line, but oh well). Any other opinions? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake