Introduce a set of classes for storing libvirt guest configuration
Introduce a set of classes for storing libvirt guest configuration

With the current Cheetah template based approach to XML
generation, there is never any canonical representation
of the guest configuration. When generating XML, a hash
is filled in with parameters to be used to generate XML,
an even some pre-built XML snippets. When reading XML,
typically XPath is used, but sometimes manual DOM traversal
is used.

This change introduces a set of classes for explicitly
representing the guest configuration. They are intended
to allow the guest config to be read/written using normal
programatic APIs, avoiding the need for any code to know
about XML.

This first impl though, only supports writing of XML.
The code to parse an existing XML doc is not yet written.
The class hierarchy is as follows

  LibvirtConfigObject
   |
   + LibvirtConfigGuest
   + LibvirtConfigGuestDevice
      |
      +- LibvirtConfigGuestDisk
      +- LibvirtConfigGuestFilesys
      +- LibvirtConfigGuestInterface
      +- LibvirtConfigGuestInput
      +- LibvirtConfigGuestGraphics
      +- LibvirtConfigGuestChar
          |
          +- LibvirtConfigGuestSerial
          +- LibvirtConfigGuestConsole

The base LibvirtConfigObject class provides some generic
boilerplate code. Subclasses need to override the "format_dom"
method for generating XML DOMS, and "parse_dom" for reading XML
DOMs. The conversion from DOM <-> XML String is handled by
the base class. The DOMs are based on the lxml.etree.Element
class.

 * nova/tests/test_libvirt_config.py: Test cases for XML formatting
   of all config object classes
 * nova/virt/libvirt/config.py: Config object classes for libvirt
   guest XML schema

blueprint libvirt-xml-config-apis
Change-Id: I0474b6640b47ad0e5bb74503a5ff99a8a41bcdc4
Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>

n0ano/gantt,n0ano/gantt