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.
For, example, it filters out partitioned physical devices but doesn't do the 
same for MD devices.

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)).

Another example of non-mountable block device is extended MSDOS partition.

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.

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.

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?

Patch #1 will add one more test to demonstrate one of the issues described 
above (partitioned MD device).
Patch #2 will define function which tells if device is partitioned (yes, it 
doesn't work with dm-devices).
Patch #3 fixes the issue with partitioned MD devices.

At the moment don't pay too much attention at the code itself - it is just a 
quick way to demonstrate the issue.

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to