Prior to v7.10.0-rc1~26 seclabels defaulted to
VIR_DOMAIN_SECLABEL_DYNAMIC (type='dynamic'). But after switching
the parser to virXMLPropEnum() the type is overwritten to
VIR_DOMAIN_SECLABEL_DEFAULT because the first thing that the
helper function does is to set variable that holds the result to
zero. Switch to virXMLPropEnumDefault() to restore the previous
behavior.
Fixes: f7ff8556ad9ba8d81408e31649071941a6a849a3
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
if (!(seclabel = virSecurityLabelDefNew(model)))
return NULL;
- /* set default value */
- seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
-
- if (virXMLPropEnum(ctxt->node, "type",
- virDomainSeclabelTypeFromString,
- VIR_XML_PROP_NONZERO,
- &seclabel->type) < 0)
+ if (virXMLPropEnumDefault(ctxt->node, "type",
+ virDomainSeclabelTypeFromString,
+ VIR_XML_PROP_NONZERO,
+ &seclabel->type,
+ VIR_DOMAIN_SECLABEL_DYNAMIC) < 0) {
return NULL;
+ }
if (seclabel->type == VIR_DOMAIN_SECLABEL_STATIC ||
seclabel->type == VIR_DOMAIN_SECLABEL_NONE)