提交 2f19c932 编写于 作者: P Peter Krempa

conf: Add 'basic' post parse callback

Add yet another post parse callback, which is executed prior the real
one without @parseOpaque. This is meant to set basics before
@parseOpaque (in case of the qemu driver qemuCaps) can be allocated.

This callback will allow to optimize passing of custom parseOpaque
through the callbacks.
上级 7a5f68a1
......@@ -4828,6 +4828,15 @@ virDomainDefPostParse(virDomainDefPtr def,
.parseOpaque = parseOpaque,
};
/* call the basic post parse callback */
if (xmlopt->config.domainPostParseBasicCallback) {
ret = xmlopt->config.domainPostParseBasicCallback(def, caps,
xmlopt->config.priv);
if (ret < 0)
return ret;
}
/* this must be done before the hypervisor-specific callback,
* in case presence of a controller at a specific index is checked
*/
......
......@@ -2497,6 +2497,15 @@ typedef enum {
typedef struct _virDomainXMLOption virDomainXMLOption;
typedef virDomainXMLOption *virDomainXMLOptionPtr;
/* Called after everything else has been parsed, for adjusting basics.
* This has similar semantics to virDomainDefPostParseCallback, but no
* parseOpaque is used. This callback is run prior to
* virDomainDefPostParseCallback. */
typedef int (*virDomainDefPostParseBasicCallback)(virDomainDefPtr def,
virCapsPtr caps,
void *opaque);
/* Called once after everything else has been parsed, for adjusting
* overall domain defaults.
* @parseOpaque is opaque data passed by virDomainDefParse* caller,
......@@ -2546,6 +2555,7 @@ typedef struct _virDomainDefParserConfig virDomainDefParserConfig;
typedef virDomainDefParserConfig *virDomainDefParserConfigPtr;
struct _virDomainDefParserConfig {
/* driver domain definition callbacks */
virDomainDefPostParseBasicCallback domainPostParseBasicCallback;
virDomainDefPostParseCallback domainPostParseCallback;
virDomainDeviceDefPostParseCallback devicesPostParseCallback;
virDomainDefAssignAddressesCallback assignAddressesCallback;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册