[libvirt] [PATCH] lxc: Add lxcGetHostname()

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

 



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 <danms@xxxxxxxxxx>

-- 
Dan Smith
IBM Linux Technology Center
email: danms@xxxxxxxxxx

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
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]