conf: Add post XML parse callbacks and prepare for cleaning of virCaps

This patch adds instrumentation that will allow hypervisor drivers to
fill and validate domain and device definitions after parsed by the XML
parser.

With this patch, after the XML is parsed, a callback to the driver is
issued requesting to fill and validate driver specific details of the
configuration. This allows to use sensible defaults and checks on a per
driver basis at the time the XML is parsed.

Two callback pointers are stored in the new virDomainXMLConf object:
* virDomainDeviceDefPostParseCallback (devicesPostParseCallback)
  - called for a single device parsed and for every single device in a
    domain config. A virDomainDeviceDefPtr is passed along with the
    domain definition and virCaps.

* virDomainDefPostParseCallback, (domainPostParseCallback)
  - A callback that is meant to process the domain config after it's
  parsed.  A virDomainDefPtr is passed along with virCaps.

Both types of callbacks support arbitrary opaque data passed for the
callback functions.

Errors may be reported in those callbacks resulting in a XML parsing
failure.
This commit is contained in:
Peter Krempa
2013-02-19 17:29:39 +01:00
parent e84b19316a
commit 43b99fc4c0
23 changed files with 174 additions and 46 deletions

View File

@@ -18,7 +18,7 @@ static int testXenDefaultConsoleType(const char *ostype,
virDomainXMLOptionPtr
testXenXMLConfInit(void)
{
return virDomainXMLOptionNew(NULL, NULL);
return virDomainXMLOptionNew(NULL, NULL, NULL);
}
virCapsPtr testXenCapsInit(void) {