]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_driver.c: use virConnectValidateURIPath()
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 26 Sep 2019 14:56:44 +0000 (11:56 -0300)
committerCole Robinson <crobinso@redhat.com>
Thu, 26 Sep 2019 21:25:20 +0000 (17:25 -0400)
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Suggested-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_driver.c

index 286f5bd9846931425bae8447480a45580ae34326..d5f5fd6990f2245cd0ec4c84df0ea20bbabdc9ac 100644 (file)
@@ -1295,22 +1295,10 @@ static virDrvOpenStatus qemuConnectOpen(virConnectPtr conn,
         return VIR_DRV_OPEN_ERROR;
     }
 
-    if (virQEMUDriverIsPrivileged(qemu_driver)) {
-        if (STRNEQ(conn->uri->path, "/system") &&
-            STRNEQ(conn->uri->path, "/session")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected QEMU URI path '%s', try qemu:///system"),
-                           conn->uri->path);
-            return VIR_DRV_OPEN_ERROR;
-        }
-    } else {
-        if (STRNEQ(conn->uri->path, "/session")) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("unexpected QEMU URI path '%s', try qemu:///session"),
-                           conn->uri->path);
-            return VIR_DRV_OPEN_ERROR;
-        }
-    }
+    if (!virConnectValidateURIPath(conn->uri->path,
+                                   "qemu",
+                                   virQEMUDriverIsPrivileged(qemu_driver)))
+        return VIR_DRV_OPEN_ERROR;
 
     if (virConnectOpenEnsureACL(conn) < 0)
         return VIR_DRV_OPEN_ERROR;