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

[Libvir] [PATCH] #6: Change xenUnifiedGetMaxVcpus to make direct calls to the underlying driver




Because the type field is now missing from xenUnifiedDriver, the old
method of implementing xenUnifiedGetMaxVcpus didn't work.  There's only
one underlying driver which can implement this anyway, so just make the
call directly.

Rich.


--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903

diff -u -p -r1.14 xen_unified.c
--- src/xen_unified.c	26 Jun 2007 11:42:46 -0000	1.14
+++ src/xen_unified.c	3 Jul 2007 15:01:39 -0000
@@ -276,17 +269,17 @@ xenUnifiedGetURI (virConnectPtr conn)
 static int
 xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
 {
-    GET_PRIVATE(conn);
-    int i;
-
-    if (!type)
-        type = "Xen";
-
-    for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
-        if (priv->opened[i] && strcmp (drivers[i]->name, type) == 0)
-            return drivers[i]->getMaxVcpus (conn, type);
+    if (type && STRCASENEQ (type, "Xen")) {
+        xenUnifiedError (conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        return -1;
+    }
 
-    return -1;
+    if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET])
+        return xenHypervisorGetMaxVcpus (conn, type);
+    else {
+        xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+        return -1;
+    }
 }
 
 static int

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


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