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

3080 Commits

Author SHA1 Message Date
Heinz Mauelshagen
8859d4508a lvconvert: fix RAID SubLV --splitmirror regression
Commit 088b3d036a allowed repair on cache origin RAID LVs
and restricted lvconvert actions on RAID SubLVs to change number of mirrors, repair,
replace and type changes in order to avoid unsuitable coversions on them.

This introduced a regression prohibiting --splitmirrors on any RAID SubLVs
(e.g. of cache or thin LVs; lvconvert-{cache,thin}-raid.sh tests failing).

Fix allows split mirrors again.

Fix some indenting whilst on it.
2016-10-12 00:24:57 +02:00
Zdenek Kabelac
8f30069160 cleanup: indent 2016-10-11 13:37:43 +02:00
Zdenek Kabelac
6f576483a8 cleanup: lvconvert drop unused variable 2016-10-11 13:37:43 +02:00
Zdenek Kabelac
c8b6c13015 cleanup: use already set values
When we have already decoded arg_is_set into a local var
or already set  segment type - already use these
values instead of repeating calls and string checks.
2016-10-11 13:37:43 +02:00
Zdenek Kabelac
f4ae43934a cleanup: reorder code
Move some arg test into a single place with sort of alphabetic order
when possible to make reading easier.
2016-10-11 13:37:43 +02:00
Zdenek Kabelac
706d3ddf90 lvconvert: use _read_conversion_type
Code reodering and using same pattern for reading and validating arg
(--type in this case).
2016-10-11 13:36:51 +02:00
Zdenek Kabelac
1186cf2ad4 lvconvert: fix error value
Seems some error path where not converted to 'new' ECMD return value.
Fix them to always 'goto out'.
Also drop unneeded   'ret = 0' when ret already is 0.
2016-10-11 13:36:29 +02:00
Heinz Mauelshagen
088b3d036a lvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"
In case a RAID orig LV is being cached and fails, repair is impossible because
"lvconvert --repair" gets rejected.

Fix by allowing repair on cache orig RAID LVs and
"lvconvert --replace/--mirrors/--type {raid*|mirror|striped|linear}" as well.

Allow the same lvconvert actions on any cache pool and metadata RAID SubLVs.

Resolves: rhbz1380532
2016-10-10 17:31:29 +02:00
David Teigland
bf5d0a2651 toollib: clean up coverity issue
in processing duplicate pvs.
2016-10-04 16:25:32 -05:00
Alasdair G Kergon
c900cf7ed4 Revert "cleanup: simplier assign of cmd vars"
This reverts commit cea441f4d1.

cmd->default_values is configurable and this code should not make
any assumptions about values it holds.
2016-10-03 18:14:17 +01:00
Zdenek Kabelac
77ffd39dfb cleanup: drop test for NULL
Since lp->segtype has been already checked for not-being NULL,
drop this test so Coverity is not later confused it 'can be a NULL'.
2016-10-03 17:49:56 +02:00
Zdenek Kabelac
cea441f4d1 cleanup: simplier assign of cmd vars
Directly assign queried args as they provide matching values for
a setting.
2016-10-03 17:49:55 +02:00
Peter Rajnoha
e40fbd08c8 config: parse config tree without dup node checking if it's metadata tree 2016-09-21 18:16:05 +02:00
Peter Rajnoha
094488ffab cleanup: remove unused variables 2016-09-21 15:53:50 +02:00
Peter Rajnoha
926a565781 coverity: dmsetup: fix possible use of uninitialized value 2016-09-21 15:52:23 +02:00
Bryn M. Reeves
7ea5758c91 dmsetup: ensure --filemap histogram bounds are freed
Make sure that the temporary dm_histogram used for the bounds
argument is freed in the case that the user provided a --bounds
argument on the command line.
2016-09-21 10:09:20 +01:00
Heinz Mauelshagen
5d455b28fc lvconvert: fix (automatic) raid repair regression
The dm-raid target now rejects device rebuild requests during ongoing
resynchronization thus causing 'lvconvert --repair ...' to fail with
a kernel error message. This regresses with respect to failing automatic
repair via the dmeventd RAID plugin in case raid_fault_policy="allocate"
is configured in lvm.conf as well.

Previously allowing such repair request required cancelling the
resynchronization of any still accessible DataLVs, hence reasoning
potential data loss.

