diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 980642cee87d5d531e8365f04f3327230a01af71..51aa48f4211b2359e783b0b888435df62ec33576 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -82,6 +82,9 @@ struct _virDomainXMLOption { /* Private data for save image stored in snapshot XML */ virSaveCookieCallbacks saveCookie; + + /* Snapshot postparse callbacks */ + virDomainMomentPostParseCallback momentPostParse; }; #define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \ @@ -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 virBlkioDeviceArrayClear(virBlkioDevicePtr devices, int ndevices) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2755c74924892d8b42f0dbcfbb0915849c091ddf..5910ed0beb72c79833e03dffc8bad169070ca838 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2728,6 +2728,13 @@ virDomainXMLOptionPtr virDomainXMLOptionNew(virDomainDefParserConfigPtr config, virSaveCookieCallbacksPtr 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); virDomainXMLNamespacePtr diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index ef6eae3a51d217b53a5b06b410f89343d7e553a9..36c328f6926f3f44538158b7d8169feade32eb6f 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -270,7 +270,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, } else { VIR_WARN("parsing older snapshot that lacks domain"); } - } else if (virDomainMomentDefPostParse(&def->common) < 0) { + } else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->common) < 0) { goto cleanup; } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 673e98bf609b1c231dfc43db09a6a43fee55f75a..a3d480d84629ec665d532d1a0db48f2eeacbedc9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -608,6 +608,7 @@ virDomainWatchdogModelTypeToString; virDomainXMLOptionGetNamespace; virDomainXMLOptionGetSaveCookie; virDomainXMLOptionNew; +virDomainXMLOptionSetMomentPostParse; # conf/domain_event.h