On Tue, May 01, 2018 at 03:54:04AM +0300, Mykola Ivanets wrote:
Extended MBR partitions cannot hold filesystems - filter them out.
---
daemon/listfs.ml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
index fa7813378..2ed7da6e3 100644
--- a/daemon/listfs.ml
+++ b/daemon/listfs.ml
@@ -83,7 +83,7 @@ and is_not_partitioned_device device =
* to read them will cause errors (RHBZ#887520). Assuming that
* libguestfs was compiled with ldm support, we'll get the filesystems
* on these later. We also ignore Microsoft Reserved Partition and
- * Windows Snapshot Partition.
+ * Windows Snapshot Partition as well as MBR extended partitions.
*)
and is_partition_can_hold_filesystem partition =
let device = Devsparts.part_to_dev partition in
@@ -106,10 +106,17 @@ and is_partition_can_hold_filesystem partition =
| "E3C9E316-0B5C-4DB8-817D-F92DF00215AE"
(* Windows Snapshot Partition. *)
| "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false
- | _ -> true
+ | _ -> not (is_mbr_extended parttype device partnum)
This is a bit confusing. I think the equivalent can be
achieved by changing the final function to:
if is_gpt_or_mbr then (
if is_mbr_extended parttype device partnum then
false
else (
(* MBR partition id will be converted into corresponding GPT type. *)
let gpt_type = Parted.part_get_gpt_type device partnum in
match gpt_type with
(* Windows Logical Disk Manager metadata partition. *)
| "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3"
(* Windows Logical Disk Manager data partition. *)
| "AF9B60A0-1431-4F62-BC68-3311714A69AD"
(* Microsoft Reserved Partition. *)
| "E3C9E316-0B5C-4DB8-817D-F92DF00215AE"
(* Windows Snapshot Partition. *)
| "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false
| _ -> true
)
)
else true
The other patches (where I didn't have comments) look OK to me.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v