[Libguestfs] [PATCH libldm v4 2/3] gtk-doc: update documentation.

2018-05-14 Thread Mykola Ivanets
gtk-doc is updated to reflect presence of new volume GUID field. --- docs/reference/ldmtool/ldmtool.xml | 7 +++ 1 file changed, 7 insertions(+) diff --git a/docs/reference/ldmtool/ldmtool.xml b/docs/reference/ldmtool/ldmtool.xml index 0f2b934..ec52633 100644 ---

[Libguestfs] [PATCH libldm v4 1/3] Make libldm to parse and return volume GUID.

2018-05-14 Thread Mykola Ivanets
LDM volume GUID is a significant piece of information about LDM volume analogously to GPT disk/partition GUID. Windows use volume GUID to keeptrack of assigned drive letters, for example. We extract volume GUID while parsing volume VBLK in _parse_vblk_vol function. "show volume" ldmtool command

[Libguestfs] [PATCH libldm v4 0/3] Make libldm to parse and return volume GUID.

2018-05-14 Thread Mykola Ivanets
D allows to overcome this shortcoming. Mykola Ivanets (3): Make libldm to parse and return volume GUID. gtk-doc: update documentation. Make git to ignore all test output files. docs/reference/ldmtool/ldmtool.xml | 7 ++ src/ldm.c | 29 +

[Libguestfs] [PATCH libldm v4 3/3] Make git to ignore all test output files.

2018-05-14 Thread Mykola Ivanets
All files generted after running "make check" are added into .gitignore. --- test/.gitignore | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index 8ee133a..7e62d30 100644 --- a/test/.gitignore +++

