Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9e106b8846..7dfbca12e5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1447,10 +1447,9 @@ static int virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPtr keywrap, xmlNodePtr node) { - int state_type; + virTristateSwitch state_type = VIR_TRISTATE_SWITCH_ABSENT; int name_type; g_autofree char *name = NULL; - g_autofree char *state = NULL; if (!(name = virXMLPropString(node, "name"))) { virReportError(VIR_ERR_CONF_SYNTAX, "%s", @@ -1464,17 +1463,8 @@ virDomainKeyWrapCipherDefParseXML(virDomainKeyWrapDefPtr keywrap, return -1; } - if (!(state = virXMLPropString(node, "state"))) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("missing state for cipher named %s"), name); - return -1; - } - - if ((state_type = virTristateSwitchTypeFromString(state)) < 0) { - virReportError(VIR_ERR_CONF_SYNTAX, - _("%s is not a supported cipher state"), state); + if (virXMLPropTristateSwitch(node, "state", true, &state_type) < 0) return -1; - } switch ((virDomainKeyWrapCipherName) name_type) { case VIR_DOMAIN_KEY_WRAP_CIPHER_NAME_AES: -- 2.26.2