mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
conf: virnwfilterbindingdef: add validation against schema in create
We need to validate the XML against schema if option '--validate' was passed to the virsh command. This patch also includes propagation of flags into the virNWFilterBindingDefParse(). Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
e21448e830
commit
eabb73eba2
@ -178,12 +178,15 @@ virNWFilterBindingDefParseNode(xmlDocPtr xml,
|
||||
|
||||
static virNWFilterBindingDef *
|
||||
virNWFilterBindingDefParse(const char *xmlStr,
|
||||
const char *filename)
|
||||
const char *filename,
|
||||
unsigned int flags)
|
||||
{
|
||||
virNWFilterBindingDef *def = NULL;
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
|
||||
if ((xml = virXMLParse(filename, xmlStr, _("(nwfilterbinding_definition)"), NULL, false))) {
|
||||
if ((xml = virXMLParse(filename, xmlStr, _("(nwfilterbinding_definition)"),
|
||||
"nwfilterbinding.rng",
|
||||
flags & VIR_NWFILTER_BINDING_CREATE_VALIDATE))) {
|
||||
def = virNWFilterBindingDefParseNode(xml, xmlDocGetRootElement(xml));
|
||||
}
|
||||
|
||||
@ -192,16 +195,17 @@ virNWFilterBindingDefParse(const char *xmlStr,
|
||||
|
||||
|
||||
virNWFilterBindingDef *
|
||||
virNWFilterBindingDefParseString(const char *xmlStr)
|
||||
virNWFilterBindingDefParseString(const char *xmlStr,
|
||||
unsigned int flags)
|
||||
{
|
||||
return virNWFilterBindingDefParse(xmlStr, NULL);
|
||||
return virNWFilterBindingDefParse(xmlStr, NULL, flags);
|
||||
}
|
||||
|
||||
|
||||
virNWFilterBindingDef *
|
||||
virNWFilterBindingDefParseFile(const char *filename)
|
||||
{
|
||||
return virNWFilterBindingDefParse(NULL, filename);
|
||||
return virNWFilterBindingDefParse(NULL, filename, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,8 @@ virNWFilterBindingDefParseNode(xmlDocPtr xml,
|
||||
xmlNodePtr root);
|
||||
|
||||
virNWFilterBindingDef *
|
||||
virNWFilterBindingDefParseString(const char *xml);
|
||||
virNWFilterBindingDefParseString(const char *xml,
|
||||
unsigned int flags);
|
||||
|
||||
virNWFilterBindingDef *
|
||||
virNWFilterBindingDefParseFile(const char *filename);
|
||||
|
@ -745,7 +745,7 @@ nwfilterBindingCreateXML(virConnectPtr conn,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
def = virNWFilterBindingDefParseString(xml);
|
||||
def = virNWFilterBindingDefParseString(xml, 0);
|
||||
if (!def)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user