This proof of concept patch extends the virDomainDefineXML
and virDomainCreateXML APIs so that they can validate
the user supplied XML document against the RNG schemas.

The virsh command will enable validation by default, it
must be turned off with --skip-validation if desired.

This series is not complete

 - The network, interface, storage pool, etc APIs are
   not wired up to support validation.
 - Only the QEMU virt driver is wired up to validate
 - The virsh edit command is not wired up to validate

It is enough to demonstrate it working with 'virsh define'
and the QEMU driver though.

The biggest problem I see is the really awful error
messages we get back from libxml2 when validation
fails :-( They are essentially useless :-(

Daniel P. Berrange (8):
  Add new virDomainDefineXMLFlags public API
  Add stub virDomainDefineXMLFlags impls
  Add virXMLValidateAgainstSchema helper method
  Fix use of flags when parsing/formatting snapshot domain XML
  Don't pass VIR_DOMAIN_XML_SECURE to virDomainDefParseString in phyp
  Fix flags passed to virDomainDefParseString by XenAPI driver
  Given virDomainDef parser & formatter their own flags
  Add support for schema validation when passing in XML

 include/libvirt/libvirt-domain.h  |   9 ++
 include/libvirt/virterror.h       |   1 +
 src/bhyve/bhyve_driver.c          |  21 ++-
 src/conf/domain_conf.c            | 315 +++++++++++++++++++-------------------
 src/conf/domain_conf.h            |  71 ++++++---
 src/conf/snapshot_conf.c          |   8 +-
 src/driver-hypervisor.h           |   5 +
 src/esx/esx_driver.c              |  23 ++-
 src/hyperv/hyperv_driver.c        |   3 +-
 src/internal.h                    |   4 +
 src/libvirt-domain.c              |  48 ++++++
 src/libvirt_private.syms          |   2 +
 src/libvirt_public.syms           |   5 +
 src/libxl/libxl_domain.c          |   2 +-
 src/libxl/libxl_driver.c          |  35 +++--
 src/libxl/libxl_migration.c       |   6 +-
 src/lxc/lxc_driver.c              |  25 ++-
 src/openvz/openvz_driver.c        |  23 ++-
 src/parallels/parallels_driver.c  |  11 +-
 src/phyp/phyp_driver.c            |   7 +-
 src/qemu/qemu_domain.c            |  10 +-
 src/qemu/qemu_driver.c            |  48 ++++--
 src/qemu/qemu_migration.c         |   8 +-
 src/remote/remote_driver.c        |   1 +
 src/remote/remote_protocol.x      |  19 ++-
 src/remote_protocol-structs       |   8 +
 src/test/test_driver.c            |  31 ++--
 src/uml/uml_driver.c              |  22 ++-
 src/util/virerror.c               |   6 +
 src/util/virxml.c                 |  74 +++++++++
 src/util/virxml.h                 |   5 +
 src/vbox/vbox_common.c            |  25 ++-
 src/vmware/vmware_driver.c        |  19 ++-
 src/xen/xen_driver.c              |  21 ++-
 src/xen/xend_internal.c           |   6 +-
 src/xen/xm_internal.c             |   4 +-
 src/xenapi/xenapi_driver.c        |  15 +-
 tests/domainsnapshotxml2xmltest.c |   2 +-
 tests/lxcxml2xmltest.c            |   4 +-
 tests/openvzutilstest.c           |   2 +-
 tests/qemuhotplugtest.c           |   6 +-
 tests/qemuxml2argvtest.c          |   2 +-
 tests/qemuxml2xmltest.c           |   9 +-
 tests/qemuxmlnstest.c             |   2 +-
 tests/vmx2xmltest.c               |   2 +-
 tests/xmconfigtest.c              |   4 +-
 tests/xml2sexprtest.c             |   2 +-
 tests/xml2vmxtest.c               |   2 +-
 tools/virsh-domain.c              |  19 ++-
 49 files changed, 684 insertions(+), 318 deletions(-)

-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to