1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
Commit Graph

210 Commits

Author SHA1 Message Date
Alasdair G Kergon
da79fe4c1d reporting: tidy recent new fields
Add underscores and prefixes to recently-added fields.
(Might add more alias functionality in future.)
2013-07-19 01:30:02 +01:00
Tony Asleson
9775a19af1 lib/properties: Common code for handling properties.
The common bits from lib/report/properties.[c|h] have
been moved to lib/properties/prop_common.[c|h] to allow
re-use of property handling functionality without
polluting the report handling functionality.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-12 16:52:16 -05:00
Alasdair G Kergon
dd302daf64 report: remove LV_CREATE_PARAMS report type
Remove LV_CREATE_PARAMS from lib/report as it is not a type of metadata.
Added by 4d5de8322b
2013-07-09 02:06:29 +01:00
Tony Asleson
4d5de8322b lvm2app: Add thin and thin pool lv creation V5
Add thin and thin pool lv creation support to lvm library

This is Mohan's thinp patch, re-worked to include suggestions
from Zdenek and Mohan.

V2: Remove const lvm_lv_params_create_thin
    Add const lvm_lv_params_skip_zero_get

V3: Changed get/set to use generic functions like current
    property

V4: Corrected macro in properties.c

V5: Fixed a bug in liblvm/lvm_lv.c function lvm_lv_create.
    incorrectly used pool instead of lv_name when doing the
    find_lv_in_vg call.

Based on work done by M. Mohan Kumar <mohan@in.ibm.com>

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2013-07-02 14:24:33 -05:00
Peter Rajnoha
9f6cfc9de4 report: add vg_profile and lv_profile to report the profile attached to VG/LV
vgs -o vg_profile ...
lvs -o lv_profile ...
2013-07-02 15:22:12 +02:00
Zdenek Kabelac
5d73c0c674 cleanup: access pool segs with check
Add some minor checks after first_seg(lv).
Use direct check for thin pool segment.
Drop some unneeded {}
2013-06-16 00:07:33 +02:00
Alasdair G Kergon
538acd56f1 report: revert lvs origin_size sort order change
Reinstate the previous sort order for origin_size, so that LVs with
an empty origin_size continue to appear at the start of the list
not the end.

Ref. 9d445f371c
2013-06-15 01:24:16 +01:00
Jonathan Brassow
562c678ee2 DM RAID: Add ability to throttle sync operations for RAID LVs.
This patch adds the ability to set the minimum and maximum I/O rate for
sync operations in RAID LVs.  The options are available for 'lvcreate' and
'lvchange' and are as follows:
  --minrecoveryrate <Rate> [bBsSkKmMgG]
  --maxrecoveryrate <Rate> [bBsSkKmMgG]
The rate is specified in size/sec/device.  If a suffix is not given,
kiB/sec/device is assumed.  Setting the rate to 0 removes the preference.
2013-05-31 11:25:52 -05:00
Peter Rajnoha
732859d21f refactor: rename embedding area -> bootloader area 2013-05-28 12:37:22 +02:00
Alasdair G Kergon
f12d88f840 activation: fix lv_is_active regressions
Try to fix commit bf2741376d.

lv_is_active is not the same as lv_info(cmd, org, 0, &info, 0, 0).

Introduce and use lv_is_active_locally.
2013-05-15 02:13:31 +01:00
Zdenek Kabelac
f7d5511876 cleanup: shift line down
For better look of  lvs -o help
Though we may need to decide whether to use  'lv_active' or some other
name.
2013-05-03 15:44:15 +02:00
Zdenek Kabelac
8d004b5127 report: show active state of LV
For non clustered VG - show  "active"/""

For clustered VG its more complex:

"local exclusive"
"remote exclusive"
"locally"
"remotely"
2013-04-25 17:33:24 +02:00
Zdenek Kabelac
8b18ab76d2 report: show dmeventd monitoring status
Add new lvs segment field 'Monitor' showing 3 states:

"monitored" - LV is monitored by dmeventd.

"not monitored" - LV is currently not being monitored by dmeventd

"" (empty) - LV does not support monitoring, or dmeventd support
             is not compiled in.
2013-04-25 17:33:24 +02:00
Jonathan Brassow
2e0740f7ef RAID: Add writemostly/writebehind support for RAID1
'lvchange' is used to alter a RAID 1 logical volume's write-mostly and
write-behind characteristics.  The '--writemostly' parameter takes a
PV as an argument with an optional trailing character to specify whether
to set ('y'), unset ('n'), or toggle ('t') the value.  If no trailing
character is given, it will set the flag.
Synopsis:
        lvchange [--writemostly <PV>:{t|y|n}] [--writebehind <count>] vg/lv