[Libguestfs] [PATCH v5 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.

2018-04-27 Thread Mykola Ivanets
From: Nikolay Ivanets The following partitions are filtered out: 1. Partitioned md devices (just as partitioned physical devices are filtered out). 2. Extended MBR partitions. 3. LDM Partitions (MBR and GPT partitions used by Windows Logical Disk Manager). 4. Microsoft

[Libguestfs] [PATCH v5 0/3] libguestfs: guestfs_list_filesystems: skip block devices which cannot hold file system

2018-04-27 Thread Mykola Ivanets
This patch series: 1. Addresses comments from last review: part_get_mbr_part_type doesn't break original implementation in C. 2. Rebased on top of master and little bit refactored for readability. Mykola Ivanets (1): tests: md: Test guestfish list-filesystems command skips partitioned

[Libguestfs] [PATCH v5 3/3] tests: md: Test guestfish list-filesystems command skips partitioned md devices.

2018-04-27 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH v5 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.

2018-04-27 Thread Mykola Ivanets
From: Nikolay Ivanets Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. MBR partition table can hold up to 4 "primary" partitions. 2. Partition with number greater then 4 is "logical" partition. 3. Partition with number less then or

[Libguestfs] [PATCH libldm v2 1/1] Make libldm to parse and return volume GUID.

2018-05-10 Thread Mykola Ivanets
LDM volume GUID is a significant piece of information about LDM volume analogously to GPT disk/partition GUID. Windows use volume GUID to keeptrack of assigned drive letters, for example. We extract volume GUID while parsing volume VBLK in _parse_vblk_vol function. "show volume" ldmtool command

[Libguestfs] [PATCH libldm v2 0/1] Make libldm to parse and return volume GUID.

2018-05-10 Thread Mykola Ivanets
corresponding volume. But it is not reliable source of information. More over, in multiboot environment it will be unclear which drive letter belongs to which operating system. Volume GUID allows to overcome this shortcoming. Mykola Ivanets (1): Make libldm to parse and return volume GUID. src/ldm.c | 6 --

[Libguestfs] [PATCH 0/1] libldm: Make libldm to parse and return volume GUID.

2018-05-09 Thread Mykola Ivanets
multiboot environment it is unclear which drive letter belongs to which operating system. Volume GUID allows to overcome this shortcomming. Mykola Ivanets (1): libldm: Make libldm to parse and return volume GUID. src/ldm.c | 6 -- src/ldm.h | 10 ++ src/ldmtool.c | 3 ++

[Libguestfs] [PATCH 1/1] libldm: Make libldm to parse and return volume GUID.

2018-05-09 Thread Mykola Ivanets
LDM volume GUID is a significant piece of information about LDM volume analogously to GPT disk/partition GUID. Windows use volume GUID to keep track of assigned drive letters, for example. We extract volume GUID while parsing volume VBLK in _parse_vblk_vol function. "show volume" ldmtool

[Libguestfs] [PATCH libldm] Fix crash while creating mapper for a volume which lacks all components.

2018-05-13 Thread Mykola Ivanets
How to reproduce: 1. Extract test images from test/data/ldm-data.tar.xz 2. losetup --show -f test/data/ldm-2003r2-simple-1.img Let's assume image file was associated with /dev/loop0 3. ldmtool -d /dev/loop0 create all Result: One LDM volume which contains all required components on the

[Libguestfs] [PATCH libldm v3 1/2] Make libldm to parse and return volume GUID.

2018-05-10 Thread Mykola Ivanets
LDM volume GUID is a significant piece of information about LDM volume analogously to GPT disk/partition GUID. Windows use volume GUID to keeptrack of assigned drive letters, for example. We extract volume GUID while parsing volume VBLK in _parse_vblk_vol function. "show volume" ldmtool command

[Libguestfs] [PATCH libldm v3 2/2] Make git to ignore all test output files.

2018-05-10 Thread Mykola Ivanets
All files generted after running "make check" are added into .gitignore. --- test/.gitignore | 39 --- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index 8ee133a..7e62d30 100644 --- a/test/.gitignore +++

[Libguestfs] [PATCH libldm v3 0/2] Make libldm to parse and return volume GUID.

2018-05-10 Thread Mykola Ivanets
rive letter assigned by Windows to corresponding volume. But it is not reliable source of information. More over, in multiboot environment it will be unclear which drive letter belongs to which operating system. Volume GUID allows to overcome this shortcoming. Mykola Ivanets (2): Make libldm to par

[Libguestfs] [PATCH] daemon: inspect: better handling windows drive mapping.

2018-05-18 Thread Mykola Ivanets
I have several Windows disk images which contains strange registry entry for mapped drives: "\\DosDevices\\Y:"=hex(3):00,00,00,00,00,00,00,00,00,00,00,00 Which is decoded something like diskID = 0x0, partition starts at 0 bytes from the start of the disk. In addition of Windows disk image I

[Libguestfs] [PATCH libldm v2 0/1] Fix crash while creating mapper for a volume which lacks of partitions.

2018-05-15 Thread Mykola Ivanets
v1 was here: https://www.redhat.com/archives/libguestfs/2018-May/msg00058.html v2: - more correct explanation of a crash reason. Mykola Ivanets (1): Fix crash while creating mapper for a volume which lacks of partitions. src/ldm.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[Libguestfs] [PATCH libldm v2 1/1] Fix crash while creating mapper for a volume which lacks of partitions.

2018-05-15 Thread Mykola Ivanets
How to reproduce: 1. Extract test images from test/data/ldm-data.tar.xz 2. losetup --show -f test/data/ldm-2003r2-simple-1.img Let's assume image file was associated with /dev/loop0 3. ldmtool -d /dev/loop0 create all Result: One LDM volume which contains all required components on the

[Libguestfs] [PATCH libldm 02/12] Change the way we sanitise LDM partition name.

2018-05-15 Thread Mykola Ivanets
libdevmapper limits allowed characters for device name. Character whitelist: 0-9, A-Z, a-z, #+-.:=@_. LDM partition name is composed of disk group name and partition name. Disk group is named after the machine, with a "DgN" suffix; partition name is a disk name with a numerical suffix -

[Libguestfs] [PATCH libldm 01/12] Requires libdevmapper v1.02.

2018-05-15 Thread Mykola Ivanets
libdevmapper v1.02 is available for more then 13 years already and it provides newer API which will allow to simplify code base. --- configure.ac | 2 +- ldm-1.0.pc.in | 2 +- libldm.spec.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac

[Libguestfs] [PATCH libldm 03/12] Clarify ldm_volume_dm_get_name function documentation.

2018-05-15 Thread Mykola Ivanets
Emphasis that returned name is unmangled. --- src/ldm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ldm.h b/src/ldm.h index 280fbfb..cdc5817 100644 --- a/src/ldm.h +++ b/src/ldm.h @@ -443,7 +443,8 @@ guint64 ldm_volume_get_chunk_size(const LDMVolume *o); * @o: An

[Libguestfs] [PATCH libldm 04/12] Set UUID for device mapper devices (partitions and volumes).

2018-05-15 Thread Mykola Ivanets
Device mapper device UUID (alongside with device name) is an unique characteristic of device. However libldm didn't set device UUID. Also "dmsetup" user space tool has "mangle" command which issue a warning if device doesn't have UUID. Let's set UUID for created devices to be consistent with DM

[Libguestfs] [PATCH libldm 12/12] New API: ldm_partition_dm_get_device

2018-05-15 Thread Mykola Ivanets
New API method is introduced - ldm_partition_dm_get_device(...) which returns device mapper device after it have been created or NULL otherwise. ldmtool "show partition" command displays "device" field if corresponding device mapper device have been created for the specified partition. Field is

[Libguestfs] [PATCH libldm 06/12] Use device mapper device UUID instead of name to find device in a tree.

2018-05-15 Thread Mykola Ivanets
libdevmapper provides dm_tree_find_node_by_uuid function which we can use to find device in a tree and get rid of our own implementation. --- src/ldm.c | 52 1 file changed, 12 insertions(+), 40 deletions(-) diff --git a/src/ldm.c b/src/ldm.c

[Libguestfs] [PATCH libldm 11/12] New API: ldm_volume_dm_get_device

2018-05-15 Thread Mykola Ivanets
New API method is introduced - ldm_volume_dm_get_device(...) which returns device mapper device after it have been created or NULL otherwise. ldmtool "show volume" command displays "device" field if corresponding device mapper device have been created for the specified volume. Field is omitted

[Libguestfs] [PATCH libldm 10/12] misc: don't make unnecessary functions calls, return correct result.

2018-05-15 Thread Mykola Ivanets
Don't make unnecessary function calls in show_ functions family until we find requested object (volume, partition etc.). Also make sure the functions return correct result. --- src/ldmtool.c | 48 +--- 1 file changed, 25 insertions(+), 23 deletions(-)

[Libguestfs] [PATCH libldm 09/12] Move devmapper logging functionality into a single place.

2018-05-15 Thread Mykola Ivanets
Custom device mapper logging is initialized during libdm library initialization in one place. --- src/ldm.c | 87 +-- 1 file changed, 40 insertions(+), 47 deletions(-) diff --git a/src/ldm.c b/src/ldm.c index f31a0aa..16934d6 100644 ---

[Libguestfs] [PATCH libldm 07/12] refactoring: search for device-mapper node in tree.

2018-05-15 Thread Mykola Ivanets
Searching for device node in device mapper tree is used twice. So let's extract this functionality into a separate reusable function. --- src/ldm.c | 62 +-- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/src/ldm.c b/src/ldm.c

[Libguestfs] [PATCH libldm 00/12] New API: an ability to retrieve created device-mapper devices back after they have been created.

2018-05-15 Thread Mykola Ivanets
. Any comments re welcomed. -- Mykola Ivanets Mykola Ivanets (12): Requires libdevmapper v1.02. Change the way we sanitise LDM partition name. Clarify ldm_volume_dm_get_name function documentation. Set UUID for device mapper devices (partitions and volumes). Fix potential memory leak

[Libguestfs] [PATCH libldm 08/12] Don't use hard-coded path to a device mapper directory.

2018-05-15 Thread Mykola Ivanets
Get path to a device mapper directory calling "dm_dir" function from devmapper library instead of using hard-coded value "/dev/mapper". --- src/ldm.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ldm.c b/src/ldm.c index ac6bae8..f31a0aa 100644 --- a/src/ldm.c +++

[Libguestfs] [PATCH libldm 05/12] Fix potential memory leak.

2018-05-15 Thread Mykola Ivanets
Potential memory leak in ldm_volume_dm_create and ldm_volume_dm_remove functions is fixed. Leak was possible if the caller doesn't want to get back created or remove device name, passing NULL as a second argument. --- src/ldm.c | 20 +--- 1 file changed, 17 insertions(+), 3

[Libguestfs] [PATCH v2] daemon: inspect: better handling windows drive mapping.

2018-05-31 Thread Mykola Ivanets
I saw several Windows disk images which contains strange registry entry for mapped drives: "\\DosDevices\\Y:"=hex(3):00,00,00,00,00,00,00,00,00,00,00,00 Which is decoded something like diskID = 0x0, partition starts at 0 bytes offset from the start of the disk. In addition to a Windows disk

[Libguestfs] [PATCH v8 4/6] daemon: list-filesystems: Change the way we filter out LDM partitions.

2018-05-31 Thread Mykola Ivanets
1. Now we use GPT partition type to filter out LDM partitions. 2. We also check for filesystems on LDM volumes because LDM partitions doesn't contain filesystems (list_ldm_partitions is not called anymore). 3. Obvious repetitive comments are moved to a function description. --- daemon/listfs.ml |

[Libguestfs] [PATCH v8 3/6] tests: list-filesystems command ignores partitioned MD devices.

2018-05-31 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH v8 6/6] daemon: list-filesystems: Filter out MBR extended partitions.

