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

2965 Commits

Author SHA1 Message Date
Bryn M. Reeves
e9c6fd3cff dmstats: fix <backtrace> in _display_info_cols()
Remove a false <backtrace> in _display_info_cols(): it is not an
error if there are no regions to display.

Fixes commit e6724f03.
2016-07-05 19:53:17 +01:00
Bryn M. Reeves
cf0fa3d693 dmstats: rename --auxdata to --userdata 2016-07-05 19:53:17 +01:00
Bryn M. Reeves
14b74c360f dmstats: rename 'aux_data' to 'user_data'
Make it clear that the "aux data" presented in reports is the user
data stored in the field (and does not include any library-internal
state such as group descriptors) by renaming the field to user_data
and changing the heading to "UserData".
2016-07-05 19:53:17 +01:00
Bryn M. Reeves
2b0dd0b051 dmstats: replace --statstype with separate object switches
Replace --statstype=area,region,group with a separate switch for
each object type: --area, --region, --group. Omitting any object
type switch will use the defaults for the current command (regions
and groups for list, and regions, groups and areas for verbose list).
2016-07-05 19:53:17 +01:00
Bryn M. Reeves
b926511b4b dmstats: add 'statsname' and 'obj_type' to default stats fields 2016-07-05 19:53:17 +01:00
Bryn M. Reeves
0b05e4a874 dmstats: rename 'type' field to 'obj_type'
Rename the field and remove whitespace from the column heading:

  "Object Type" -> "ObjType"
2016-07-05 19:53:17 +01:00
Bryn M. Reeves
c014425b6f dmstats: use 'statsname' and 'groupid' in default fields
Replace the 'name' field with 'statsname' in order to report alias
names for groups, and include the 'group_id' field between statsname
and the 'region_id' field to make it clear to the user when groups
are in use.
2016-07-05 19:53:17 +01:00
Bryn M. Reeves
b0964acadf dmstats: convert 'delete' to dm_stats_foreach_region() 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
01cc11d9f8 dmstats: convert 'print' to dm_stats_foreach_region() 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
2047b8e565 dmstats: convert 'clear' to dm_stats_foreach_region() 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
cf6c1665f1 dmstats: fix region deletion message
Make the use of 64-bit format macros consistent with other usage
and end the message with a '.'.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
e554e375ae dmstats: accept --groupid for 'dmstats delete'
Allow deletion of a group and all the regions it contains with a
single 'dmstats delete' command.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
837e7e513b dmstats: allow --statstype to override report defults 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
a2bf3c6ee8 dmstats: report a list of members as a group's region_id
Instead of '-' print the member list in range notation (as stored
in aux_data).
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
ca0a4cecec dmstats: report groups and region summaries
Walk avaiable groups and regions (in addition to areas) and report
aggregate statistics and properties.

A new switch is added to filter the type of obects inclued in the
report:

  --statstype={all,area,region,group}

The type of the current row is also available in a new
DR_STATS_META field 'type'.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
8b179e09a4 dmstats: do not walk regions if deleting a single id 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
402d840aa7 dmstats: add stats_name field
To allow the names used to describe statistics report objects to
change (for e.g to support groups and region and group aliases)
introduce a new "stats_name" field that evaluates to the correct
name for the object being reported.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
b55daa28e8 dmstats: add group alias support 2016-07-05 19:53:16 +01:00
Bryn M. Reeves
0761863e28 dmstats: add 'group' and 'ungroup' commands
Add a pair of commands to create and delete stats groups:

  dmstats group --regions REGIONS

  dmstats ungroup --groupid ID

REGIONS specifies a list of regions to be included in the group.
Regions are specified as a comma separated list in order of
increasing region ID. Ranges may be specified as a hypen separated
pair of values giving the first and last member of the range.
2016-07-05 19:53:16 +01:00
Bryn M. Reeves
b4cbc8f283 dmstats: add group_id report field type 2016-07-05 19:53:16 +01:00
Heinz Mauelshagen
4420d41fea vgsplit: fix moving RAID LVs to split off VG and check for LVs not to skip moving with other LV types 2016-07-05 19:49:44 +01:00
Bryn M. Reeves
52be93c54b dmsetup: fix timestamp leak
With a single report (--count=1) no timerfd is set up and the cycle
and current timestamps should be freed during the single call to
_update_interval_times().
2016-07-04 12:16:51 +01:00
Bryn M. Reeves
62dce13c7a dmstats: fix RgStart and RgSize field widths 2016-07-04 12:16:51 +01:00
Alasdair G Kergon
d8c2677ab9 raid0: Add raid0_meta segment type. 2016-07-01 22:20:54 +01:00
David Teigland
1df9822224 lvconvert: improve arg checks in new operation routing code
Use defines for segment types, and test args directly
instead of indirectly.
2016-07-01 11:24:41 -05:00
Zdenek Kabelac
3fd4584886 cleanup: lvchange uses display_lvname
Convert messages to report vg/lv name consistently.

Also drop unneeded 'info_obtaned' variable since the
obtained info is not reused in any code path.
2016-07-01 00:44:48 +02:00
David Teigland
103c188681 lvconvert: add comments describing conversions 2016-06-30 17:08:50 -05:00
Alasdair G Kergon
aed8bc8ae7 macros: Use is_power_of_2. 2016-06-30 17:59:44 +01:00
David Teigland
a8e39530ef lvconvert: add missing alias for a thin-pool conversion
The case of converting a cache volume to a thin pool missed
recognizing the --thinpool alias for --type thin-pool.
2016-06-30 10:09:54 -05:00
David Teigland
802ed9d459 lvconvert: remove unused code
This code became unused with the previous commit 2282f5.
2016-06-29 16:59:32 -05:00
David Teigland
2282f53ac7 lvconvert: rework routing of operations
Add new logic to identify each unique operation and route
it to the correct function to perform it.  The functions
that perform the conversions remain unchanged.

This new code checks every allowed combination of LV type
and requested operation, and for each valid combination
calls the function that performs that conversion.

The first stage of option validation which checks for
incompatible combinations of command line options, is done
done before process_each is called.  This is unchanged.
(This new code will allow that first stage validation to
be simplified in a future commit.)

The second stage of checking options against the specific
LV type is done by this new code.  For each valid combination
of operation + LV type, the new code calls an existing
function that implements it.

With this in place, the ad hoc checks for valid combinations
of LV types and operations can be removed from the existing
code in a future commit.

(The #if 0 is used to keep the patch clean, and the
disabled code will be removed by a following patch.)
2016-06-29 16:55:27 -05:00
Alasdair G Kergon
79446ffad7 raid: Infrastructure for raid takeover. 2016-06-28 02:42:30 +01:00
David Teigland
a7c45ddc59 lvmetad: two phase vg_update
Previously, a command sent lvmetad new VG metadata in vg_commit().
In vg_commit(), devices are suspended, so any memory allocation
done by the command while sending to lvmetad, or by lvmetad while
updating its cache could deadlock if memory reclaim was triggered.

Now lvmetad is updated in unlock_vg(), after devices are resumed.
The new method for updating VG metadata in lvmetad is in two phases:

1. In vg_write(), before devices are suspended, the command sends
   lvmetad a short message ("set_vg_info") telling it what the new
   VG seqno will be.  lvmetad sees that the seqno is newer than
   the seqno of its cached VG, so it sets the INVALID flag for the
   cached VG.  If sending the message to lvmetad fails, the command
   fails before the metadata is committed and the change is not made.
   If sending the message succeeds, vg_commit() is called.

2. In unlock_vg(), after devices are resumed, the command sends
   lvmetad the standard vg_update message with the new metadata.
   lvmetad sees that the seqno in the new metadata matches the
   seqno it saved from set_vg_info, and knows it has the latest
   copy, so it clears the INVALID flag for the cached VG.

If a command fails between 1 and 2 (after committing the VG on disk,
but before sending lvmetad the new metadata), the cached VG retains
the INVALID flag in lvmetad.  A subsequent command will read the
cached VG from lvmetad, see the INVALID flag, ignore the cached
copy, read the VG from disk instead, update the lvmetad copy
with the latest copy from disk, (this clears the INVALID flag
in lvmetad), and use the correct VG metadata for the command.

(This INVALID mechanism already existed for use by lvmlockd.)
2016-06-28 02:30:31 +01:00
Peter Rajnoha
1b11f09d2a reporter: simplify --configreport handling for -S|--select and fix an issue reported by coverity
Simplify code around _do_get_report_selection - remove "expected_idxs[]"
argument which is superfluous and add "allow_single" switch instead to
allow for recognition of "--configreport <report_name> -S" as well as
single "-S" if needed.

