[libvirt] PATCH: Implement capabilities & NUMA APIs in LXC driver

Daniel P. Berrange berrange at redhat.com
Tue Jun 2 10:07:35 UTC 2009


The LXC driver  is missing a implementation  of the capabilities
API, even though it has its capabilities object available in its
internally struct. This patch exposes the capabilities, and also
hooks up the shared NUMA APIs.

Daniel

diff -r 0d3150636e3e src/lxc_driver.c
--- a/src/lxc_driver.c	Thu May 28 11:33:16 2009 +0100
+++ b/src/lxc_driver.c	Thu May 28 11:36:37 2009 +0100
@@ -47,6 +47,7 @@
 #include "veth.h"
 #include "event.h"
 #include "cgroup.h"
+#include "nodeinfo.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_LXC
@@ -115,6 +116,19 @@ static int lxcClose(virConnectPtr conn)
     return 0;
 }
 
+static char *lxcGetCapabilities(virConnectPtr conn) {
+    lxc_driver_t *driver = conn->privateData;
+    char *xml;
+
+    lxcDriverLock(driver);
+    if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
+        virReportOOMError(conn);
+    lxcDriverUnlock(driver);
+
+    return xml;
+}
+
+
 static virDomainPtr lxcDomainLookupByID(virConnectPtr conn,
                                         int id)
 {
@@ -1429,8 +1443,8 @@ static virDriver lxcDriver = {
     lxcVersion, /* version */
     lxcGetHostname, /* getHostname */
     NULL, /* getMaxVcpus */
-    NULL, /* nodeGetInfo */
-    NULL, /* getCapabilities */
+    nodeGetInfo, /* nodeGetInfo */
+    lxcGetCapabilities, /* getCapabilities */
     lxcListDomains, /* listDomains */
     lxcNumDomains, /* numOfDomains */
     lxcDomainCreateAndStart, /* domainCreateXML */
@@ -1478,8 +1492,8 @@ static virDriver lxcDriver = {
     NULL, /* domainInterfaceStats */
     NULL, /* domainBlockPeek */
     NULL, /* domainMemoryPeek */
-    NULL, /* nodeGetCellsFreeMemory */
-    NULL, /* getFreeMemory */
+    nodeGetCellsFreeMemory, /* nodeGetCellsFreeMemory */
+    nodeGetFreeMemory,  /* getFreeMemory */
     NULL, /* domainEventRegister */
     NULL, /* domainEventDeregister */
     NULL, /* domainMigratePrepare2 */

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list