This patch adds the getHostname method to the lxc driver structure
(using the qemu driver's generic code).  Apparently virsh started
using that method during console attachment recently.  Without this
implementation, the virsh refused to attach to lxc consoles.

Signed-off-by: Dan Smith <[email protected]>

-- 
Dan Smith
IBM Linux Technology Center
email: [email protected]

Index: src/lxc_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/lxc_driver.c,v
retrieving revision 1.65
diff -u -r1.65 lxc_driver.c
--- src/lxc_driver.c    31 Mar 2009 15:47:17 -0000      1.65
+++ src/lxc_driver.c    14 Apr 2009 18:22:45 -0000
@@ -1404,6 +1404,20 @@
     return ret;
 }
 
+static char *lxcGetHostname (virConnectPtr conn)
+{
+    char *result;
+
+    result = virGetHostname();
+    if (result == NULL) {
+        virReportSystemError (conn, errno,
+                              "%s", _("failed to determine host name"));
+        return NULL;
+    }
+    /* Caller frees this string. */
+    return result;
+}
+
 /* Function Tables */
 static virDriver lxcDriver = {
     VIR_DRV_LXC, /* the number virDrvNo */
@@ -1413,7 +1427,7 @@
     NULL, /* supports_feature */
     NULL, /* type */
     lxcVersion, /* version */
-    NULL, /* getHostname */
+    lxcGetHostname, /* getHostname */
     NULL, /* getMaxVcpus */
     NULL, /* nodeGetInfo */
     NULL, /* getCapabilities */

--
Libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to