[PATCH 00/43] XML parsing helper cleanup

Peter Krempa posted 43 patches 1 year, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1664870258.git.pkrempa@redhat.com
src/conf/backup_conf.c                |  42 ++------
src/conf/backup_conf.h                |  10 +-
src/conf/checkpoint_conf.c            |  42 +++-----
src/conf/domain_conf.c                |  85 +++++-----------
src/conf/domain_conf.h                |   7 +-
src/conf/interface_conf.c             |  54 ++--------
src/conf/interface_conf.h             |   7 +-
src/conf/network_conf.c               |  50 ++--------
src/conf/network_conf.h               |  16 +--
src/conf/node_device_conf.c           |  57 ++---------
src/conf/node_device_conf.h           |  25 ++---
src/conf/nwfilter_conf.c              |  48 ++-------
src/conf/nwfilter_conf.h              |  12 +--
src/conf/secret_conf.c                |  44 ++------
src/conf/secret_conf.h                |   7 +-
src/conf/snapshot_conf.c              |  57 ++++-------
src/conf/snapshot_conf.h              |  13 +--
src/conf/storage_conf.c               | 108 +++-----------------
src/conf/storage_conf.h               |  31 ++----
src/conf/virnetworkobj.c              |   6 +-
src/conf/virnetworkportdef.c          |  49 ++-------
src/conf/virnetworkportdef.h          |  12 +--
src/conf/virnwfilterbindingdef.c      |  51 ++--------
src/conf/virnwfilterbindingdef.h      |  11 +-
src/conf/virnwfilterbindingobj.c      |  66 +++---------
src/conf/virnwfilterbindingobj.h      |   3 +-
src/conf/virnwfilterbindingobjlist.c  |   2 +-
src/conf/virnwfilterobj.c             |   2 +-
src/conf/virsavecookie.c              |  31 ++----
src/conf/virsecretobj.c               |   2 +-
src/conf/virstorageobj.c              |   4 +-
src/esx/esx_network_driver.c          |   2 +-
src/esx/esx_storage_backend_vmfs.c    |   4 +-
src/hypervisor/domain_driver.c        |   7 +-
src/libvirt_private.syms              |  41 +++-----
src/network/bridge_driver.c           |  10 +-
src/node_device/node_device_driver.c  |   8 +-
src/nwfilter/nwfilter_driver.c        |   4 +-
src/qemu/qemu_capabilities.c          |  15 +--
src/qemu/qemu_domain.c                |   9 +-
src/qemu/qemu_migration_cookie.c      |  10 +-
src/qemu/qemu_process.c               |   2 +-
src/secret/secret_driver.c            |   2 +-
src/security/virt-aa-helper.c         |   9 +-
src/storage/storage_driver.c          |  10 +-
src/test/test_driver.c                | 138 +++++++++++---------------
src/util/virxml.h                     |  50 ++--------
src/vbox/vbox_network.c               |   2 +-
src/vbox/vbox_snapshot_conf.c         | 129 +++++++-----------------
src/vbox/vbox_storage.c               |   2 +-
src/vz/vz_sdk.c                       |  18 +---
tests/networkxml2conftest.c           |   2 +-
tests/networkxml2firewalltest.c       |   2 +-
tests/networkxml2xmltest.c            |   2 +-
tests/networkxml2xmlupdatetest.c      |   2 +-
tests/nodedevmdevctltest.c            |   8 +-
tests/nodedevxml2xmltest.c            |   3 +-
tests/nwfilterxml2firewalltest.c      |   2 +-
tests/nwfilterxml2xmltest.c           |   2 +-
tests/qemuxml2argvtest.c              |  19 +---
tests/secretxml2xmltest.c             |   2 +-
tests/storagepoolxml2argvtest.c       |   2 +-
tests/storagepoolxml2xmltest.c        |   2 +-
tests/storagevolxml2argvtest.c        |   8 +-
tests/storagevolxml2xmltest.c         |   4 +-
tests/virnetworkportxml2xmltest.c     |   2 +-
tests/virnwfilterbindingxml2xmltest.c |   2 +-
tests/virschematest.c                 |   2 +-
tools/virsh-util.c                    |   5 +-
69 files changed, 399 insertions(+), 1098 deletions(-)
[PATCH 00/43] XML parsing helper cleanup
Posted by Peter Krempa 1 year, 6 months ago
This series cleans up the use of virXMLParse* macros and tries to unify
and remove the uncommon ones.

