[libvirt] [PATCH v5 2/2] test: avoid slash characters to the new domain name.

Julio Faracco jcfaracco at gmail.com
Tue May 1 15:56:09 UTC 2018


As QEMU driver, test driver does not accept slashes inside domain names.
This commit fixes this problem checking slashes inside the new name when
'domrename' is executed.

Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
---
 src/test/test_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a1888c0c9f..974369f28a 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2638,6 +2638,12 @@ testDomainRenameCallback(virDomainObjPtr privdom,
 
     virCheckFlags(0, -1);
 
+    if (strchr(new_name, '/')) {
+        virReportError(VIR_ERR_XML_ERROR,
+                       _("name %s cannot contain '/'"), new_name);
+        return -1;
+    }
+
     if (VIR_STRDUP(new_dom_name, new_name) < 0)
         goto cleanup;
 
-- 
2.17.0




More information about the libvir-list mailing list