[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/3] sparsify: fix btrfs subvolume processing in is_read_only_lv



Calling guestfs_is_lv on btrfs subvolume throws an error.
Here we workaround it by returning 'false' for subvolumes.
---
 sparsify/utils.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sparsify/utils.ml b/sparsify/utils.ml
index 9a49504..8d99db1 100644
--- a/sparsify/utils.ml
+++ b/sparsify/utils.ml
@@ -34,7 +34,8 @@ let is_read_only_lv (g : G.guestfs) =
       if lv_attr.[1] = 'r' then Some lv_uuid else None
   ) lvs in
   fun fs ->
-    if g#is_lv fs then (
+    (* Btrfs subvolumes are NOT read-only LVs *)
+    if not (is_btrfs_subvolume g fs) && g#is_lv fs then (
       let uuid = g#lvuuid fs in
       List.exists (fun u -> compare_lvm2_uuids uuid u = 0) ro_uuids
     )
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]