Null pointer dereferences  (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 961 in _do_report_get_selection()
Null pointer dereferences  (FORWARD_NULL) Dereferencing null pointer "single_args".
2016-06-28 02:27:19 +01:00
Peter Rajnoha
f0768f636e coverity: fix issues detected in recent code
Uninitialized variables  (UNINIT) /safe/guest2/covscan/LVM2.2.02.158/tools/toollib.c: 3520 in _process_pvs_in_vgs()
Uninitialized variables  (UNINIT) Using uninitialized value "do_report_ret_code".

Null pointer dereferences  (REVERSE_INULL) /safe/guest2/covscan/LVM2.2.02.158/libdm/libdm-report.c: 4745 in dm_report_output()
Null pointer dereferences  (REVERSE_INULL) Null-checking "rh" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

Incorrect expression  (MISSING_COMMA) /safe/guest2/covscan/LVM2.2.02.158/lib/log/log.c: 280 in _get_log_level_name()
Incorrect expression  (MISSING_COMMA) In the initialization of "log_level_names", a suspicious concatenated string ""noticeinfo"" is produced.

Null pointer dereferences  (FORWARD_NULL) /safe/guest2/covscan/LVM2.2.02.158/tools/reporter.c: 816 in_get_report_options()
Null pointer dereferences  (FORWARD_NULL) Comparing "mem" to null implies that "mem" might be null.
2016-06-28 02:26:54 +01:00
Peter Rajnoha
9a414245b9 commands: help: add missing --reportformat references 2016-06-24 14:49:13 +02:00
Peter Rajnoha
14da3cc793 commands: fix typo in arg assignment 2016-06-24 11:10:10 +02:00
Zdenek Kabelac
1c212371fa cleanup: type cleanup
Fix return code 1.
Since we always check for !() - this fix has no other effect.
2016-06-24 00:39:14 +02:00
Zdenek Kabelac
7c921f18e2 lvresize: let pass even protected names like _tmeta
Only later validation can decide if the volume is actually restricted
from being resized  (unlike in lvcreate time).
2016-06-24 00:39:14 +02:00
Zdenek Kabelac
1bb7a155d1 lvresize: fixes for recent commit
Merging process and patch rework missed some bits - fix them.
2016-06-24 00:39:14 +02:00
Zdenek Kabelac
5a919e4805 cleanup: remove unused sizearg variable
It's not used for anything now.
2016-06-23 14:59:29 +02:00
Zdenek Kabelac
d44e653fe1 lvresize: do not pass struct cmd
Use common API design and pass just LV pointer to lv_manip.c functions.
Read cmd struct via    lv->vg->cmd when needed.
Also do not try to return EINVALID_CMD_LINE error when we
have already openned VG - this error code can only be returned before
locking VG.
2016-06-23 14:57:09 +02:00
Zdenek Kabelac
f45b689406 lvresize: update lvresize_params struct
Reorganise  struct lvresize_params to better fit lvresize needs to be
able to resize more then just a single LV.
2016-06-23 14:57:09 +02:00
Zdenek Kabelac
6268d0a080 cleanup: add dots to some messages
Add missing dots and one comment.
2016-06-23 14:57:08 +02:00
Zdenek Kabelac
0a525832f9 cleanup: code lines reodered 2016-06-23 14:57:08 +02:00
Zdenek Kabelac
d578d8d3a1 lvresize: inform about ignored args with --use-polices
When --use-polices is specified, all size args are meaningless,
as the resize is based upon policy. So just keep user informed.
2016-06-23 14:57:08 +02:00
Alasdair G Kergon
6513a7a449 lvconvert: Fix --stripes handling.
Only treat --stripes as meaning --type striped if no other type was
first detected.  If a segtype got selected, don't override it later.
2016-06-22 22:10:42 +01:00
David Teigland
ebd2758dab vgimportclone: add native command
This is cleaner and more efficient than the script.
The args and usage are unchanged.
2016-06-22 13:13:10 -05:00
Alasdair G Kergon
dfc516f9bf lvconvert: Refactor argument handling code.
Begin disentangling the different lvconvert modes of operation
from each other.
2016-06-22 18:40:22 +01:00
Alasdair G Kergon
7e671e5dd0 tools: Use arg_is_set instead of arg_count. 2016-06-21 22:24:52 +01:00