2018-05-31 Thread Mykola Ivanets
Extended MBR partitions cannot hold filesystems - filter them out. --- daemon/listfs.ml | 37 - 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 57f2f622d..908e59cc4 100644 --- a/daemon/listfs.ml +++

[Libguestfs] [PATCH v8 0/6] daemon: list_filesystems: filter out block devices which cannot hold filesystem.

2018-05-31 Thread Mykola Ivanets
: - partitioned MD devices; - LDM partitions (only LDM volume can hold filesystem); - Windows Logical Disk Manager data partition; - Microsoft Reserved Partition; - Windows Snapshot Partition; - MBR extended partition. Mykola Ivanets (6): daemon: Changing the way that we detect if a device contains

[Libguestfs] [PATCH v8 2/6] daemon: list-filesystems: Ignore partitioned MD devices.

2018-05-31 Thread Mykola Ivanets
Ignore partitioned MD devices the same way we ignore regular partitioned devices because they cannot contain filesystems as well. --- daemon/listfs.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index eced55bce..10b1a8594 100644 ---

[Libguestfs] [RFC] fuse: mount_local: Fix crash when called from Java binding

2018-05-02 Thread Mykola Ivanets
"localmountpoint" parameter is allocated in JNI before calling mount_local and freed afterward. But guestfs handle keeps reference to passed "localmountpoint" argument and will try to use and free it in umount_local which leads to a crash because an attempt to access already freed memory region.