In next step since virXMLParse itself has features which can replace
open-coded bits in conf parsers for all various object types we have,
this series cleans them up too.

Peter Krempa (43):
  util: xml: Expose all arguments of virXMLParseHelper in virXMLParse
    macro
  conf: nwfilderbindigobj: Register automatic cleanup for
    virNWFilterBindingObj
  virNWFilterBindingObjParse: Refactor XML parsing code
  vbox: snapshot_conf: Don't allocate XPath context explicitly
  virVBoxSnapshotConfGet(RW|RO)DisksPathsFromLibvirtXML: Refactor
  virNWFilterBindingDefParse: Properly use virXMLParse
  conf: nwfilterbinding: Provide only virNWFilterBindingDefParse
  tests: qemuxml2argv: Use virXMLParse properly
  conf: networkport: Remove virNetworkPortDefParseNode
  conf: networkportdef: Provide only virNetworkPortDefParse
  testParseXMLDocFromFile: Refactor control flow
  testParseXMLDocFromFile: Remove 'type' argument
  testParseXMLDocFromFile: Validate that the replaced node is identical
    with parsed root
  conf: storage: Remove virStoragePoolDefParseNode
  conf: storage: Provide only virStoragePoolDefParse
  conf: storage: Remove virStorageVolDefParseNode
  conf: storage: Provide only virStorageVolDefParse
  conf: snapshot: Remove virDomainSnapshotDefParseNode
  conf: secret: Refactor secretXMLParseNode
  conf: secret: Provide only virSecretDefParse
  prlsdkParseSnapshotTree: Simplify XML parsing code
  conf: checkpoint: Remove virDomainCheckpointDefParseNode
  conf: backup: Remove virDomainBackupDefParseNode
  conf: nwfilter: Remove virNWFilterDefParseNode
  conf: nwfilter: Provide only virNWFilterDefParse
  conf: node_device: Remove virNodeDeviceDefParseNode
  conf: nodedev: Provide only virNodeDeviceDefParse
  conf: interface: Remove virInterfaceDefParseNode
  conf: interface: Remove virInterfaceDefParseFile
  conf: network: Remove virNetworkDefParseNode
  conf: network: Provide only virNetworkDefParse
  conf: domain: Remove virDomainObjParseNode
  conf: domain: Simplify validation in virDomainDefParse
  virDomainDefParseNode: Pass only the XPath context as argument
  virsh: Use proper helper for parsing XML in virshDumpXML
  util: xml: Remove virXMLParseString
  qemu: capabilities: Convert virQEMUCapsLoadCache to virXMLParse
  util: xml: Remove virXMLParseFile
  util: xml: Remove virXMLParseCtxt
  conf: savecookie: Remove virSaveCookieParseNode
  security: aa-helper: Use virXMLParse instead of virXMLParseString
  test_driver: Make callers of testOpenParse ensure the root element
    name
  util: xml: Remove virXMLParseStringCtxtRoot

 src/conf/backup_conf.c                |  42 ++------
 src/conf/backup_conf.h                |  10 +-
 src/conf/checkpoint_conf.c            |  42 +++-----
 src/conf/domain_conf.c                |  85 +++++-----------
 src/conf/domain_conf.h                |   7 +-
 src/conf/interface_conf.c             |  54 ++--------
 src/conf/interface_conf.h             |   7 +-
 src/conf/network_conf.c               |  50 ++--------
 src/conf/network_conf.h               |  16 +--
 src/conf/node_device_conf.c           |  57 ++---------
 src/conf/node_device_conf.h           |  25 ++---
 src/conf/nwfilter_conf.c              |  48 ++-------
 src/conf/nwfilter_conf.h              |  12 +--
 src/conf/secret_conf.c                |  44 ++------
 src/conf/secret_conf.h                |   7 +-
 src/conf/snapshot_conf.c              |  57 ++++-------
 src/conf/snapshot_conf.h              |  13 +--
 src/conf/storage_conf.c               | 108 +++-----------------
 src/conf/storage_conf.h               |  31 ++----
 src/conf/virnetworkobj.c              |   6 +-
 src/conf/virnetworkportdef.c          |  49 ++-------
 src/conf/virnetworkportdef.h          |  12 +--
 src/conf/virnwfilterbindingdef.c      |  51 ++--------
 src/conf/virnwfilterbindingdef.h      |  11 +-
 src/conf/virnwfilterbindingobj.c      |  66 +++---------
 src/conf/virnwfilterbindingobj.h      |   3 +-
 src/conf/virnwfilterbindingobjlist.c  |   2 +-
 src/conf/virnwfilterobj.c             |   2 +-
 src/conf/virsavecookie.c              |  31 ++----
 src/conf/virsecretobj.c               |   2 +-
 src/conf/virstorageobj.c              |   4 +-
 src/esx/esx_network_driver.c          |   2 +-
 src/esx/esx_storage_backend_vmfs.c    |   4 +-
 src/hypervisor/domain_driver.c        |   7 +-
 src/libvirt_private.syms              |  41 +++-----
 src/network/bridge_driver.c           |  10 +-
 src/node_device/node_device_driver.c  |   8 +-
 src/nwfilter/nwfilter_driver.c        |   4 +-
 src/qemu/qemu_capabilities.c          |  15 +--
 src/qemu/qemu_domain.c                |   9 +-
 src/qemu/qemu_migration_cookie.c      |  10 +-
 src/qemu/qemu_process.c               |   2 +-
 src/secret/secret_driver.c            |   2 +-
 src/security/virt-aa-helper.c         |   9 +-
 src/storage/storage_driver.c          |  10 +-
 src/test/test_driver.c                | 138 +++++++++++---------------
 src/util/virxml.h                     |  50 ++--------
 src/vbox/vbox_network.c               |   2 +-
 src/vbox/vbox_snapshot_conf.c         | 129 +++++++-----------------
 src/vbox/vbox_storage.c               |   2 +-
 src/vz/vz_sdk.c                       |  18 +---
 tests/networkxml2conftest.c           |   2 +-
 tests/networkxml2firewalltest.c       |   2 +-
 tests/networkxml2xmltest.c            |   2 +-
 tests/networkxml2xmlupdatetest.c      |   2 +-
 tests/nodedevmdevctltest.c            |   8 +-
 tests/nodedevxml2xmltest.c            |   3 +-
 tests/nwfilterxml2firewalltest.c      |   2 +-
 tests/nwfilterxml2xmltest.c           |   2 +-
 tests/qemuxml2argvtest.c              |  19 +---
 tests/secretxml2xmltest.c             |   2 +-
 tests/storagepoolxml2argvtest.c       |   2 +-
 tests/storagepoolxml2xmltest.c        |   2 +-
 tests/storagevolxml2argvtest.c        |   8 +-
 tests/storagevolxml2xmltest.c         |   4 +-
 tests/virnetworkportxml2xmltest.c     |   2 +-
 tests/virnwfilterbindingxml2xmltest.c |   2 +-
 tests/virschematest.c                 |   2 +-
 tools/virsh-util.c                    |   5 +-
 69 files changed, 399 insertions(+), 1098 deletions(-)

-- 
2.37.3
Re: [PATCH 00/43] XML parsing helper cleanup
Posted by Ján Tomko 1 year, 6 months ago
On a Tuesday in 2022, Peter Krempa wrote:
>This series cleans up the use of virXMLParse* macros and tries to unify
>and remove the uncommon ones.
>
>In next step since virXMLParse itself has features which can replace
>open-coded bits in conf parsers for all various object types we have,
>this series cleans them up too.
>
>Peter Krempa (43):
>  util: xml: Expose all arguments of virXMLParseHelper in virXMLParse
>    macro
>  conf: nwfilderbindigobj: Register automatic cleanup for
>    virNWFilterBindingObj
[...]
>  security: aa-helper: Use virXMLParse instead of virXMLParseString
>  test_driver: Make callers of testOpenParse ensure the root element
>    name
>  util: xml: Remove virXMLParseStringCtxtRoot
>
> src/conf/backup_conf.c                |  42 ++------
> src/conf/backup_conf.h                |  10 +-
[...]
> tests/virschematest.c                 |   2 +-
> tools/virsh-util.c                    |   5 +-
> 69 files changed, 399 insertions(+), 1098 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano