separate virDomainDefParseEventActionInfo from virDomainDefParseXML --- src/conf/domain_conf.c | 68 +++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b8fe24e..8374b9d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -19622,6 +19622,44 @@ virDomainDefParseFeatureInfo(virDomainParseTotalParamPtr param) } +static int +virDomainDefParseEventActionInfo(virDomainParseTotalParamPtr param) +{ + int ret = -1; + if (virDomainEventActionParseXML(param->ctxt, "on_reboot", + "string(./on_reboot[1])", + ¶m->def->onReboot, + VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, + virDomainLifecycleActionTypeFromString) < 0) + goto cleanup; + + if (virDomainEventActionParseXML(param->ctxt, "on_poweroff", + "string(./on_poweroff[1])", + ¶m->def->onPoweroff, + VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, + virDomainLifecycleActionTypeFromString) < 0) + goto cleanup; + + if (virDomainEventActionParseXML(param->ctxt, "on_crash", + "string(./on_crash[1])", + ¶m->def->onCrash, + VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, + virDomainLifecycleActionTypeFromString) < 0) + goto cleanup; + + if (virDomainEventActionParseXML(param->ctxt, "on_lockfailure", + "string(./on_lockfailure[1])", + ¶m->def->onLockFailure, + VIR_DOMAIN_LOCK_FAILURE_DEFAULT, + virDomainLockFailureTypeFromString) < 0) + goto cleanup; + + ret = 0; + cleanup: + return ret; +} + + static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, xmlNodePtr root, @@ -19675,6 +19713,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainDefParseCpuNumaInfo, virDomainDefParseResourceInfo, virDomainDefParseFeatureInfo, + virDomainDefParseEventActionInfo, NULL }; @@ -19702,35 +19741,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - - if (virDomainEventActionParseXML(ctxt, "on_reboot", - "string(./on_reboot[1])", - &def->onReboot, - VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, - virDomainLifecycleActionTypeFromString) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_poweroff", - "string(./on_poweroff[1])", - &def->onPoweroff, - VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, - virDomainLifecycleActionTypeFromString) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_crash", - "string(./on_crash[1])", - &def->onCrash, - VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, - virDomainLifecycleActionTypeFromString) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_lockfailure", - "string(./on_lockfailure[1])", - &def->onLockFailure, - VIR_DOMAIN_LOCK_FAILURE_DEFAULT, - virDomainLockFailureTypeFromString) < 0) - goto error; - if (virDomainPMStateParseXML(ctxt, "string(./pm/suspend-to-mem/@enabled)", &def->pm.s3) < 0) -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list