[Libguestfs] [PATCH v2] fuse: mount_local: Fix crash when called from Java binding.

2018-05-02 Thread Mykola Ivanets
"localmountpoint" parameter is allocated in JNI before calling mount_local and freed afterward. But guestfs handle keeps reference to passed "localmountpoint" parameter and will try to access it in umount_local and free after mount_local_run caller thread ends which leads to a crash (an attempt

[Libguestfs] [PATCH v7 4/6] daemon: list-filesystems: Change the way we filter out LDM partitions.

2018-05-02 Thread Mykola Ivanets
1. Now we use GPT partition type to filter out LDM partitions. 2. We also check for filesystems on LDM volumes because LDM partitions doesn't contain filesystems (list_ldm_partitions is not called anymore). 3. Obvious repetitive comments are moved to a function description. --- daemon/listfs.ml |

[Libguestfs] [PATCH v7 1/6] daemon: Changing the way that we detect if a device contains partitions.

2018-05-02 Thread Mykola Ivanets
Instead of using part_to_dev to find such devices we open the device's directory under /sys/block/ and look for entries starting with , eg. /sys/block/sda/sda1. --- daemon/listfs.ml | 41 ++--- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git

[Libguestfs] [PATCH v7 6/6] daemon: list-filesystems: Filter out MBR extended partitions.

2018-05-02 Thread Mykola Ivanets
Extended MBR partitions cannot hold filesystems - filter them out. --- daemon/listfs.ml | 37 - 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 57f2f622d..908e59cc4 100644 --- a/daemon/listfs.ml +++

[Libguestfs] [PATCH v7 0/6] daemon: list_filesystems: filter out block devices which cannot hold filesystem.

2018-05-02 Thread Mykola Ivanets
This patch series addresses comments after v6 series review. Mykola Ivanets (6): daemon: Changing the way that we detect if a device contains partitions. daemon: list-filesystems: Ignore partitioned MD devices. tests: list-filesystems command ignores partitioned MD devices. daemon

[Libguestfs] [PATCH v7 5/6] daemon: list-filesystems: Filter out Microsoft Reserved and Windows Snapshot partitions.

2018-05-02 Thread Mykola Ivanets
Filter out Microsoft Reserved Partition and Windows Snapshot Partition. --- daemon/listfs.ml | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index a1ee38de3..57f2f622d 100644 --- a/daemon/listfs.ml +++ b/daemon/listfs.ml @@

[Libguestfs] [PATCH v7 3/6] tests: list-filesystems command ignores partitioned MD devices.

2018-05-02 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH v7 2/6] daemon: list-filesystems: Ignore partitioned MD devices.

2018-05-02 Thread Mykola Ivanets
Ignore partitioned MD devices the same way we ignore regular partitioned devices because they cannot contain filesystems as well. --- daemon/listfs.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index eced55bce..10b1a8594 100644 ---

[Libguestfs] [PATCH] libldm: fix enumeration of partition table entries

2018-04-26 Thread Mykola Ivanets
The commit fixes the bug in the code which inspects partition table entries in order to find LDM Metadata partion: _read_privhead_gpt function in ldm.c always calls gpt_get_pte function with 0 (zero) as a second argument which causes the described bug. --- src/ldm.c | 2 +- 1 file changed, 1

[Libguestfs] [PATCH v6 6/7] daemon: list-filesystems: Filter out Microsoft Reserved and Windows Snapshot partitions.

2018-04-30 Thread Mykola Ivanets
Filter out Microsoft Reserved Partition and Windows Snapshot Partition. --- daemon/listfs.ml | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 0d71a39db..fa7813378 100644 --- a/daemon/listfs.ml +++ b/daemon/listfs.ml @@

[Libguestfs] [PATCH v6 1/7] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.

2018-04-30 Thread Mykola Ivanets
From: Nikolay Ivanets Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. MBR partition table can hold up to 4 "primary" partitions. 2. Partition with number greater then 4 is "logical" partition. 3. Partition with number less then or

[Libguestfs] [PATCH v6 3/7] daemon: list-filesystems: Ignore partitioned MD devices.

2018-04-30 Thread Mykola Ivanets
Ignore partitioned MD devices the same way we ignore regular partitioned devices because they cannot contain filesystems as well. --- daemon/listfs.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 55ace8e9c..4014e3fe9 100644 ---

[Libguestfs] [PATCH v6 7/7] daemon: list-ilesystems: Filter out MBR extended partitions.

2018-04-30 Thread Mykola Ivanets
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

[Libguestfs] [PATCH v6 2/7] daemon: Changing the way that we detect if a device contains partitions.

2018-04-30 Thread Mykola Ivanets
Instead of using part_to_dev to find such devices we open the device's directory under /sys/block/ and look for entries starting with , eg. /sys/block/sda/sda1. --- daemon/listfs.ml | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git

[Libguestfs] [PATCH v6 0/7] daemon: list_filesystems: filter out block devices which cannot hold filesystem

2018-04-30 Thread Mykola Ivanets
This patch series: 1. Addresses comments from v5 series review 2. Large commit is splitted to more granular commits for better code review. Mykola Ivanets (6): daemon: Changing the way that we detect if a device contains partitions. daemon: list-filesystems: Ignore partitioned MD devices

[Libguestfs] [PATCH v6 4/7] tests: list-filesystems command ignores partitioned MD devices.

2018-04-30 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH v6 5/7] daemon: list-filesystems: Change the way we filter out LDM partitions.

2018-04-30 Thread Mykola Ivanets
1. Now we use GPT partition type to filter out LDM partitions. 2. We also check for filesystems on LDM volumes because LDM partitions doesn't contain filesystems (list_ldm_partitions is not called anymore). 3. Obvious repetitive comments are moved to a function description. --- daemon/listfs.ml |

[Libguestfs] [PATCH v2 1/3] appliance: init: Avoid running degraded md devices

2018-01-14 Thread Mykola Ivanets
The issue: - raid1 will be in degraded state if one of its components is logical volume (LV) - raid0 will be inoperable at all (inacessible from within appliance) if one of its component is LV - raidN: you can expect the same issue for any raid level depends on how many components are

[Libguestfs] [PATCH v2 2/3] tests: md: test guestfish finds logical volume on md device

2018-01-14 Thread Mykola Ivanets
Test guestfish finds logical volume (LV) created on md device --- tests/md/Makefile.am | 1 + tests/md/test-lvm-on-md-device.sh | 80 +++ 2 files changed, 81 insertions(+) create mode 100755 tests/md/test-lvm-on-md-device.sh diff --git

[Libguestfs] [PATCH] lib: docs: State that guestfs_list_filesystems is no longer requires to be used soon after launch when nothing is mounted

2018-01-23 Thread Mykola Ivanets
guestfs_list_filesystems uses mount/umount to discover btrfs sub-volumes and since 1.37 it generates random mountpoint so it will longer affect already mounted filesystems if either. --- generator/actions_core.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[Libguestfs] [PATCH v2 1/1] cat: virt-tail: Fix spontaneously failing test

2018-01-14 Thread Mykola Ivanets
According to 'guestfs_sync' API method documentation: "You should always call this if you have modified a disk image, before closing the handle." So, 'guestfish --remote sync' is required because changes made on the disk (guestfish --remote rm /tail) should be visible to 'virt-tail' which works