Example:
        lvchange --writemostly /dev/sdb1:y --writebehind 512 vg/raid1_lv

The last character in the 'lv_attr' field is used to show whether a device
has the WriteMostly flag set.  It is signified with a 'w'.  If the device
has failed, the 'p'artial flag has priority.

Example ("nosync" raid1 with mismatch_cnt and writemostly):
[~]# lvs -a --segment vg
  LV                VG   Attr      #Str Type   SSize
  raid1             vg   Rwi---r-m    2 raid1  500.00m
  [raid1_rimage_0]  vg   Iwi---r--    1 linear 500.00m
  [raid1_rimage_1]  vg   Iwi---r-w    1 linear 500.00m
  [raid1_rmeta_0]   vg   ewi---r--    1 linear   4.00m
  [raid1_rmeta_1]   vg   ewi---r--    1 linear   4.00m

Example (raid1 with mismatch_cnt, writemostly - but failed drive):
[~]# lvs -a --segment vg
  LV                VG   Attr      #Str Type   SSize
  raid1             vg   rwi---r-p    2 raid1  500.00m
  [raid1_rimage_0]  vg   Iwi---r--    1 linear 500.00m
  [raid1_rimage_1]  vg   Iwi---r-p    1 linear 500.00m
  [raid1_rmeta_0]   vg   ewi---r--    1 linear   4.00m
  [raid1_rmeta_1]   vg   ewi---r-p    1 linear   4.00m

A new reportable field has been added for writebehind as well.  If
write-behind has not been set or the LV is not RAID1, the field will
be blank.
Example (writebehind is set):
[~]# lvs -a -o name,attr,writebehind vg
  LV            Attr      WBehind
  lv            rwi-a-r--     512
  [lv_rimage_0] iwi-aor-w
  [lv_rimage_1] iwi-aor--
  [lv_rmeta_0]  ewi-aor--
  [lv_rmeta_1]  ewi-aor--

Example (writebehind is not set):
[~]# lvs -a -o name,attr,writebehind vg
  LV            Attr      WBehind
  lv            rwi-a-r--
  [lv_rimage_0] iwi-aor-w
  [lv_rimage_1] iwi-aor--
  [lv_rmeta_0]  ewi-aor--
  [lv_rmeta_1]  ewi-aor--
2013-04-15 13:59:46 -05:00
Jonathan Brassow
ff64e3500f RAID: Add scrubbing support for RAID LVs
New options to 'lvchange' allow users to scrub their RAID LVs.
Synopsis:
	lvchange --syncaction {check|repair} vg/raid_lv

RAID scrubbing is the process of reading all the data and parity blocks in
an array and checking to see whether they are coherent.  'lvchange' can
now initaite the two scrubbing operations: "check" and "repair".  "check"
will go over the array and recored the number of discrepancies but not
repair them.  "repair" will correct the discrepancies as it finds them.

'lvchange --syncaction repair vg/raid_lv' is not to be confused with
'lvconvert --repair vg/raid_lv'.  The former initiates a background
synchronization operation on the array, while the latter is designed to
repair/replace failed devices in a mirror or RAID logical volume.

Additional reporting has been added for 'lvs' to support the new
operations.  Two new printable fields (which are not printed by
default) have been added: "syncaction" and "mismatches".  These
can be accessed using the '-o' option to 'lvs', like:
	lvs -o +syncaction,mismatches vg/lv
"syncaction" will print the current synchronization operation that the
RAID volume is performing.  It can be one of the following:
        - idle:   All sync operations complete (doing nothing)
        - resync: Initializing an array or recovering after a machine failure
        - recover: Replacing a device in the array
        - check: Looking for array inconsistencies
        - repair: Looking for and repairing inconsistencies
The "mismatches" field with print the number of descrepancies found during
a check or repair operation.

The 'Cpy%Sync' field already available to 'lvs' will print the progress
of any of the above syncactions, including check and repair.

Finally, the lv_attr field has changed to accomadate the scrubbing operations
as well.  The role of the 'p'artial character in the lv_attr report field
as expanded.  "Partial" is really an indicator for the health of a
logical volume and it makes sense to extend this include other health
indicators as well, specifically:
        'm'ismatches:  Indicates that there are discrepancies in a RAID
                       LV.  This character is shown after a scrubbing
                       operation has detected that portions of the RAID
                       are not coherent.
        'r'efresh   :  Indicates that a device in a RAID array has suffered
                       a failure and the kernel regards it as failed -
                       even though LVM can read the device label and
                       considers the device to be ok.  The LV should be
                       'r'efreshed to notify the kernel that the device is
                       now available, or the device should be 'r'eplaced
                       if it is suspected of failing.
