On 03/26/2012 05:00 PM, Richard W.M. Jones wrote:
On Mon, Mar 26, 2012 at 03:59:04PM +0800, Wanlong Gao wrote:
I'd like to know when will you work out the virt-sysprep in Ocaml ? :-D
I meant to write something about our investigations last week. Here we go ...
Requirements:
* Compatible with the current virt-sysprep, but easier to maintain and faster.
* It should work in the "local" and over-libguestfs cases, which means using FUSE.
* The current version is a shell script, so it's customizable by simple editing. I'd like to keep some customizability in the new version.
yeah, please initial your design so I can help doing something. ;)
These requirements could all be satisfied if we had:
* Some kinds of "mount-local" ability, ie. integrating FUSE with the API in some way. [i]
* Custom scripts: virt-sysprep --script foo.sh # runs foo.sh on the guest
This should be the necessary feature.
The problem is how to do the "mount-local". We analyzed this last week on IRC and came up with two possible methods:
(1) We add FUSE support directly to the API, linking with libfuse. This is essentially the same as what was outlined in link [i] back in December 2011.
(2) We add an attach-method "fd:<N>" which allows the file descriptor of the appliance to be passed over to another process. In this case we would allow guestmount to be passed a file descriptor (eg. "guestmount --attach-fd=<NN>") which it would then use exclusively.
But I still can't understand (2), what's the "fd:<N>" used to do? Thanks, Wanlong Gao
The problem with (1) is that we are not confident that it's a good idea to use libfuse as a true library. It doesn't appear that anyone else is using it this way.
The problem with (2) is that it's complex and isn't future compatible with remote libvirt support [ii].
I suspect that we'll need to implement both, and be prepared to throw away a few implementations, before we know really which is the best way to go about this.
Rich.
[i] https://www.redhat.com/archives/libguestfs/2011-December/thread.html#00136
[ii] https://www.redhat.com/archives/libvir-list/2011-September/msg01049.html