[Libguestfs] [PATCH v2 3/3] tests: md: test guestfish finds md and LV devices in different combinations

2018-01-14 Thread Mykola Ivanets
Test guestfish finds: 1. md device created from physical block device and LV, 2. md device created from LVs 3. LV created on md device raid0 is used for md device because it is inoperable if one of its components is inaccessible so it is easy observable that md device is missing (raid1 in this

[Libguestfs] [PATCH v2 0/1] appliance: init: Avoid running degraded md devices

2018-01-14 Thread Mykola Ivanets
It is a second version of the earlier sent patch. I've added more clear explanation what does it fix and why the issue happened in first place. Also I split the patch (the patch itself and two independent tests): [PATCH v2 1/3] appliance: init: Avoid running degraded md devices [PATCH v2 2/3]

[Libguestfs] [PATCH v2 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.

2018-01-25 Thread Mykola Ivanets
Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. The function is applicable for MBR partitions only (as noted in documentation and as function name suggests). 2. An attempt to call the function for non-MBR partition fails with "part_get_mbr_part_type

[Libguestfs] [PATCH v2 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.

2018-01-25 Thread Mykola Ivanets
Filter out: 1. Partitioned md devices (as we do this for physial devices). 2. Extended MBR partitions. 3. LDM partitions (MBR and GPT partitions used by Windows Logical Disk Manager) 4. Microsoft Reseved Partitions. --- daemon/devsparts.ml | 13 +++ daemon/devsparts.mli | 1 +

[Libguestfs] [PATCH v2 3/3] tests: md: Test guestfish list-filesystems command skipps partitioned md devices.

2018-01-25 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH v3 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.

2018-01-28 Thread Mykola Ivanets
Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. The function is applicable for MBR partitions only (as noted in documentation and as function name suggests). 2. An attempt to call the function for non-MBR partition fails with "part_get_mbr_part_type

[Libguestfs] [PATCH v3 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.

2018-01-28 Thread Mykola Ivanets
The following partitions are filtered out: 1. Partitioned md devices (just as partitioned physical devices are filtered out). 2. Extended MBR partitions. 3. LDM partitions (MBR and GPT partitions used by Windows Logical Disk Manager). 4. Microsoft Reserved Partitions (GUID

[Libguestfs] guestfs_list_filesystems: skip block devices which cannot hold file system

2018-01-28 Thread Mykola Ivanets
Initial discussion is here: https://www.redhat.com/archives/libguestfs/2018-January/msg00188.html. v2 was posted here: https://www.redhat.com/archives/libguestfs/2018-January/msg00246.html. v3 comparing to v2 is just a rebase with slightly changed commits comments.

[Libguestfs] [PATCH] daemon: consider /etc/mdadm/mdadm.conf while inspecting mountpoints.

2018-09-11 Thread Mykola Ivanets
From: Nikolay Ivanets Inspection code checks /etc/mdadm.conf to map MD device paths listed in mdadm.conf to MD device paths in the guestfs appliance. However on some operating systems (e.g. Ubuntu) mdadm.conf has alternative location: /etc/mdadm/mdadm.conf. This patch consider an alternative

[Libguestfs] [PATCH 1/1] appliance: init: Avoid running degraded md devices

2018-01-12 Thread Mykola Ivanets
'--no-degraded' flag in the first mdadm call inhibits the startup of array unless all expected drives are present. This will prevent starting arrays in degraded state. Second mdadm call (after LVM is scanned) will scan unused yet devices and make an attempt to run all found arrays even they are

[Libguestfs] [RFC] Inconsistent output of guestfs_list_filesystems

2018-01-22 Thread Mykola Ivanets
Before I rush to change something I request your comments on the subject. Let me know what do you think and if it does make sense. The issue: guesfs_list_filesystems is inconsistent in its output. For, example, it filters out partitioned physical devices but doesn't do the same for MD devices.

[Libguestfs] [RFC PATCH v1 2/3] daemon: devsparts: add is_partitioned_device function

2018-01-22 Thread Mykola Ivanets
The function takes one argument - device path (e.g. /dev/sda) and returns true if device contains partition(s) or false otherwise. The function look in /sys/block// for entries starting with , eg. /sys/block/sda/sda1. --- daemon/devsparts.ml | 14 ++ daemon/devsparts.mli | 1 + 2

[Libguestfs] [RFC PATCH v1 3/3] daemon: list-filesystems: Don't list partitioned md devices

2018-01-22 Thread Mykola Ivanets
Filter partitioned md devices out the same way as partitioned physical devices are filtered out --- daemon/listfs.ml | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/daemon/listfs.ml b/daemon/listfs.ml index 370ffb4..dc424f5 100644 ---

[Libguestfs] [RFC PATCH v1 1/3] tests: md: Test guestfish list-filesystems command skipps partitioned md devices

2018-01-22 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and does't take into account md device itself (similar to as physical devices are skipped if they are partitioned) --- tests/md/Makefile.am | 1 + tests/md/test-list-filesystems2.sh | 79

[Libguestfs] [PATCH v4 2/3] daemon: list-filesystems: Don't list partitions which cannot hold file system.

2018-03-12 Thread Mykola Ivanets
The following partitions are filtered out: 1. Partitioned md devices (just as partitioned physical devices are filtered out). 2. Extended MBR partitions. 3. LDM partitions (MBR and GPT partitions used by Windows Logical Disk Manager). 4. Microsoft Reserved Partitions (GUID

[Libguestfs] [PATCH v4 1/3] daemon: Reimplement 'part_get_mbr_part_type' API in OCaml.

2018-03-12 Thread Mykola Ivanets
Instead of parsing 'parted' output OCaml implementation relies on the following facts: 1. The function is applicable for MBR partitions only (as noted in documentation and as function name suggests). 2. An attempt to call the function for non-MBR partition fails with "part_get_mbr_part_type

[Libguestfs] [PATCH v4 0/3] libguestfs: guestfs_list_filesystems: skip block devices which cannot hold file system

2018-03-12 Thread Mykola Ivanets
Rebased. The only thing left unclear is: "Would you like to document behavior for non-MBR partitions more clearly or keep previous implementation despite MBR partition type doesn't make sense for non-MBR partitions at all?" ___ Libguestfs mailing

[Libguestfs] [PATCH v4 3/3] tests: md: Test guestfish list-filesystems command skips partitioned md devices.

2018-03-12 Thread Mykola Ivanets
Test guestfish list-filesystems command finds file system on partitioned md device and doesn't take into account md device itself (similar to as physical devices are filtered out if they are partitioned). --- tests/md/Makefile.am| 3 +-

[Libguestfs] [PATCH nbdkit v2] server: utils: Make nbdkit_parse_size to reject negative values

2019-02-07 Thread Mykola Ivanets
From: Nikolay Ivanets nbdkit_parse_size() uses strtoumax() function to parse input strings which states: "if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow." Later validation

[Libguestfs] [PATCH nbdkit] server: utils: Fix nbdkit_parse_size to correctly handle negative values

2019-02-07 Thread Mykola Ivanets
From: Nikolay Ivanets nbdkit_parse_size() uses strtoumax() function to parse input strings which states: "if there was a leading minus sign, the negation of the result of the conversion represented as an unsigned value, unless the original (nonnegated) value would overflow." Later validation

[Libguestfs] [PATCH] lib: allow to specify physical/logical block size for disks

2020-02-10 Thread Mykola Ivanets
From: Nikolay Ivanets Nowadays there are hard drives and operating systems which support "4K native" sector size. In this mode physical and logical block size exposed to the operating system is equal to 4096 bytes. GPT partition table (as a known example) being created in this mode will place

[Libguestfs] [common PATCH v2 1/1] options: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option parsing and handling for guestfish and other C-based tools which share the same code from this sub-module. '--blocksize' will be a common for almost all libguestfs-based tools and thus parameter description will be repeated

[Libguestfs] [common PATCH v2 0/1] options: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets In v2 I've moved '--blocksize' parameter description into the separate file called blocksize-option.pod so we can include it everywhere we need similar to key-option.pod. v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00096.html Nikolay Ivanets

[Libguestfs] [PATCH v2 1/1] tools: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for guestfish and other C-based tools. This option allows specifying disk sector size. --- align/Makefile.am | 1 + align/scan.c | 8 align/virt-alignment-scan.pod | 2 ++

[Libguestfs] [PATCH v2 0/1] tools: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch depends on changes in 'common' sub-module posted here: https://www.redhat.com/archives/libguestfs/2020-February/msg00099.html v2: Almost the same as v1 except '--blocksize' option description is moved into a common submodule (similar to key-option.pod). v1 was

[Libguestfs] [common PATCH v3 1/1] options: add '--blocksize' option for C-based tools

2020-02-12 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option parsing and handling for guestfish and other C-based tools which share the same code from this sub-module. '--blocksize' will be a common for almost all libguestfs-based tools and thus parameter description will be repeated

[Libguestfs] [common PATCH v3 0/1] options: add '--blocksize' option for C-based tools

2020-02-12 Thread Mykola Ivanets
From: Nikolay Ivanets v3 is just a spelling correction spotted by Eric Blake In v2 I've moved '--blocksize' parameter description into the separate file called blocksize-option.pod so we can include it everywhere we need similar to key-option.pod.

[Libguestfs] [PATCH v3 0/1] tools: add '--blocksize' option for C-based tools

2020-02-13 Thread Mykola Ivanets
From: Nikolay Ivanets This patch depends on changes in 'common' sub-module posted here: https://www.redhat.com/archives/libguestfs/2020-February/msg00150.html v3 fixes issue found during code review: - options now appear in alphabetical order v2: Almost the same as v1 except '--blocksize'

[Libguestfs] [common PATCH v4 1/1] options: add '--blocksize' option for C-based tools

2020-02-13 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option parsing and handling for guestfish and other C-based tools which share the same code from this sub-module. '--blocksize' will be a common for almost all libguestfs-based tools and thus parameter description will be repeated

[Libguestfs] [common PATCH v4 0/1] options: add '--blocksize' option for C-based tools

2020-02-13 Thread Mykola Ivanets
From: Nikolay Ivanets v4 fixes issues found during code review: - whitespace-change-only hunks are removed - options are alphabetically orderred now v3 is just a spelling correction spotted by Eric Blake https://www.redhat.com/archives/libguestfs/2020-February/msg00111.html In v2 I've moved

[Libguestfs] [PATCH v3 1/1] tools: add '--blocksize' option for C-based tools

2020-02-13 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for guestfish and other C-based tools. This option allows specifying disk sector size. --- align/Makefile.am | 1 + align/scan.c | 8 align/virt-alignment-scan.pod | 2 ++

[Libguestfs] [PATCH v2] virt-make-fs: add '--blocksize' option support

2020-02-24 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for virt-make-fs tool. This option allows specifying disk sector size as described in 'guestfs_add_drive_opts' libguestfs API. --- make-fs/make-fs.c| 30 --

[Libguestfs] [RFC] lib: allow to specify physical/logical block size for disks

2020-02-07 Thread Mykola Ivanets
From: Nikolay Ivanets I faced with situation where libguestfs cannot recognize partitions on a disk image which was partitioned on a system with "4K native" sector size support. In order to fix the issue we need to allow users to specify desired physical and/or logical block size per drive

[Libguestfs] [PATCH] virt-get-kernel: add '--blocksize' option support

2020-02-17 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for virt-get-kernel tool. This option allows specifying disk sector size as described in 'guestfs_add_drive_opts' libguestfs API. --- get-kernel/get_kernel.ml | 22 --

[Libguestfs] [PATCH 1/1] virt-make-fs: add '--blocksize' option support

2020-02-18 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for virt-make-fs tool. This option allows specifying disk sector size as described in 'guestfs_add_drive_opts' libguestfs API. --- make-fs/make-fs.c| 28 ++--

[Libguestfs] [PATCH 0/1] virt-make-fs: add '--blocksize' option support

2020-02-18 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds 4096 bytes sector size for output disk. Side notes: While working on this patch I reveal long standing issue: virt-make-fs can fail if source directory/archive contains certain amount of really small or empty files or wide tree of directories. That is

[Libguestfs] [PATCH v2] lib: add support for disks with 4096 bytes sector size

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets Nowadays there are hard drives and operating systems which support "4K native" sector size. In this mode physical and logical block size exposed to the operating system is equal to 4096 bytes. GPT partition table (as a known example) being created in this mode will place

[Libguestfs] [common PATCH] options: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option parsing and handling for guestfish and other C-based tools which share the same code. --- options/options.c | 13 - options/options.h | 125 +++--- 2 files changed, 86

[Libguestfs] [PATCH 1/1] tools: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch adds '--blocksize' command line option for guestfish and other C-based tools. This option allows specifying disk sector size. --- align/scan.c | 8 align/virt-alignment-scan.pod | 12 cat/cat.c | 8

[Libguestfs] [PATCH 0/1] tools: add '--blocksize' option for C-based tools

2020-02-11 Thread Mykola Ivanets
From: Nikolay Ivanets This patch depends on changes in 'common' sub-module posted here: https://www.redhat.com/archives/libguestfs/2020-February/msg00096.html Nikolay Ivanets (1): tools: add '--blocksize' option for C-based tools align/scan.c | 8

  1   2   >