diff options
| author | Richard W.M. Jones <rjones@redhat.com> | 2011-01-27 22:45:50 +0000 |
|---|---|---|
| committer | Richard W.M. Jones <rjones@redhat.com> | 2011-02-03 18:50:45 +0000 |
| commit | 2020eded8a3f381c722abe001be8000723ff2418 (patch) | |
| tree | 8c73f5d633c7a83fb324904e275b692a1e127e06 /src | |
| parent | cfd9513a54778e1ade82dc1eb351ea32416938a8 (diff) | |
Add documentation for attach method.
Diffstat (limited to 'src')
| -rw-r--r-- | src/guestfs.pod | 57 | ||||
| -rw-r--r-- | src/virt.c | 3 |
2 files changed, 59 insertions, 1 deletions
diff --git a/src/guestfs.pod b/src/guestfs.pod index cfd58c97..0b3b6544 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<Note (1):> This is B<highly experimental> and has a tendency to eat +babies. Use with caution. + +I<Note (2):> 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<guestfish(1)> with the I<--live> option will "just work". + +=head3 Using guestfs_set_attach_method + +By calling L</guestfs_set_attach_method> you can change how the +library connects to the C<guestfsd> daemon in L</guestfs_launch> +(read L</ARCHITECTURE> for some background). + +The normal attach method is C<appliance>, where a small appliance is +created containing the daemon, and then the library connects to this. + +Setting attach method to C<unix:I<path>> (where I<path> is the path of +a Unix domain socket) causes L</guestfs_launch> 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<guestfsd> 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</guestfs_add_domain> provides some help for getting the +correct attach method. If you pass the C<live> 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: + + <domain> + ... + <devices> + ... + <channel type='unix'> + <source mode='bind' path='/path/to/socket'/> + <target type='virtio' name='org.libguestfs.channel.0'/> + </channel> + ... + </devices> + </domain> + +L</guestfs_add_domain> extracts C</path/to/socket> and sets the attach +method to C<unix:/path/to/socket>. + +Some of the libguestfs tools (including guestfish) support a I<--live> +option which is passed through to L</guestfs_add_domain> 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, @@ -467,7 +467,8 @@ connect_live (guestfs_h *g, virDomainPtr dom) } if (path == NULL) { - error (g, _("this guest has no libvirt <channel> definition for guestfsd")); + error (g, _("this guest has no libvirt <channel> definition for guestfsd\n" + "See ATTACHING TO RUNNING DAEMONS in guestfs(3) for further information.")); goto cleanup; } |
