]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
* src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ
authorDaniel Veillard <veillard@redhat.com>
Wed, 26 Dec 2007 05:41:05 +0000 (05:41 +0000)
committerDaniel Veillard <veillard@redhat.com>
Wed, 26 Dec 2007 05:41:05 +0000 (05:41 +0000)
  compilation error #426385
Daniel

ChangeLog
src/openvz_driver.c

index e5c7afd902e69e72fbcb6f42d23518a83ed19d35..7130ca4b82736fe14d63a881e56226c712373779 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Dec 26 06:38:53 CET 2007 Daniel Veillard <veillard@redhat.com>
+
+       * src/openvz.c: patch from Mikhail Pokidko to fix the OpenVZ
+         compilation error #426385
+
 Tue Dec 18 00:18:33 CET 2007 Daniel Veillard <veillard@redhat.com>
 
        * configure.in docs/libvir.html docs/news.html po/*:
index 7f6d0cd3d0c60613f0a2ff7216ddc5dbc1f0c863..5f5c94b44b4dc1a620388876320f3dc2f4e94b52 100644 (file)
@@ -72,9 +72,10 @@ static int openvzDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info);
 static int openvzDomainShutdown(virDomainPtr dom);
 static int openvzDomainReboot(virDomainPtr dom, unsigned int flags);
 static int openvzDomainCreate(virDomainPtr dom);
-static virDrvOpenStatus openvzOpen(virConnectPtr conn, const char *name,
-                           int flags ATTRIBUTE_UNUSED);
-
+static virDrvOpenStatus openvzOpen(virConnectPtr conn,
+                                 xmlURIPtr uri,
+                                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                 int flags ATTRIBUTE_UNUSED);
 static int openvzClose(virConnectPtr conn);
 static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED);
 static int openvzListDomains(virConnectPtr conn, int *ids, int nids);
@@ -554,35 +555,37 @@ bail_out5:
 }
 
 static virDrvOpenStatus openvzOpen(virConnectPtr conn,
-                                   const char *name,
-                                   int *credtype ATTRIBUTE_UNUSED,
-                                   int ncredtype ATTRIBUTE_UNUSED,
-                                   virConnectAuthCallbackPtr cb ATTRIBUTE_UNUSED,
-                                   void *cbdata ATTRIBUTE_UNUSED,
-                                   int flags ATTRIBUTE_UNUSED) {
-    struct openvz_vm *vms;
-
-    /* Just check if the guy is root. Nothing really to open for OpenVZ */
-    if (getuid()) { // OpenVZ tools can only be used by r00t
-            return VIR_DRV_OPEN_DECLINED;
-    } else {
-        if (strcmp(name, "openvz:///system")) 
-            return VIR_DRV_OPEN_DECLINED;
-    }
+                                 xmlURIPtr uri,
+                                 virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+                                 int flags ATTRIBUTE_UNUSED)
+{
+   struct openvz_vm *vms;
+
+    /*Just check if the user is root. Nothing really to open for OpenVZ */
+   if (getuid()) { // OpenVZ tools can only be used by r00t
+           return VIR_DRV_OPEN_DECLINED;
+   } else {
+       if (uri == NULL || uri->scheme == NULL || uri->path == NULL)
+                   return VIR_DRV_OPEN_DECLINED;
+       if (STRNEQ (uri->scheme, "openvz"))
+                   return VIR_DRV_OPEN_DECLINED;
+       if (STRNEQ (uri->path, "/system"))
+                   return VIR_DRV_OPEN_DECLINED;
+   }
     /* See if we are running an OpenVZ enabled kernel */
-    if(access("/proc/vz/veinfo", F_OK) == -1 || 
-                access("/proc/user_beancounters", F_OK) == -1) {
-        return VIR_DRV_OPEN_DECLINED;
-    }
+   if(access("/proc/vz/veinfo", F_OK) == -1 ||
+               access("/proc/user_beancounters", F_OK) == -1) {
+       return VIR_DRV_OPEN_DECLINED;
+   }
 
-    conn->privateData = &ovz_driver;
+   conn->privateData = &ovz_driver;
 
-    virStateInitialize();
-    vms = openvzGetVPSInfo(conn);
-    ovz_driver.vms = vms;
+   virStateInitialize();
+   vms = openvzGetVPSInfo(conn);
+   ovz_driver.vms = vms;
 
-    return VIR_DRV_OPEN_SUCCESS;
-}
+   return VIR_DRV_OPEN_SUCCESS;
+};
 
 static int openvzClose(virConnectPtr conn) {