On 11.10.2016 04:15, Sławek Kapłoński wrote:
New line character in name of network is now forbidden because it
mess virsh output and can be confusing for users.
Closes-Bug:
https://bugzilla.redhat.com/show_bug.cgi?id=818064
---
src/conf/network_conf.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index aa39776..a7f802b 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -2117,11 +2117,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error;
}
- if (strchr(def->name, '/')) {
- virReportError(VIR_ERR_XML_ERROR,
- _("name %s cannot contain '/'"),
def->name);
+ if (virXMLCheckString("name", def->name, "/\n"))
goto error;
- }
/* Extract network uuid */
tmp = virXPathString("string(./uuid[1])", ctxt);
Almost. As Peter pointed out, failure to parse XML (and this is causing
failure) results in libvirt not knowing anything about the object in the
XML. For instance, if somebody already has a network with '\n' in its
name, after this is applied libvirt stops reporting the network and
leaves it behind. With no chance for users to adjust their definition.
What we should do here is to:
1) still deny '/' in network name (as this was never allowed),
2) deny networks with any other forbidden characters (like '\n' for
instance) in network startup process.
Michal