[libvirt] [PATCH 1/6] Allow network model to contain "-"

Michael Ellerman michael at ozlabs.org
Thu Dec 8 06:41:22 UTC 2011


From: Michael Ellerman <michael at ellerman.id.au>

In QEMU PPC64 we have a network device called "spapr-vlan". We can specify
this using the existing syntax for network devices, however libvirt
currently rejects "spapr-vlan" in virDomainNetDefParseXML() because of
the "-". Fix the code to accept "-".

Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
 src/conf/domain_conf.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 75e51a0..5de33b9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3703,8 +3703,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
     if (model != NULL) {
         int i;
         for (i = 0 ; i < strlen(model) ; i++) {
-            int char_ok = c_isalnum(model[i]) || model[i] == '_';
-            if (!char_ok) {
+            if (!c_isalnum(model[i]) && model[i] != '_' && model[i] != '-') {
                 virDomainReportError(VIR_ERR_INVALID_ARG, "%s",
                                      _("Model name contains invalid characters"));
                 goto error;
-- 
1.7.7.3




More information about the libvir-list mailing list