[Libguestfs] [PATCH] inspect: get windows drive letters for GPT disks.

Richard W.M. Jones rjones at redhat.com
Fri Feb 5 21:10:22 UTC 2016


On Fri, Feb 05, 2016 at 02:54:22PM -0500, Dawid Zamirski wrote:
> First, thank you for a prompt review. Yes, I meant to use
> guestfs_list_filesystems for save myself from doing nested loops - one
> to pull list of devices (guestfs_list_devices) and another to loop
> through partitions on each device. If that's a problem, please let me
> know and I'll change it to follow what map_registry_blob does.

guestfs_list_filesystems probably doesn't do what you want.  It's at
least theoretically possible for a (eg. dual boot) VM to contain both
Windows and Linux LVs, in which case guestfs_list_filesystems would
return non-device non-partitions.

guestfs_list_partitions will return a list of partitions, like:

  [ "/dev/sda1", "/dev/sda2", "/dev/sdb1", "/dev/sdb2", "/dev/sdb3" ]

which sounds like what you needed.  If you need a two-level loop
reading devices -> partitions per device, then you need to use
guestfs_list_devices in the outer loop and guestfs_part_list in the
inner loop.  Historical API collects warts ...

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW




More information about the Libguestfs mailing list