2013-04-11 15:33:59 -05:00
Peter Rajnoha
ea69cda4b0 report: add reporting fields for Embedding Area start and size
There are new reporting fields for Embedding Area: ea_start and ea_size.

An example of 1m Embedding Area and relevant reporting fields:
raw/~ # pvs -o pv_name,pe_start,ea_start,ea_size
  PV         1st PE  EA start EA size
  /dev/sda     2.00m    1.00m   1.00m
2013-02-26 14:46:42 +01:00
Zdenek Kabelac
30c13eff37 thin: report external origin
Use the field 'origin' for reporting external origin lv name.

For thin volumes with external origin, report the size of
external origin size via:

  lvs -o+origin_size
2013-02-23 10:37:01 +01:00
Zdenek Kabelac
9d445f371c report: leave empty report field for 0
Since we do not support LVs with 0 size, use this value
as 'error' value for devices without origin, and leave this
field blank as in other cases.
2013-02-05 14:32:37 +01:00
Zdenek Kabelac
9ec474f38a lvm2api: fix size reporting
API is reporting all sizes as 64bit integers in bytes.
Fix at those places, where sectors were returned
to remain consistent.
2012-12-02 17:55:08 +01:00
Zdenek Kabelac
0387e70d76 thin: fix property discard for lvm2api
Discards property is string and may have these values:
  ignore, nopassdown, passdown
2012-11-27 14:09:49 +01:00
Jonathan Brassow
e191780947 RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
RAID 4/5/6 have not displayed their sync status by any means available to
'lvs' yet.

Example (old):
[root@hayes-02 lvm2]# lvs vg
  LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
  lv    vg   -wi-a----  1.00g
  raid1 vg   rwi-a-r--  1.00g                             100.00
  raid4 vg   rwi-a-r--  1.01g
  raid5 vg   rwi-a-r--  1.01g
  raid6 vg   rwi-a-r--  1.01g

This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
their sync percent in this field.

Example (new):
[root@hayes-02 lvm2]# lvs vg
  LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
  lv    vg   -wi-a---- 1.00g
  raid1 vg   rwi-a-r-- 1.00g                               100.00
  raid4 vg   rwi-a-r-- 1.01g                               100.00
  raid5 vg   rwi-a-r-- 1.01g                               100.00
  raid6 vg   rwi-a-r-- 1.01g                               100.00
2012-10-23 21:19:27 -05:00
Zdenek Kabelac
bf2741376d Use lv_is_active instead of lv_info()
Usage of lv_is_active makes it more obvious what is being checked.
2012-10-17 15:42:31 +02:00
Zdenek Kabelac
ff13206c7e report: call snapshot percent with cow only
Ensure lv_snapshot_percent is used only with snapshot LVs.
2012-10-08 12:16:53 +02:00
Zdenek Kabelac
1da6c1495a lvm2api: fix data percent reporting for thin, snap
Use same logic for lvm2api as we use lvs reporting.
data_percent is meant to be superset for snap_percent.
2012-10-05 10:37:09 +02:00
Zdenek Kabelac
286cd2006b cleanup: drop unneeded included header files
This headers were not resolving anything used for compiled .c files.
Remove unused util.c file.
2012-08-23 14:37:20 +02:00
Alasdair G Kergon
701b4a8363 thin: use discards as plural rather than singular
Global change from --discard to --discards, as that feels more natural.
2012-08-07 21:24:41 +01:00
Alasdair G Kergon
e4fdfa9d31 report: provide discard field value in full
I think it's better not to abbreviate human-readable fields like
'discard' to a single character.  Users can truncate it to the
first character themselves if they wish.

It's confusing to use the variable name discard for different things in
different places - use discard_str when it's a string not the enum.
2012-08-07 18:48:34 +01:00
Zdenek Kabelac
46b9cc1248 thin: add reporting of discard for thin pool
New field  "discard" is added for lvs reporting of lv segment.
Reported as one character:
 (i)gnore
 (n)opassdown
 (p)assdown

lvs -o+discard
2012-07-18 14:37:44 +02:00
Zdenek Kabelac
f380cd7d98 Use unsigned type for bitmask
Using report_type_t for bitmask is not correct, since we have not defined types
for all  bit combinations - so switching to unsigned type, since values of
report_type_t enum are unsigned.
2012-02-27 11:45:05 +00:00
Zdenek Kabelac
ca12090800 Thin read percent info from layered device
Since we only need layered device - check for tpool device presence,
so user doesn't need to activate thin pool explicitely for percent info.
2012-01-25 13:11:52 +00:00
Mike Snitzer
23e34c729b Differentiate between snapshot status of "Invalid" and "Merge failed". 2012-01-20 22:02:04 +00:00
Zdenek Kabelac
e58b5dd8e8 Thin add new display field for lvs
New field Data% is able to display info about
thin_pool, thin, snapshot and has generic meaning here.

