Jeff Brower
2015-Feb-10 20:09 UTC
[Libguestfs] host Linux - guest Win7 fast file sharing [was: getting guestfs_rsync_out to work]
Update: Using mount (read-only) and unmount commands in a script that loops continuously, we are able to see near instantaneous file modifications (less than 0.5 sec) performed on a Win7 live guest. We have to use the sync.exe utility (technet.microsoft.com/en-us/sysinternals/bb897438.aspx), otherwise changes are not visible for 10-20 sec. We tested sync.exe with our libguestfs test program (using various methods, including rsync_out, and w/wo sync on Linux side), but we're still not able to see live guest file changes until we relaunch the image. Any advice on how to get around the relaunch requirement (which takes 3-5 sec due to loading the appliance Linux kernel), would be greatly appreciated. There are many reasons why using libguestfs is a better solution for us in the long run. Thanks. -Jeff ---------------- Original Message --------------- Subject: Re: [Libguestfs] getting guestfs_rsync_out to work From: "Jeff Brower" <jbrower@signalogic.com> Date: Mon, February 9, 2015 3:39 pm To: "Richard W.M. Jones" <rjones@redhat.com> Cc: libguestfs@redhat.com ------------------------------------------------- Richard-> On Mon, Feb 09, 2015 at 08:27:22AM -0600, Jeff Brower wrote: >> Yes we know that it doesn't know. We'd be ok to re-launch the image to pick up changes except for the time ittakes (if we could get into 1 to 10 msec range it would be ok).> > There's no feasible way to start a Linux kernel in under about 1-2 seconds. It just takes that long for the kernelto initialize itself. Even if you use the User-mode Linux backend (which just runs vmlinux as a userspace process) you'll experience approximately the same overhead. Ok got it. Thanks again for your reply. We tried guestfs_drop_caches() as follows: while(1) { guestfs_mount(g, "/dev/sda2", "/"); printf("%s\n", guestfs_cat(g, "/HostShared/temp.txt")); guestfs_umount(g, "/"); guestfs_drop_caches(g, 3); usleep(1000*1000); } and still we cannot see changes made to temp.txt (from inside the Win7 guest VM) while this loop continues to run on the host Linux. We still have to re-launch the image to see changes. In general, it would be great if the "kernel load" and "disk refresh / sync" functions in guestfs_launch() could be separated. If there was a way to do read-only file sharing, a very limited subset of what virtFs/9p can do, that would be great for Win guests. -Jeff
Richard W.M. Jones
2015-Feb-11 14:07 UTC
Re: [Libguestfs] host Linux - guest Win7 fast file sharing [was: getting guestfs_rsync_out to work]
On Tue, Feb 10, 2015 at 02:09:33PM -0600, Jeff Brower wrote:> Using mount (read-only) and unmount commands in a script that loops > continuously, we are able to see near instantaneous file > modifications (less than 0.5 sec) performed on a Win7 live guest. > We have to use the sync.exe utility > (technet.microsoft.com/en-us/sysinternals/bb897438.aspx), otherwise > changes are not visible for 10-20 sec. > > We tested sync.exe with our libguestfs test program (using various > methods, including rsync_out, and w/wo sync on Linux side), but > we're still not able to see live guest file changes until we > relaunch the image. Any advice on how to get around the relaunch > requirement (which takes 3-5 sec due to loading the appliance Linux > kernel), would be greatly appreciated. There are many reasons why > using libguestfs is a better solution for us in the long run.It's not too surprising that sync doesn't work on the libguestfs appliance side. BTW you probably should also change the caching mode in qemu to `none' or maybe `directsync' (default is now `writeback'). Unfortunately about 18 months ago we changed the caching modes and removed the possibility of using `none': https://rwmj.wordpress.com/2013/09/02/new-in-libguestfs-allow-cache-mode-to-be-selected/ So you'd have to patch libguestfs to add it back -- it's a fairly straightforward patch. I still think what you're trying to do is going to go wrong in unexpected ways. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html