[PATCH 0/8 v2 DISCUSSION ONLY] Connecting to live virtual machines
NOTE: This is HIGHLY EXPERIMENTAL and can eat babies ... Modify the guest libvirt XML to add the virtio-serial channel: <channel type='unix'> <source mode='bind' path='/tmp/socket'/> <target type='virtio' name='org.libguestfs.channel.0'/> </channel> In the guest, compile guestfsd and run it like this: sudo daemon/guestfsd -rv (XXX - should current directory be / ...?) In the host connect using: sudo guestfish -d GuestName --live
<fs> run <fs> ll / etc.
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
On Fri, Jan 28, 2011 at 07:39:09PM +0000, Richard W.M. Jones wrote:
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
From 4891a885aa7058faba901c059f08ddfbc5d43159 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones <rjones@redhat.com> Date: Fri, 28 Jan 2011 19:25:02 +0000 Subject: [PATCH 8/8] fish: Add guestfish --live, guestmount --live options.
The other programs have the variable, but the flag is not enabled either because it doesn't make sense or because the implications are not well understood. --- cat/virt-cat.c | 2 ++ cat/virt-filesystems.c | 2 ++ cat/virt-ls.c | 2 ++ df/main.c | 2 ++
I would have thought it was ok to support --live in these 4, since they're readonly apps in any case.
fish/fish.c | 5 +++++ fish/guestfish.pod | 5 +++++ fish/inspect.c | 6 ++++++ fish/options.h | 1 + fish/virt.c | 4 ++++ fuse/guestmount.c | 5 +++++ fuse/guestmount.pod | 5 +++++ inspector/virt-inspector.c | 2 ++ rescue/virt-rescue.c | 2 ++
--live probably isn't useful for virt-rescue since if you need to rescue a machine it likely isn't running correctly & thus not have a guestfsd available. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
On Thu, Feb 03, 2011 at 03:15:08PM +0000, Daniel P. Berrange wrote:
On Fri, Jan 28, 2011 at 07:39:09PM +0000, Richard W.M. Jones wrote: [...]
Thanks for reviewing these. I'm trying to get something I can push (even partial) before I go on holiday.
From 4891a885aa7058faba901c059f08ddfbc5d43159 Mon Sep 17 00:00:00 2001 From: Richard W.M. Jones <rjones@redhat.com> Date: Fri, 28 Jan 2011 19:25:02 +0000 Subject: [PATCH 8/8] fish: Add guestfish --live, guestmount --live options.
The other programs have the variable, but the flag is not enabled either because it doesn't make sense or because the implications are not well understood. --- cat/virt-cat.c | 2 ++ cat/virt-filesystems.c | 2 ++ cat/virt-ls.c | 2 ++ df/main.c | 2 ++
I would have thought it was ok to support --live in these 4, since they're readonly apps in any case.
That argument is an argument _against_ doing it :-) Currently there is nothing special about --ro in the protocol. What happens is that we add the drives using 'add-drive-ro' which uses qemu's snapshot facility to unwind any writes: an anonymous snapshot is mounted over each drive, writes are permitted, but they only update the snapshot which is discarded at the end. Thus you can use --ro / 'add_drive_ro' and your program can write merrily away, safe in the knowledge that writes are being discarded by qemu. Your program can even read back the results of its writes. In fact in virt-resize we deliberately write to read-only drives. The point anyway is the protocol itself does not have a "read only mode" or any understanding of which operations are read-only vs write. Some operations which seem like they must be read-only (eg. 'mount-ro') can write to the disk. The anonymous snapshot is what saves us from having 'mount-ro' modify the superblock last mount times, replay the journal, etc. In the case of a live guest, we are able to write and there is no snapshotting to unwind any changes we make. 'virt-cat', 'virt-df' and others almost certainly will make unintentional changes to live guests (definitely mounting and unmounting filesystems), and thus it is not safe to use them until we have very carefully inspected the code and/or they are modified to behave properly when run on a live guest.
fish/fish.c | 5 +++++ fish/guestfish.pod | 5 +++++ fish/inspect.c | 6 ++++++ fish/options.h | 1 + fish/virt.c | 4 ++++ fuse/guestmount.c | 5 +++++ fuse/guestmount.pod | 5 +++++ inspector/virt-inspector.c | 2 ++ rescue/virt-rescue.c | 2 ++
--live probably isn't useful for virt-rescue since if you need to rescue a machine it likely isn't running correctly & thus not have a guestfsd available.
Agreed. Because of "direct mode"[1] it's not likely virt-rescue could ever have a --live option. Use ssh :-) Rich. [1] http://libguestfs.org/guestfs.3.html#guestfs_set_direct -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Fri, Jan 28, 2011 at 07:36:34PM +0000, Richard W.M. Jones wrote:
NOTE: This is HIGHLY EXPERIMENTAL and can eat babies ...
Modify the guest libvirt XML to add the virtio-serial channel:
<channel type='unix'> <source mode='bind' path='/tmp/socket'/> <target type='virtio' name='org.libguestfs.channel.0'/> </channel>
In the guest, compile guestfsd and run it like this:
sudo daemon/guestfsd -rv
(XXX - should current directory be / ...?)
Yeah, I think it makes sense to have it chdir(/) so that it doesn't accidentally cause a random FS to remain busy.
In the host connect using:
sudo guestfish -d GuestName --live
<fs> run <fs> ll / etc.
I think this series all looks fine. Obviously the main implication you mentioned before is that we'll need to be strict about the RPC wire back-compat support from this point forward. Also need a init script (or systemd unit) to start the guestfsd if-only-if it sees the virtio socket present inside the guest. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
On Thu, Feb 03, 2011 at 03:17:39PM +0000, Daniel P. Berrange wrote:
I think this series all looks fine. Obviously the main implication you mentioned before is that we'll need to be strict about the RPC wire back-compat support from this point forward.
Indeed .. I need to go back over the protocol and features to make sure there's no immediate feature we need which would require a change in the protocol. In any case, nothing would be binding until 1.10 is released. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
I have PUSHED these patches to the repository. Note that these could eat babies, so please treat with caution. You might want to roll back to the 1.9.7 tag if you want something more stable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
participants (2)
-
Daniel P. Berrange -
Richard W.M. Jones