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

5269 Commits

Author SHA1 Message Date
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
Peter Rajnoha
2ff893cd85 conf: add comment about cfg_runtime 2016-08-15 10:38:38 +02:00
Heinz Mauelshagen
9c9b9b276a raid_manip: pay attention to PVs listed on command line when allocating MetaLVs
Adding MetaLVs to given DataLVs (e.g. raid0 -> raid0_meta takeover) wasn't
paying attention to any PVs listed on the lvconvert command line.
2016-08-13 00:20:01 +02:00
Heinz Mauelshagen
6d52b17dfc raid_manip: add missing code avoiding MetaLV collocation on the same PV
Adding MetaLVs to given DataLVs (e.g. raid0 -> raid0_meta takeover),
_avoid_pvs_with_other_images_of_lv() was missing code to prohibit
allocation when called with a just allocated MetaLV to prohibit
collaocation of the next allocated MetaLV on the same PV.

- resolves rhbz1366738
2016-08-12 22:46:57 +02:00
Tony Asleson
0973d6e331 notify: Fix hang with lvm shell & --enable-notify-dbus
When lvm is compiled with --enable-notify-dbus and a user uses lvm
shell, after they issue 200+ commands the lvm shell will hang for
~30 seconds trying to notify the lvm dbus service that a change
has occurred.  This appears to be caused by resource exhaustion,
because the sockets used for dbus communication are not be closed.
2016-08-12 14:36:43 -05: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
Alasdair G Kergon
93b61c07eb raid: Avoid double suffix on rmeta LV name paired with rimage LV. 2016-08-11 23:31:49 +01: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
29f7dc2922 conf: mark selected settings with CFG_DISALLOW_INTERACTIVE flag 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
54bf15555b refactor: modify original _check_profile fn and rename to config_force_check for general use 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
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
76ef2d15d8 lvconvert: Support raid0<->raid4 and mirror<->raid1.
Only simple takeover cases so far.
2016-08-07 00:56:08 +01:00
Alasdair G Kergon
de7f1deb80 raid: Report supported lvconvert conversions if invalid. 2016-08-07 00:30:26 +01:00
Alasdair G Kergon
6f236c3353 raid: Add workaround to prepare for raid4 conversions. 2016-08-07 00:07:06 +01:00
Alasdair G Kergon
ba0c26a078 raid: Pass list of LVs to remove into more fns. 2016-08-06 23:46:45 +01:00
Alasdair G Kergon
30884208d4 raid: Move two functions. 2016-08-06 23:29:27 +01:00
Heinz Mauelshagen
8f25ad6416 raid_manip: fix log print format from commit d2c3b23e6d 2016-08-05 16:29:56 +02:00
Heinz Mauelshagen
d2c3b23e6d lvchange: Allow device specification when requesting a repair
'lvchange --resync LV' or 'lvchange --syncaction repair LV' request the
RAID layout specific parity blocks in raid4/5/6 to be recreated or the
mirrored blocks to be copied again from the master leg/copy for raid1/10,
thus not allowing a rebuild of a particular PV.

Introduce repeatable option '--[raid]rebuild PV' to allow to request
rebuilds of specific PVs in a RaidLV which are known to contain corrupt
data (e.g. rebuild a raid1 master leg).

Add test lvchange-rebuild-raid.sh to test/shell doing rebuild
variations on raid1/10 and 5; add aux function check_status_chars
to support the new test.

 - Resolves rhbz1064592
2016-08-05 16:01:46 +02:00
Alasdair G Kergon
91f866f786 raid: Tell lib whether stripesize was specified 2016-08-05 14:28:14 +01:00
Alasdair G Kergon
7482ff93b8 raid: Turn lv_raid_change_image_count into wrapper
Eventually the separate entry point will disappear.
2016-08-05 14:17:54 +01:00
Alasdair G Kergon
b66fa91c46 segtypes: Further segtype macros. 2016-08-05 14:00:40 +01:00
Alasdair G Kergon
b1b0b134ec raid0: Validate presence of raid0 meta_areas more tightly. 2016-08-04 21:15:07 +01:00
Alasdair G Kergon
4a15abe865 striped: Add precise macros for original segtype.
The existing striped macros include raid0 segments.
2016-08-04 01:24:39 +01:00
Alasdair G Kergon
fdc3fcbfce lvconvert: Pass region_size to lv_raid_convert. 2016-08-02 23:51:20 +01:00
Heinz Mauelshagen
d0d03f315b vg_validate: correct min_recovery_rate check message 2016-08-02 15:27:13 +02:00
Heinz Mauelshagen
5765a28456 vg_validate: new RAID segment checks in check_lv_segments()
introduced with commit 8f62b7bfe5 rely on complete
             defintions of the relations between the LVs of a VG.
             Hence only run these checks when the complete_vg flag
             is set on calls to check_lv_segments().

             lvconvert failed in test lvconvert-thin-raid.sh when
             calling check_lv_segments() from _read_segments() without
             providing a complete definition.
2016-08-01 22:42:05 +02:00
Alasdair G Kergon
c490be9134 Revert "thin: when converting a thin pool data or metadata LV from"
This reverts commit 237f84e038.

This case failed:
    lvcreate --type raid1 -m1 -l2 vg99
    lvcreate -aey -l2 -s vg99/lvol0
    lvconvert -m2 vg99/lvol0
