On 05/23/2012 05:09 PM, Richard W.M. Jones wrote:
On Wed, May 23, 2012 at 04:45:22PM +0800, Wanlong Gao wrote:
> Kame gave me a very good detail about the use case of virt-diff example, now
> quoted them for you,
>
>> Anyway, in above scheme, we cannot compare the files of the same size.
[...]
virt-ls can find the differences if you use the --checksum option,
because this computes a checksum over the whole file content. If its
just the file date which has changed, it's cheaper to use the --times
option.
http://libguestfs.org/virt-ls.1.html#checksum
http://libguestfs.org/virt-ls.1.html#recursive_long_listing
>> In another point of view....
>>
>> In your example in mailing list, you compares 2 files.
>>
>> But, now, I _think_ what users really want is a command like following.
>>
>> Following command is comparing guest's file of Guest01...Guest04 with
Guest00.
>>
>> # virt-diff -seed Guest00 -name Guest01 -name Guest02 -name Guest03 -name Guest04
/etc/hogehoge
>> Guest03:/etc/hogehoge is differ.
>> diff result...
>>
>> In this case, only Guest03 has a different contents of the file.
>>
>> For system-admin, this means...
>> - Guest00,01,02,04 are correct and 03 is wrong
>> or
>> - Guest03 is correct and Guest00,01,02,04 are wrong.
>> or
>> - Guest03 has different settings intentionally and he confirmed that.
>>
>> This command will be very good for system-admin.
>
> Then, any thoughts about this tool ?
It sounds useful, but I think you could still implement this on top of
virt-ls.
> and more thoughts about implementing this ?
> We should implement a "diff" wrapper in the guestfsd, and use this API
when
> implementing this tool or any other methods?
The problem with adding 'diff' as an operation to the daemon is that
you would need to attach the disks from multiple guests to a single
appliance. This is in general problematic, although we do it in some
limited cases:
http://libguestfs.org/guestfs-performance.1.html#reducing_the_number_of_t...
If you wanted to write a separate virt-diff tool, it's probably a good
idea to start with the source of virt-ls and work from there. That
program already knows how to iterate over the filesystem (of a single
guest), and you could build diff functionality on top of that:
https://github.com/libguestfs/libguestfs/blob/0e05e9f6ce696cf2a5172eda3fe...
I looked into this, now Rich, I have a more question,
if we doing like
virt-diff --seed Guest0 -d Guest1 -d Guest2 /etc
We can mount the device of Guest0 to "/", but where the devices from Guest1 and
Guest2 can be mounted?
Because when doing diff, doesn't like virt-df can iterate these, but we should mount
at least two devices
at the same time for example the root or Guest0 and Guest1.
Thanks,
Wanlong Gao