提交 df2ae0d0 编写于 作者: E Eric Blake

snapshot: Allow for post-parse override

Wire up the accessor functions necessary for the testsuite to install
an alternative post-parse handler from normal drivers. I could have
modified the signature for virDomainXMLOptionNew() to take another
parameter, but thought it was easier to add a new set function rather
than chase down all existing callers. Until code actually sets the
override, there is no change in behavior.
Signed-off-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 5ba4d81c
...@@ -82,6 +82,9 @@ struct _virDomainXMLOption { ...@@ -82,6 +82,9 @@ struct _virDomainXMLOption {
/* Private data for save image stored in snapshot XML */ /* Private data for save image stored in snapshot XML */
virSaveCookieCallbacks saveCookie; virSaveCookieCallbacks saveCookie;
/* Snapshot postparse callbacks */
virDomainMomentPostParseCallback momentPostParse;
}; };
#define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \ #define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \
...@@ -1476,6 +1479,24 @@ virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt) ...@@ -1476,6 +1479,24 @@ virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt)
} }
void
virDomainXMLOptionSetMomentPostParse(virDomainXMLOptionPtr xmlopt,
virDomainMomentPostParseCallback cb)
{
xmlopt->momentPostParse = cb;
}
int
virDomainXMLOptionRunMomentPostParse(virDomainXMLOptionPtr xmlopt,
virDomainMomentDefPtr def)
{
if (!xmlopt->momentPostParse)
return virDomainMomentDefPostParse(def);
return xmlopt->momentPostParse(def);
}
void void
virBlkioDeviceArrayClear(virBlkioDevicePtr devices, virBlkioDeviceArrayClear(virBlkioDevicePtr devices,
int ndevices) int ndevices)
......
...@@ -2728,6 +2728,13 @@ virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config, ...@@ -2728,6 +2728,13 @@ virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config,
virSaveCookieCallbacksPtr virSaveCookieCallbacksPtr
virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt); virDomainXMLOptionGetSaveCookie(virDomainXMLOptionPtr xmlopt);
typedef int (*virDomainMomentPostParseCallback)(virDomainMomentDefPtr def);
void virDomainXMLOptionSetMomentPostParse(virDomainXMLOptionPtr xmlopt,
virDomainMomentPostParseCallback cb);
int virDomainXMLOptionRunMomentPostParse(virDomainXMLOptionPtr xmlopt,
virDomainMomentDefPtr def);
void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac); void virDomainNetGenerateMAC(virDomainXMLOptionPtr xmlopt, virMacAddrPtr mac);
virDomainXMLNamespacePtr virDomainXMLNamespacePtr
......
...@@ -270,7 +270,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, ...@@ -270,7 +270,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt,
} else { } else {
VIR_WARN("parsing older snapshot that lacks domain"); VIR_WARN("parsing older snapshot that lacks domain");
} }
} else if (virDomainMomentDefPostParse(&def->common) < 0) { } else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->common) < 0) {
goto cleanup; goto cleanup;
} }
......
...@@ -608,6 +608,7 @@ virDomainWatchdogModelTypeToString; ...@@ -608,6 +608,7 @@ virDomainWatchdogModelTypeToString;
virDomainXMLOptionGetNamespace; virDomainXMLOptionGetNamespace;
virDomainXMLOptionGetSaveCookie; virDomainXMLOptionGetSaveCookie;
virDomainXMLOptionNew; virDomainXMLOptionNew;
virDomainXMLOptionSetMomentPostParse;
# conf/domain_event.h # conf/domain_event.h
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册