[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/7] qemu: Use macro instead of "qemu" in the context of URI scheme



---
 src/qemu/qemu_conf.h   |  2 ++
 src/qemu/qemu_driver.c | 18 +++++++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index ca2f694..fe8de36 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -47,6 +47,8 @@
 
 # define QEMUD_CPUMASK_LEN CPU_SETSIZE
 
+# define QEMU_URI_SCHEME "qemu"
+
 typedef struct _qemuDriverCloseDef qemuDriverCloseDef;
 typedef qemuDriverCloseDef *qemuDriverCloseDefPtr;
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 95a30e6..e1be849 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -295,8 +295,8 @@ qemuAutostartDomains(struct qemud_driver *driver)
      * network
      */
     virConnectPtr conn = virConnectOpen(driver->privileged ?
-                                        "qemu:///system" :
-                                        "qemu:///session");
+                                        QEMU_URI_SCHEME ":///system" :
+                                        QEMU_URI_SCHEME ":///session");
     /* Ignoring NULL conn which is mostly harmless here */
     struct qemuAutostartData data = { driver, conn };
 
@@ -859,8 +859,8 @@ qemudStartup(int privileged) {
     virHashForEach(qemu_driver->domains.objs, qemuDomainNetsRestart, NULL);
 
     conn = virConnectOpen(qemu_driver->privileged ?
-                          "qemu:///system" :
-                          "qemu:///session");
+                          QEMU_URI_SCHEME ":///system" :
+                          QEMU_URI_SCHEME ":///session");
 
     qemuProcessReconnectAll(conn, qemu_driver);
 
@@ -1054,13 +1054,13 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
             return VIR_DRV_OPEN_DECLINED;
 
         if (!(conn->uri = virURIParse(qemu_driver->privileged ?
-                                      "qemu:///system" :
-                                      "qemu:///session")))
+                                      QEMU_URI_SCHEME ":///system" :
+                                      QEMU_URI_SCHEME ":///session")))
             return VIR_DRV_OPEN_ERROR;
     } else {
         /* If URI isn't 'qemu' its definitely not for us */
         if (conn->uri->scheme == NULL ||
-            STRNEQ(conn->uri->scheme, "qemu"))
+            STRNEQ(conn->uri->scheme, QEMU_URI_SCHEME))
             return VIR_DRV_OPEN_DECLINED;
 
         /* Allow remote driver to deal with URIs with hostname server */
@@ -1077,8 +1077,8 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("no QEMU URI path given, try %s"),
                            qemu_driver->privileged
-                           ? "qemu:///system"
-                           : "qemu:///session");
+                           ? QEMU_URI_SCHEME ":///system"
+                           : QEMU_URI_SCHEME ":///session");
                 return VIR_DRV_OPEN_ERROR;
         }
 
-- 
1.7.12


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]