Patch allows the resynchronization of still accessible DataLVs to
finish up by rejecting any 'lvconvert --repair ...'.

It enhances the dmeventd RAID plugin to be able to automatically repair
by postponing the repair after synchronization ended.

More tests are added to lvconvert-rebuild-raid.sh to cover single
and multiple DataLV failure cases for the different RAID levels.

- resolves: rhbz1371717
2016-09-21 00:39:29 +02:00
Zdenek Kabelac
0e8449a5b9 thin: fix lvchange of discards and zero flag
Reload of thin-pool origin_only is designed to only post messages
to a thin-pool. It's not intended to be used for reload of thin-pool
table. Fix it by using standard call  'lv_update_and_reload()'.
2016-09-19 14:00:56 +02:00
Zdenek Kabelac
4b22cd81e6 cache: report metadata percentage
Reinstantiate reporting of metadata percent usage for cache volumes.
Also show the same percentage with hidden cache-pool LV.
This regression was caused by optimization for a single-ioctl in
2.02.155.
2016-09-09 15:01:35 +02:00
Brassow Jonathan
5838c41a35 cache: scrubbing for cache origin LV - Bug 1169495
Allow RAID scrubbing on cache origin sub-LV

This patch adds the ability to perform RAID scrubbing on the cache
origin sub-LV (https://bugzilla.redhat.com/1169495).  Cache origin
operations are restricted to non-clustered RAID LVs until there can
be further testing in a cluster (even for exclusive activation).

User can either specify directly _corig LV
or he can specify cache LV and operation  --syncation is
passed ONLY to   _corig LV.

If users wants to manipulation with cache-pool devices - he
needs to specify this object name.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2016-09-07 16:42:32 +02:00
Alasdair G Kergon
be85c22f65 raid10: Fix #stripes in lvcreate msg when too many. 2016-08-30 12:04:23 +01:00
Zdenek Kabelac
b493811968 cache: introduce cache_pool_max_chunks
Introduce 'hard limit' for max number of cache chunks.
When cache target operates with too many chunks (>10e6).

When user is aware of related possible troubles he
may increase the limit in lvm.conf.

Also verbosely inform user about possible solution.

Code works for both lvcreate and lvconvert.

Lvconvert fully supports change of chunk_size when caching LV
(and validates for compatible settings).
2016-08-29 20:47:31 +02:00
Peter Rajnoha
e758d722c7 conf: fix typo in report/columns_as_rows config option name recognition
Commit e947c362dd introduced
config_settings.h file for central place to store all definitions for
config options. By mistake, it used report/colums_as_rows instead
of report/columns_as_rows (missing "n" in "columns").
2016-08-25 14:53:32 +02:00
Alasdair G Kergon
7837fbc1c1 lvconvert: Disallow raid10 mirror conversions. 2016-08-23 23:40:16 +01:00
Alasdair G Kergon
896912b14d lvcreate: Never treat raid0 as linear.
raid0 and raid0_meta require, or default to, at least 2 stripes.
2016-08-19 23:57:30 +01:00
Alasdair G Kergon
88e6abc5a0 lvconvert: Don't allow --repair on raid0 LVs. 2016-08-19 23:42:01 +01:00
Alasdair G Kergon
e192fde687 lvcreate: Drop warning messages for number of raid stripes.
It's now just setting a default, not adjusting the user's parameter.
2016-08-19 14:53:33 +01:00
Alasdair G Kergon
ea0f604e70 lvcreate: No longer adjust --stripes for raid types.
If the number of stripes requested is incompatible with the requested
type of raid, give an error instead of adjusting it.

If no stripes argument is supplied, continue to use an appropriate
default.
2016-08-19 14:19:51 +01:00
Alasdair G Kergon
c1a0a2c712 toollib: Record whether or not stripes/stripe_size args supplied. 2016-08-19 13:51:43 +01:00
Heinz Mauelshagen
c0a0eedf2e vgsplit: fix regression processing thin external origins
a579ba2ac2 fixed a regression causing a segfault if no external
origin existed but broke the logic leading to erroneous error
messages and creations of split off exported VGs in case the
external origin and the pool LVs were allocated on different PVs.

- resolves rhbz1367459
2016-08-16 23:57:09 +02:00
Heinz Mauelshagen
73df2aedf9 lvcreate: better error message creating RAID LV on < 4 KiB VG extent size
Creating a RaidLV in VGs with very small extent sizes caused
late failure in the kernel giving a not very informative error
message. Catch the attempt early and display failure message
'Unable to create RAID LV: requires minimum VG extent size 4.00 KiB'.

- resoves rhbz1179970
2016-08-16 13:39:40 +02:00
Alasdair G Kergon
114db6f745 tools: Suppress some unnecessary --stripesize warnings.
https://bugzilla.redhat.com/1366745
2016-08-15 19:38:45 +01:00
Heinz Mauelshagen
d83f2d766d pvmove: fix regression introduced with 8e9d5d12ae
'pvmove -n name pv1 pv2' called with the name of a top-level LV
failed with mentioned commit.

Enhance pvmove-raid-segtypes.sh to test for prohibited RAID SubLV moves.
2016-08-15 19:31:04 +02:00
Heinz Mauelshagen
8e9d5d12ae pvmove: prohibit non-resilient collocation of RAID SubLVs
'pvmove -n name pv1 pv2' allows to collocate multiple RAID SubLVs
on pv2 (e.g. results in collocated raidlv_rimage_0 and raidlv_rimage_1),
thus causing loss of resilence and/or performance of the RaidLV.

Fix this pvmove flaw leading to potential data loss in case of PV failure
by preventing any SubLVs from collocation on any PVs of the RaidLV.
Still allow to collocate any DataLVs of a RaidLV with their sibling MetaLVs
and vice-versa though (e.g. raidlv_rmeta_0 on pv1 may still be moved to pv2
already holding raidlv_rimage_0).

Because access to the top-level RaidLV name is needed,
promote local _top_level_lv_name() from raid_manip.c
to global top_level_lv_name().

- resolves rhbz1202497
2016-08-15 18:22:32 +02:00
Heinz Mauelshagen
a185a2bea2 lvcreate/lvconvert: fix validation of maximum mirrors/stripes
Enforce mirror/raid0/1/10/4/5/6 type specific maximum images when
creating LVs or converting them from mirror <-> raid1.

Document those maxima in the lvcreate/lvconvert man pages.

- resolves rhbz1366060
2016-08-12 19:14:28 +02:00
Peter Rajnoha
2fed8d8515 lvmcmdline: use long int for number returned by strtol 2016-08-10 09:10:37 +02:00
Peter Rajnoha
5ac008116b report: add report_reset_cmdlog_seqnum and call it for each new cmd executed in lvm shell 2016-08-09 18:49:11 +02:00
Peter Rajnoha
e8985c71bc config: add support for CFG_DISALLOW_INTERACTIVE flag to mark settings as not suitable for override in interactive mode
Some settings are not suitable for override in interactive/shell
mode because such settings may confuse the code and it may end
up with unexpected behaviour. This is because of the fact that
once we're in the interactive/shell mode, we have already applied
some settings for the shell itself and we can't override them
further because we're already using those settings to drive the
interactive/shell mode. Such settings would get ignored silently
or, in worse case, they would mess up the existing configuration.
2016-08-09 18:49:11 +02:00
Peter Rajnoha
7111d48748 lvm: shell: honor log/command_log_selection as default and reset to this value after lastlog 2016-08-09 18:49:11 +02:00
Peter Rajnoha
e805ef2d66 lvmcmdline: profile: early profile load for lvm shell
Make it possible to also load profile for lvm shell by honouring
LVM_COMMAND_PROFILE environment variable.
2016-08-09 18:49:11 +02:00
Peter Rajnoha
f21afddeb7 lvm: shell: extend log report to cover whole lvm shell's main loop
When lvm commands are executed in lvm shell, we cover the whole lvm
command execution within this shell now. That means, all messages logged
and status caught during each command execution is now recorded in the
log report, including overall command's return code.
2016-08-09 18:49:10 +02:00
Peter Rajnoha
5649834f7d lvmcmdline: return 0/NULL if cmd->arg_values not set and arg_count/grouped_arg_count/arg_value called
We may call arg_count/grouped_arg_count/arg_value soon enough that
cmd->arg_values is not set yet.

Normally, when running a command, we execute lvm_run_command which in
turn calls _process_command_line to allocate and parse the command line
values and stores them in cmd->arg_values.

However, if we run lvm shell, this one doesn't accept any command line
options and we parse the command line for each command that is executed
within the lvm shell then. If we used any code that tries to access
cmd->arg_values through any of the the arg handling functions too
early, we could end up with a segfault due to uninitialized (NULL)
cmd->arg_values.

This patch just saves extra checks in all the code where arg handling
may be called too early so that the cmd->arg_values is not set up yet.
This does not apply to any of existing code, but subsequent patches
will need that.
2016-08-09 18:24:45 +02:00
Peter Rajnoha
1fde4bf4d0 refactor: move report grouping and log reporting handles from processing_handle to cmd_context
With patches that will follow, this will make it possible to widen log
report coverage when commands are executed from lvm shell so the amount
of messages that may end up in stderr/stdout instead of log report are
minimized.
2016-08-09 18:24:45 +02:00
Peter Rajnoha
ef69934746 shell: also collect last command's return code for subsequent 'lastlog' invocation
Add new log_context=shell and with log_object_type=cmd and
log_object_name=<command_name> for command log report to collect
overall return code from last command (this is reported under
log_type=status).
2016-08-09 18:24:45 +02:00
Peter Rajnoha
06ce9b4e42 log: separate output and make it possible to use given FDs
Currently, the output is separated in 3 parts and each part can go into
a separate and user-defined file descriptor:

  - common output (stdout by default, customizable by LVM_OUT_FD environment variable)
  - error output (stderr by default, customizable by LVM_ERR_FD environment variable)
  - report output (stdout by default, customizable by LVM_REPORT_FD environment variable)

For example, each type of output goes to different output file:

  [0] fedora/~ # export LVM_REPORT_FD=3

  [0] fedora/~ # lvs fedora vg/abc 1>out 2>err 3>report

  [0] fedora/~ # cat out

  [0] fedora/~ # cat err
    Volume group "vg" not found
    Cannot process volume group vg

  [0] fedora/~ # cat report
    LV   VG     Attr       LSize   Layout     Role       CTime
    root fedora -wi-ao----  19.00g linear     public     Wed May 27 2015 08:09:21
    swap fedora -wi-ao---- 500.00m linear     public     Wed May 27 2015 08:09:21

Another example in LVM shell where the report goes to "report" file:

  [0] fedora/~ # export LVM_REPORT_FD=3
  [0] fedora/~ # lvm 3>report

  (in lvm shell)
  lvm> vgs

  (content of "report" file)
  [1] fedora/~ # cat report
    VG     #PV #LV #SN Attr   VSize  VFree
    fedora   1   2   0 wz--n- 19.49g    0

  (in lvm shell)
  lvm> lvs

  (content of "report" file)
  [1] fedora/~ # cat report
    VG     #PV #LV #SN Attr   VSize  VFree
    fedora   1   2   0 wz--n- 19.49g    0
    LV   VG     Attr       LSize   Layout     Role       CTime
    root fedora -wi-ao----  19.00g linear     public     Wed May 27 2015 08:09:21
    swap fedora -wi-ao---- 500.00m linear     public     Wed May 27 2015 08:09:21
2016-08-09 18:24:45 +02:00
Alasdair G Kergon
e5a5fd3669 lvconvert: Fix repair and replace routing. 2016-08-08 23:13:34 +01:00
Alasdair G Kergon
175e0905d5 test: Drop --mirrorlog when not a mirror. 2016-08-08 18:43:54 +01:00
David Teigland
fc93085c7a lvconvert: separate type raid to mirror
By the current division of unique operations,
converting type raid to type mirror is distinct
from converting type raid to raid.
2016-08-08 10:37:24 -05:00
Alasdair G Kergon
c55134aa48 lvconvert: Limit --corelog and --mirrorlog to mirrors.
It's an error to specify a log when the final result is not of type
mirror.
2016-08-08 14:39:55 +01:00
Heinz Mauelshagen
7d6cf12554 lvcreate: reject '--nosync' option for RAID6 LVs
The MD raid6 personality being used to drive lvm raid6 LVs does
read-modify-write updates to any stripes and thus relies on correct
P and Q Syndromes being written during initial synchronization or
it may fail reconstructing proper user data in case of SubLVs failing.

We may not allow the '--nosync' option on
creation of raid6 LVs for that reason.

Update/fix 'man lvcreate' in that regard.

add lvcreate-raid-nosync.sh test script.

- Resolves rhbz1358532
2016-08-08 13:52:35 +02:00