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.
This commit is contained in:
Maxim Perevedentsev
2016-07-08 14:08:10 +03:00
committed by Richard W.M. Jones
parent d6bba9bc42
commit f90185dfdf
2 changed files with 7 additions and 5 deletions

View File

@@ -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). */

View File

@@ -9103,7 +9103,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 (
@@ -9111,9 +9111,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