Simple Time/Host field are here to display host and time creation.
2012-01-19 15:34:32 +00:00
Zdenek Kabelac
97d7e5aedb Thin supports snapshots
Full support for thin snapshots.
Create and remove is supported.

TODO: lvconvert support is not yes available.
2011-11-07 11:03:47 +00:00
Alasdair Kergon
7c67d33dd4 correct thin_pool width 2011-09-27 12:33:36 +00:00
Alasdair Kergon
dbb48de507 Add a new 'thin_pool' output field to 'lvs.
A gentle reminder that anyone relying on the output of reporting commands
like lvs in scripts must use -o to guarantee they get the fields they expect.

The default sequence of fields can change from release to release.
Equally, the 'attr' fields can have new values introduced and/or characters
appended to them.
2011-09-09 00:54:49 +00:00
Zdenek Kabelac
586f310618 Remove meaningless const type qualifiers on cast type
Static analyzis noticed we do not really need them - so removing.
2011-08-04 14:30:51 +00:00
Petr Rockai
db22d9b978 This patchset refactors some reporting code and completes the remaining
lvseg properties for lvm2app, 'devices' and 'seg_pe_ranges'.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2011-04-12 12:24:29 +00:00
Zdenek Kabelac
55f6627427 Fix reading of released memory
lvseg_segtype_dup used memory pool vg memory pool for strind duplication.
However this one gets released before reporting happens so the command like:

pvs -o segtype

prints data from already released memory pool. Thanks to the fact there
is not much allocation happing after the VG is released, the memory
stays unmodified and correct result is printed.

Fix adds support for mempool passed parameter (like other similar
query commands) and uses dm_report memory pool for string duplication.
2011-03-05 12:14:00 +00:00
Zdenek Kabelac
aec2115410 Const fixing
Fixing some const warnings - with API change in:

int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,

Change is needed - as lvm2api expects const behaviour here.
So vg_extend() is doing local strdup for unescaping.

skip_dev_dir return const char* from const char* vg_name.

Rest of the patch is cleanup of related warnings.

Also using dm_report_filed_string() API change to simplify
casting in _string_disp and _lvname_disp.
2011-02-18 14:47:28 +00:00
Zdenek Kabelac
1936d75b3c Return PERCENT_INVALID for error case
If the percent value could not be determined return PERCENT_INVALID.
Indent function with tabs.
2011-01-05 12:33:51 +00:00
Petr Rockai
8961b1d503 Add getters for copy_percent and snap_percent to the lvm2app API. 2010-12-14 23:20:58 +00:00
Petr Rockai
8191fe4f4a Refactor the percent (mirror sync, snapshot usage) handling code to use
fixed-point values instead of a combination of a float value and an enum.
2010-11-30 11:53:31 +00:00
Petr Rockai
0bc382eae4 All 'size' values of lvm2app properties should be in bytes.
Fix 'seg_size' to return bytes.

Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-25 14:39:02 +00:00
Petr Rockai
4543dac58e Add the macro and specific 'get' functions for pvsegs.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:11:27 +00:00
Petr Rockai
c1abd569f2 Add the macro and specific 'get' functions for lvsegs.
Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 20:08:14 +00:00
Petr Rockai
cbff112651 Make value.string const char *, in properties.h, to fix a warning introduced by
the previous patch set.
2010-11-17 19:50:15 +00:00
Petr Rockai
fd82d8c129 Add generic infrastructure to internal library to 'set' a property.
Similar to 'get' property internal functions.
Add specific 'set' function for vg_mda_copies.

Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
2010-11-17 19:15:10 +00:00
Dave Wysochanski
a90221d824 Add 'is_integer' flag into internal lvm_property_type.
Add 'is_integer' flag similar to 'is_string'.
Suggested in review by Petr Rockai.
2010-10-25 14:08:32 +00:00
Dave Wysochanski
12873010e5 Add lv_get_property() internal lvm function. 2010-10-21 18:51:16 +00:00
Dave Wysochanski
60fc088d70 Rename fields in lvm_property_type.
Based on review comments, rename a few fields in lvm_property_type.
In particular, change 'is_writeable' to 'is_settable', which is
more intuitive to the intent of the bitfield (a 'set' function
exists for this field/property).  Also, remove the char array
for 'id' - unnecessary as we can just use the string passed in
to do the strcmp.  Finally rename the union members from n_val
to 'integer' and 's_val' to 'string'.
2010-10-21 14:49:43 +00:00