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

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@us.ibm.com> -- Dan Smith IBM Linux Technology Center email: danms@us.ibm.com 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 */

On Tue, Apr 14, 2009 at 11:29:36AM -0700, Dan Smith wrote:
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@us.ibm.com>
ACK, my fault, I had thought we'd implemented this in all drivers already. Will add a test for getHostname to the TCK Daniel -- |: 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 :|

On Tue, Apr 14, 2009 at 11:29:36AM -0700, Dan Smith wrote:
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@us.ibm.com>
Yup, looks fine, applied and commited to CVS, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Dan Smith
-
Daniel P. Berrange
-
Daniel Veillard