On Tue, Jan 23, 2018 at 12:44:10AM +0200, Mykola Ivanets wrote:
Before I rush to change something I request your comments on the subject. Let me know what do you think and if it does make sense.
The issue: guesfs_list_filesystems is inconsistent in its output.
The concept of guestfs_list_filesystem is that it returns a list something like the list that running ‘df’ inside a traditional Unix would return, ie. a list of mounted filesystems backed by real devices, plus swap. That's not an exact definition. A better way to understand it might be to look at how it is is used (ie. ‘git grep list[-_]filesystems’).
For, example, it filters out partitioned physical devices but doesn't do the same for MD devices.
Yes, this is a bug. I agree that the approach in your patches (ie. filtering out explicitly partitioned devices) is better than the current ad-hoc approach of listing whole devices, then partitioned devices, then trying to remove whole devices uses a complicated StringSet operation.
More over, according to its name and API documentation guestfs_list_filesystem should return something which potentially can be mounted (SWAP is an exclusion and it is stated in API doc). It is the reason partitioned physical devices are filtered out: they are not mountable even in theory (they don't contain filesystem if they contain partition(s)).
Yes.
Another example of non-mountable block device is extended MSDOS partition.
Do we return extended partitions? I thought not ..
Also nothing stops you from creating partition table and partitions on logical volume (yes, it is probably uncommon but nevertheless). In this case such partitions are ignored completely.
This is a bit of a corner case that we probably shouldn't spend too much time on. Most ordinary Linux guests would also ignore these (they probably indicate nested VMs).
Yet another example is Windows dynamic disks aka LDM: guestfs_list_filesystems returns both ldm_vol_ and ldm_part_ but strongly speaking only volumes should be considered as mountables.
I think this is a bug too.
And last example is again with Windows dynamic disks and their physical counterparts: guestfs_list_filesystems filters out disks with MBR type byte 0x42 but what about GPT?
Again, likely to be a bug. More comments in the patches ... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/