1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

report: report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary

State:
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0
  LV    ActLocal       SnapInvalid     MergeFailed
  lvol0 active locally         unknown         unknown

Now with using --binary switch.

Before this patch (lv_snapshot_invalid and lv_merge_failed not switched into numeric value
where -1 represents 'unknown' value)
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0 --binary
  LV    ActLocal   SnapInvalid     MergeFailed
  lvol0          1         unknown         unknown

With this patch applied:
$ lvs -o lv_name,lv_active_locally,lv_snapshot_invalid,lv_merge_failed vg/lvol0 --binary
  LV    ActLocal   SnapInvalid     MergeFailed
  lvol0          1              -1              -1
This commit is contained in:
Peter Rajnoha 2016-02-18 12:10:00 +01:00
parent e5fc48411a
commit bc19a16fc7
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.143 -
=====================================
Report -1, not 'unkown' for lv_{snapshot_invalid,merge_failed} with --binary.
Add configure --enable-dbus-service for an LVM D-Bus service.
Replace configure --enable-python_bindings with python2 and python3 versions.
If PV belongs to some VG and metadata missing, skip it if system ID is used.

View File

@ -3194,7 +3194,7 @@ static int _lvmergefailed_disp(struct dm_report *rh, struct dm_pool *mem,
int merge_failed;
if (!lv_is_cow(lv) || !lv_snapshot_percent(lv, &snap_percent))
return _field_set_value(field, _str_unknown, &GET_TYPE_RESERVED_VALUE(num_undef_64));
return _binary_undef_disp(rh, mem, field, private);
merge_failed = snap_percent == LVM_PERCENT_MERGE_FAILED;
return _binary_disp(rh, mem, field, merge_failed, GET_FIRST_RESERVED_NAME(lv_merge_failed_y), private);
@ -3209,7 +3209,7 @@ static int _lvsnapshotinvalid_disp(struct dm_report *rh, struct dm_pool *mem,
int snap_invalid;
if (!lv_is_cow(lv))
return _field_set_value(field, _str_unknown, &GET_TYPE_RESERVED_VALUE(num_undef_64));
return _binary_undef_disp(rh, mem, field, private);
snap_invalid = !lv_snapshot_percent(lv, &snap_percent) || snap_percent == DM_PERCENT_INVALID;
return _binary_disp(rh, mem, field, snap_invalid, GET_FIRST_RESERVED_NAME(lv_snapshot_invalid_y), private);