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

[Libguestfs] [PATCHv2 2/3] lvm: modify guestfs_is_lv to take mountable



Calling guestfs_is_lv on btrfs subvolume throws an error.
Here we workaround it by taking Mountable instead of Device
and returning 'false' for non-device mountables.
---
 daemon/lvm.c         | 6 ++++--
 generator/actions.ml | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/daemon/lvm.c b/daemon/lvm.c
index 2b61357..4f02206 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -863,9 +863,11 @@ lv_canonical (const char *device, char **ret)

 /* Test if a device is a logical volume (RHBZ#619793). */
 int
-do_is_lv (const char *device)
+do_is_lv (const mountable_t *mountable)
 {
-  return lv_canonical (device, NULL);
+  if (mountable->type != MOUNTABLE_DEVICE)
+    return 0;
+  return lv_canonical (mountable->device, NULL);
 }

 /* Return canonical name of LV to caller (RHBZ#638899). */
diff --git a/generator/actions.ml b/generator/actions.ml
index e0931b8..2a69db8 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -9068,7 +9068,7 @@ I<other> keys." };

   { defaults with
     name = "is_lv"; added = (1, 5, 3);
-    style = RBool "lvflag", [Device "device"], [];
+    style = RBool "lvflag", [Mountable "mountable"], [];
     proc_nr = Some 264;
     tests = [
       InitBasicFSonLVM, Always, TestResultTrue (
@@ -9076,9 +9076,9 @@ I<other> keys." };
       InitBasicFSonLVM, Always, TestResultFalse (
         [["is_lv"; "/dev/sda1"]]), []
     ];
-    shortdesc = "test if device is a logical volume";
+    shortdesc = "test if mountable is a logical volume";
     longdesc = "\
-This command tests whether C<device> is a logical volume, and
+This command tests whether C<mountable> is a logical volume, and
 returns true iff this is the case." };

   { defaults with
--
1.8.3.1


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