virt: Add method to rebase an XML element to root

This is a convenience when you want some behavior to
only operate on a subtree of an XML document as if
it were a separate XML tree.

This functionality is provided by a 'private' name
in the ElementTree module to protect users from
some negative implications.  This method masks
those negative aspects and provides a public name.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Move libvirt_xml module into package

The module was growing too rapidly to be contained
within a single module and remain comprehensible.

Individual modules will be re-intriduced for each section
of the original file along with some much needed improvements.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Implement libvirt_xml.accessors

The vast majority of libvirt's XML can be operated on
via a small collection of common operations.  For example
adding/removing a single tag somewhere in the tree.

This module consolidates some of those operations into method
generator classes which can be easily attached to libvirt XML
base classes.  This prevents code duplication and consolidates
common operations into a single set of initialization statements.

Each accessor subclass shares a common data attribute which
encodes static data needed to perform it's operations on
a LibvirtXMLBase-derived instance.  This was done to allow
base classes to generate these accessors from a dictionary-of-
dictionaries.  However it may be changed in the future so as
to be more transparent.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add libvirt_xml.base and xcepts

The LibvirtXMLBase base-class is utilized by many subclasses
and deserves to be in it's own module.

Exceptions for the libvirt_xml package have been moved into
the xcepts module.

Introduced a new exception, "LibvirtXMLAccessorError" which
derives from the standard LibvirtXMLError.  This provides
more verbose and consistent debugging info. when generated
accessor methods do something wrong.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add libvirt_xml.libvirt_xml module

While I dislike duplicate nested names, this module's
classes operate on libvirt's capabilities XML so the
name fits.

The only changes made were to make use of the accessors module
and the addition of the uuid property.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add libvirt_xml.network_xml module

This module's classes now fully support all basic aspects of
libvirt's host-network XML format.  It was updated extensivly
to make use of common accessor methods.  New classes were added
to help handle IP addresses and associated DHCP ranges for XML bridge
description.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Add libvirt_xml.vm_xml module

Guest XML manipulations are fairly basic for now, but will be vast
eventually.  Becides converting classes to use the new accessor methods,
little else was changed.  Eventually this module will likely become
a sub-package in it's own right.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Update libvirt_xml_unittests

Changes were needed to support the new libvirt_xml package along with
some minor interface changes and a bug fix.

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Reapply dropped libvirt_xml patches

* 728416fb61b58a5a3e560ba61c298029c1709a3f
  virt-libvirt: fix bug in libvirt_xml
  杨东升 <yangds.fnst@cn.fujitsu.com>
  Thu Jan 10 14:43:48 2013 +0000

Signed-off-by: Chris Evich <cevich@redhat.com>
virt: Propcan module doc updates

Signed-off-by: Chris Evich <cevich@redhat.com>
virt-libvirt: Make libvirt_xml.accessors xparent

* Original implementation required nested dictionaries
  and there was very little type checking or parameter validation
* Reimplemented from the ground up properly using classes
  and nested base classes.
* Moved libvirt instance setup code into accessor generator class
* Documented the heck out of the module because it uses backreferences
  i.e. LibvirtXMLBase instances will contain generated
  accessor methods & classes which backreference to the libvirtxml
  instance.
* Added lots of type and parameter checking to aid in debugging

Signed-off-by: Chris Evich <cevich@redhat.com>