From 2020eded8a3f381c722abe001be8000723ff2418 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 27 Jan 2011 22:45:50 +0000 Subject: [PATCH] Add documentation for attach method. --- generator/generator_actions.ml | 9 ++++--- src/guestfs.pod | 57 ++++++++++++++++++++++++++++++++++++++++++ src/virt.c | 3 ++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 192df77..ca2dfe3 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -1105,7 +1105,8 @@ The optional C flag controls whether this call will try to connect to a running virtual machine C process if it sees a suitable EchannelE element in the libvirt XML definition. The default (if the flag is omitted) is never -to try. +to try. See L for more +information. The other optional parameters are passed directly through to C."); @@ -1139,7 +1140,8 @@ The optional C flag controls whether this call will try to connect to a running virtual machine C process if it sees a suitable EchannelE element in the libvirt XML definition. The default (if the flag is omitted) is never -to try. +to try. See L for more +information. The other optional parameters are passed directly through to C."); @@ -1399,7 +1401,8 @@ and the default. Connect to the Unix domain socket I. This method lets you connect to an existing daemon or (using -virtio-serial) to a live guest. +virtio-serial) to a live guest. For more information, see +L. =back"); diff --git a/src/guestfs.pod b/src/guestfs.pod index cfd58c9..0b3b654 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -972,6 +972,63 @@ For example: Note that libguestfs also calls qemu with the -help and -version options in order to determine features. +=head2 ATTACHING TO RUNNING DAEMONS + +I This is B and has a tendency to eat +babies. Use with caution. + +I This section explains how to attach to a running daemon +from a low level perspective. For most users, simply using virt tools +such as L with the I<--live> option will "just work". + +=head3 Using guestfs_set_attach_method + +By calling L you can change how the +library connects to the C daemon in L +(read L for some background). + +The normal attach method is C, where a small appliance is +created containing the daemon, and then the library connects to this. + +Setting attach method to C> (where I is the path of +a Unix domain socket) causes L to connect to an +existing daemon over the Unix domain socket. + +The normal use for this is to connect to a running virtual machine +that contains a C daemon, and send commands so you can read +and write files inside the live virtual machine. + +=head3 Using guestfs_add_domain with live flag + +L provides some help for getting the +correct attach method. If you pass the C option to this +function, then (if the virtual machine is running) it will +examine the libvirt XML looking for a virtio-serial channel +to connect to: + + + ... + + ... + + + + + ... + + + +L extracts C and sets the attach +method to C. + +Some of the libguestfs tools (including guestfish) support a I<--live> +option which is passed through to L thus allowing +you to attach to and modify live virtual machines. + +The virtual machine needs to have been set up beforehand so that it +has the virtio-serial channel and so that guestfsd is running inside +it. + =head2 ABI GUARANTEE We guarantee the libguestfs ABI (binary interface), for public, diff --git a/src/virt.c b/src/virt.c index 4b66cc8..a23ac0a 100644 --- a/src/virt.c +++ b/src/virt.c @@ -467,7 +467,8 @@ connect_live (guestfs_h *g, virDomainPtr dom) } if (path == NULL) { - error (g, _("this guest has no libvirt definition for guestfsd")); + error (g, _("this guest has no libvirt definition for guestfsd\n" + "See ATTACHING TO RUNNING DAEMONS in guestfs(3) for further information.")); goto cleanup; } -- 1.8.3.1