2016-08-01 15:17:44 +01:00
Alasdair G Kergon
52d2fa7022 tools: Also recognise segtype with thin and cache.
(--type thin still needs this for lvcreate - more logic should be
shared between lvcreate and lvconvert)
2016-07-30 04:12:58 +01:00
Alasdair G Kergon
d1ff254c3c tools: mirror also supports stripesize 2016-07-30 03:52:49 +01:00
Alasdair G Kergon
4ffe15bf6a tools: Unify stripesize parameter validation.
Move it all into get_stripe_params().
Some code paths missed --stripesize checks.
E.g. lvcreate --type raid4 -i1
2016-07-30 02:05:50 +01:00
Heinz Mauelshagen
237f84e038 thin: when converting a thin pool data or metadata LV from
linear to raid1, the linear wasnt't switched to the
      raid1 mapping, thus creating the false impression of
      resilience.
2016-07-29 19:17:12 +02:00
Alasdair G Kergon
6f47e79a88 pre-release 2016-07-28 18:36:45 +01:00
Zdenek Kabelac
edb5d12463 config: keep new setting commented out 2016-07-28 15:08:11 +02:00
Heinz Mauelshagen
43f4555893 vg_validate: only reject min_recovery_rate in case max_recovery_rate is set and smaller 2016-07-27 23:20:58 +02:00
Heinz Mauelshagen
d46de28a6c vg_validate: add missing check for raid6 segment types 2016-07-27 23:14:46 +02:00
Heinz Mauelshagen
df02917d7e vg_validate: fix seg->extents_copied check introduced with
commit 8f62b7bfe5 and add comment for the member
             to 'struct lv_segment'
2016-07-27 23:09:54 +02:00
Heinz Mauelshagen
8f62b7bfe5 vg_validate: segment check enhancements for raids to catch bogus metadata
General RAID and RAID segment type specific checks are added
to merge.c. New static _check_raid_seg() is called on each segment
of a RaidLV (which have just one) from check_lv_segments().

New checks caught some unititialized segment members
which are addressed here as well:

- initialize seg->region_size to 0 in lvcreate.c for raid0/raid0_meta

- initialize list seg->origin_list in lv_manip.c
2016-07-27 18:17:29 +02:00
Zdenek Kabelac
5636bfd83d lvconvert: suppress zeroing warning when converting to thin
When volume was lvconvert-ed to a thin-volume with external origin,
then in case thin-pool was in non-zeroing mode
it's been printing WARNING about not zeroing thin volume - but
this is wanted and expected - so nothing to warn about.

So in this particular use case WARNING needs to be suppressed.

Adding parameter support for lvcreate_params.

So now lvconvert creates 'normal thin LV' in read-only mode
(so any read will 'return 0' for a moment)
then deactivate regular thin LV and reacreate in 'final R/RW' mode
thin LV with external origin and activate again.
2016-07-27 16:20:57 +02:00
Peter Rajnoha
070c0d31ab metadata: fix automatic updates of PV extension headers to newest version
Before, the automatic update from older to newer version of PV extension
header happened within vg_write call. This may have caused problems under
some circumnstances where there's a code in between vg_write and vg_commit
which may have failed. In such situation, we reverted precommitted metadata
and put back the state to working version of VG metadata.

However, we don't have revert for PV write operation at the moment. So
if we updated PV headers already and we reverted vg_write due to failure
in subsequent code (before vg_commit), we ended up with lost VG metadata
(because old metadata pointers got reset by the PV write operation).

To minimize problematic situations here, we should put vg_write and
vg_commit that is done after PV header rewrites as close to each
other as possible.

This patch moves the automatic PV header rewrite for new extension
header part from vg_write to _vg_read where it's done the same way
as we do any other VG repairs if detected during VG read operation
(under VG write lock).
2016-07-26 16:22:55 +02:00
David Teigland
d0e15b86b5 lvmlockd: improve error message about missing global lock
If the VG holding the global lock is removed, we can indicate
that as the reason for not being able to acquire the global
lock in subsequent error messages, and can suggest enabling
the global lock in another VG.  (This helpful error message
will go away if the global lock is enabled in another VG,
or if lvmlockd is restarted.)
2016-07-25 14:49:01 -05:00
Alasdair G Kergon
5397837a9f segtype: Fix unrecognised flag message.
Show in hex not decimal.
2016-07-25 12:59:50 +01:00
Alasdair G Kergon
3bc1adc404 raid_manip: Some validation functions. 2016-07-24 01:40:24 +01:00
Alasdair G Kergon
ea543b5c6f raid_manip: Fix stripe_size type to uint32_t. 2016-07-24 01:35:04 +01:00
Alasdair G Kergon
4a544ae272 raid_manip: Reorder some functions. 2016-07-24 01:31:30 +01:00
David Teigland
f6acf922e6 lvmlockd: improve activation locking error message
to include the LV type
2016-07-22 14:50:33 -05:00
David Teigland
6ea250e2d0 lvmetad: fix use committed metadata to update
In some cases, the command will update VG metadata
in lvmetad without writing it.  In these cases there
is no vg->vg_committed and it should use 'vg' directly.
This happens when the command finds that the lvmetad
VG has been invalidated, rereads the metadata from disk,
then updates lvmetad with that metadata.  This happens
often with lvmlockd or foreign VGs, and can happen without
lvmlockd if a previous command fails after invalidating
the VG in lvmetad.
2016-07-20 10:25:26 -05:00