]> sourceware.org Git - lvm2.git/log
lvm2.git
7 years agocoverity: fix mem leak on error path in dm stats
Zdenek Kabelac [Sat, 11 Feb 2017 20:17:41 +0000 (21:17 +0100)]
coverity: fix mem leak on error path in dm stats

Free allocated resouces on error path.

7 years agocoverity: remove unneeded header files
Zdenek Kabelac [Sat, 11 Feb 2017 20:17:27 +0000 (21:17 +0100)]
coverity: remove unneeded header files

7 years agocleanup: drop double const specifier
Zdenek Kabelac [Sat, 11 Feb 2017 19:30:16 +0000 (20:30 +0100)]
cleanup: drop double const specifier

Remove duplicated 'const' specifier.
Reindent.

7 years agomem: add extra mem pages for pthread stack
Zdenek Kabelac [Sat, 11 Feb 2017 17:14:00 +0000 (18:14 +0100)]
mem: add extra mem pages for pthread stack

Some archs can use even 64K pages and then lvm2 runs into trouble if
the stack is 'too small' to fit extra page capturing stack overwrite.

So when lvm2 limits stack - add extra mem page - be it 4K or 64K.

Relates to ppc64le bug: https://bugzilla.redhat.com/1387279

7 years agolvconvert: remove test code
Heinz Mauelshagen [Fri, 10 Feb 2017 22:43:56 +0000 (23:43 +0100)]
lvconvert: remove test code

Remove allocate_pvs from raid_manip.c:_region_size_change_request() API
and lv_extend() using it added for temporary test purpose.

Related: rhbz1366296

7 years agolvconvert: add region size checks
Heinz Mauelshagen [Fri, 10 Feb 2017 22:35:53 +0000 (23:35 +0100)]
lvconvert: add region size checks

Add:
- region size checks to raid_manip.c types array and supporting functions
- tests to lvconvert-raid-takeover.sh to check bogus
  "lvconvert --type  --regionsize N " requests

Related: rhbz1366296

7 years agotest: lvresize-raid.sh missing conditional
Heinz Mauelshagen [Fri, 10 Feb 2017 20:19:03 +0000 (21:19 +0100)]
test: lvresize-raid.sh missing conditional

Test missed to check for raid0 present in the kernel.

Related: rhbz1366296

7 years agolibdm: avoid resume if preloaded device is smaller
Zdenek Kabelac [Fri, 10 Feb 2017 18:57:04 +0000 (19:57 +0100)]
libdm: avoid resume if preloaded device is smaller

When we preload device with smaller size, we avoid its resume,
so later suspend/resume of full device tree my process all
existing in flight bios.

Also update comment and avoid using confusing opposite meaning.

7 years agodmsetup: do not suppress kernel key descriptions in tables
Ondrej Kozina [Fri, 10 Feb 2017 12:19:22 +0000 (13:19 +0100)]
dmsetup: do not suppress kernel key descriptions in tables

Kernel 4.10 (dm-crypt v1.15.0) and later supports loading device
tables with crypt segment having key in kernel keyring retention
service.

dmsetup hid key section of tables output. With this patch dmsetup
no longer hides key section if it detects kernel key description
instead of hex byte representation of key itself.

7 years agolvconvert: add conversion from/to raid10
Heinz Mauelshagen [Fri, 10 Feb 2017 18:10:05 +0000 (19:10 +0100)]
lvconvert: add conversion from/to raid10

Add:
- conversion support from striped/raid0/raid0_meta to/from raid10;
  raid10 goes by the near format (same as used in creation of
  raid10 LVs), which groups data copies together with their original
  blocks (e.g. 3-way striped, 2 data copies resulting in 112233 in the
  first stripe followed by 445566 in the second etc.) and is limited
  to even numbers of legs for now
- related tests to lvconvert-raid-takeover.sh
- typo

Related: rhbz1366296

7 years agoman: mention dmstats in lvmsar and lvmsadc man pages
Bryn M. Reeves [Fri, 10 Feb 2017 17:07:39 +0000 (17:07 +0000)]
man: mention dmstats in lvmsar and lvmsadc man pages

7 years agolvreduce/lvresize: add ability to reduce the size of a RaidLV
Heinz Mauelshagen [Thu, 9 Feb 2017 21:41:28 +0000 (22:41 +0100)]
lvreduce/lvresize: add ability to reduce the size of a RaidLV

- support shrinking of raid0/1/4/5/6/10 LVs
- enhance lvresize-raid.sh tests: add raid0* and raid10
- fix have_raid4 in aux.sh to allow lv_resize-raid.sh
  and other scripts to test raid4

Resolves: rhbz1394048

7 years agolvconvert: add support to change RAID region size (fixup)
Heinz Mauelshagen [Tue, 7 Feb 2017 18:01:02 +0000 (19:01 +0100)]
lvconvert: add support to change RAID region size (fixup)

Commit cfb6ef654d3d1f1dd02569a1d5bd2fc252ae2494 introduced
support to change RAID region size.

Fix:
- don't change region_size until after prompting the user
- use log_print_unless_silent() instead of log_warn()
- avoid superfluous sigint() calls which are already
  covered in yes_no_prompt()
- typo

Related: rhbz1392947

7 years agolvconvert: avoid setting segment flag
Heinz Mauelshagen [Tue, 7 Feb 2017 16:48:17 +0000 (17:48 +0100)]
lvconvert: avoid setting segment flag

Fix:
- don't set SEG_RAID in _convert_mirror_to_raid1() errounously

Related: rhbz1366296

7 years agolvconvert: add support to change RAID region size (fixup)
Heinz Mauelshagen [Tue, 7 Feb 2017 15:52:04 +0000 (16:52 +0100)]
lvconvert: add support to change RAID region size (fixup)

Commit cfb6ef654d3d1f1dd02569a1d5bd2fc252ae2494 introduced
support to change RAID region size.

Add:
- missing conditions to support any types to function with
  it in lv_raid_convert();  temporary workaround used until
  cli validation patches get merged
- tests requesting "-R " to lvconvert-raid-takeover.sh
  involving a cleanup of the script

Related: rhbz1392947

7 years agolvconvert: add segtype raid5_n and conversions to/from it (cleanup)
Heinz Mauelshagen [Tue, 7 Feb 2017 11:25:26 +0000 (12:25 +0100)]
lvconvert: add segtype raid5_n and conversions to/from it (cleanup)

Cleanups as of Jons review:
- enhance comment about mandatory raid4 <-> raid5_n activation w/o metadata SubLVs
- remove bogus segment flag setting
- fix to sync related comments on conversions to raid0/striped and amongst raid4/5
- add missing error message for non-synced conversion to raid0/striped

Related: rhbz1366296

7 years agolvconvert: add support to change RAID region size
Heinz Mauelshagen [Mon, 6 Feb 2017 21:09:26 +0000 (22:09 +0100)]
lvconvert: add support to change RAID region size

Add:
- support to change region size of existing RaidLVs
  (all RAID LV types but raid0/raid0_meta)
- lvconvert-raid-regionsize.sh with test variations
  for different RAID types and region sizes

Resolves: rhbz1392947

7 years agotests: drop zeroing
Zdenek Kabelac [Mon, 6 Feb 2017 12:15:39 +0000 (13:15 +0100)]
tests: drop zeroing

Well waiting for zeroing may take enough time to finish 'raid' sync.
So make the test running faster without zeroing and better avoid race
to have chance to happen (i.e. lvcreate is finished after array
gets already in sync).

7 years agotests: drop /tmp polution
Zdenek Kabelac [Mon, 6 Feb 2017 08:48:19 +0000 (09:48 +0100)]
tests: drop /tmp polution

Drop forgotten extra metadata debug.

7 years agocleanup: hide gcc warning
Zdenek Kabelac [Mon, 6 Feb 2017 10:41:22 +0000 (11:41 +0100)]
cleanup: hide gcc warning

Gcc is not clever enough to see these vars are actually initialize in
given code path so let's just make sure it has a value.

7 years agodebug: add space before uuid
Zdenek Kabelac [Sun, 5 Feb 2017 16:30:23 +0000 (17:30 +0100)]
debug: add space before uuid

With commit 88534625282e8d533ae439ed308a285da10e3ef0 we added
uuid right after device name. Add space between them.
(Also fix some indenting)

7 years agocomment: update
Zdenek Kabelac [Sat, 4 Feb 2017 14:44:25 +0000 (15:44 +0100)]
comment: update

Fix can -> cannot.

7 years agocleanup: rename to use track_ prefix
Zdenek Kabelac [Sat, 4 Feb 2017 14:02:34 +0000 (15:02 +0100)]
cleanup: rename to use track_  prefix

Since we use 'track_' prefix for other deps tracking,
convert skip_external_lv to use same logical meaning.
(just converts  1->0  0->1)

7 years agoclvmd: add mutex protection for cpg_ call
Zdenek Kabelac [Sat, 4 Feb 2017 13:47:27 +0000 (14:47 +0100)]
clvmd: add mutex protection for cpg_ call

The library for corosync multicasting is not supporting multithread
usage - add local mutex to avoid parallel call of cpg_mcast_joined().

7 years agolvconvert: add segtypes raid6_{ls,rs,la,ra}_6 and conversions to/from it
Heinz Mauelshagen [Sat, 4 Feb 2017 23:53:36 +0000 (00:53 +0100)]
lvconvert: add segtypes raid6_{ls,rs,la,ra}_6 and conversions to/from it

Add:
- support for segment types raid6_{ls,rs,la,ra}_6
  (striped raid with dedicated last Q-Syndrome SubLVs)
- conversion support from raid5_{ls,rs,la,ra} to/from raid6_{ls,rs,la,ra}_6
- setting convenient segtypes on conversions from/to raid4/5/6
- related tests to lvconvert-raid-takeover.sh factoring
  out _lvcreate,_lvconvert funxtions

Related: rhbz1366296

7 years agoWHATS_NEW: New segment type raid6_n_6
Heinz Mauelshagen [Sat, 4 Feb 2017 13:09:26 +0000 (14:09 +0100)]
WHATS_NEW: New segment type raid6_n_6

7 years agolvconvert: add segtype raid6_n_6 and conversions to/from it
Heinz Mauelshagen [Sat, 4 Feb 2017 00:40:58 +0000 (01:40 +0100)]
lvconvert: add segtype raid6_n_6 and conversions to/from it

Add:
- support for segment type raid6_n_6 (striped raid with dedicated last parity/Q-Syndrome SubLVs)
- conversion support from striped/raid0/raid0_meta/raid4 to/from raid6_n_6
- related tests to lvconvert-raid-takeover.sh

Related: rhbz1366296

7 years agoWHATS_NEW: New segment type raid5_n
Heinz Mauelshagen [Fri, 3 Feb 2017 22:41:48 +0000 (23:41 +0100)]
WHATS_NEW: New segment type raid5_n

7 years agolvconvert: add segtype raid5_n and conversions to/from it
Heinz Mauelshagen [Fri, 3 Feb 2017 21:16:00 +0000 (22:16 +0100)]
lvconvert: add segtype raid5_n and conversions to/from it

Change:
- missed a return_0
- use lvseg_name() rather than my own function

Related: rhbz1366296

7 years agolvconvert: add segtype raid5_n and conversions to/from it
Heinz Mauelshagen [Fri, 3 Feb 2017 19:39:40 +0000 (20:39 +0100)]
lvconvert: add segtype raid5_n and conversions to/from it

Add:
- support for segment type raid5_n (striped raid with dedicated last parity SubLVs)
- conversion support from striped/raid0/raid0_meta/raid4 to/from raid5_n
- related tests to lvconvert-raid-takeover.sh

Related: rhbz1366296

7 years agolvmdbusd: cmdhandler.py, remove duplicate code
Tony Asleson [Thu, 2 Feb 2017 01:05:41 +0000 (19:05 -0600)]
lvmdbusd: cmdhandler.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agolvmdbusd: manager.py, remove duplicate code
Tony Asleson [Thu, 2 Feb 2017 00:57:01 +0000 (18:57 -0600)]
lvmdbusd: manager.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agolvmdbusd: lvmdb.py, remove duplicate code
Tony Asleson [Thu, 2 Feb 2017 00:56:39 +0000 (18:56 -0600)]
lvmdbusd: lvmdb.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agolvmdbusd: pv.py, remove duplicate code
Tony Asleson [Wed, 1 Feb 2017 22:51:00 +0000 (16:51 -0600)]
lvmdbusd: pv.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agolvmdbusd: vg.py, remove duplicate code
Tony Asleson [Wed, 1 Feb 2017 22:37:03 +0000 (16:37 -0600)]
lvmdbusd: vg.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agolvmdbusd: lv.py, remove duplicate code
Tony Asleson [Wed, 1 Feb 2017 21:38:55 +0000 (15:38 -0600)]
lvmdbusd: lv.py, remove duplicate code

Move similar code to common functions, less is more!

7 years agoman: add update_filemap to dmstats.8.in dev-bmr-dmstats-filemap-update
Bryn M. Reeves [Sat, 17 Dec 2016 16:36:26 +0000 (16:36 +0000)]
man: add update_filemap to dmstats.8.in

7 years agodmstats: allow --filemap groups to be updated
Bryn M. Reeves [Sun, 11 Dec 2016 13:26:34 +0000 (13:26 +0000)]
dmstats: allow --filemap groups to be updated

Add a new update_filemap command to dmstats that allows a filemap
group to be updated:

  # dmstats update_filemap --groupid 0 vm.img
  /var/lib/libvirt/images/vm.img: Updated group ID 0 with 137 region(s).

This will update the set of regions mapped to the file to reflect
the current file system allocation.

Currently this needs to be run manually - a future update will add
support for monitoring file maps via a daemon, allowing them to be
automatically updated when the underlying file is modified.

7 years agolibdm: add dm_stats_update_regions_from_fd()
Bryn M. Reeves [Sun, 11 Dec 2016 12:53:04 +0000 (12:53 +0000)]
libdm: add dm_stats_update_regions_from_fd()

Add a call to update the regions corresponding to a file mapped
group of regions. The regions to be updated must be grouped, to
allow us to correctly identify extents that have been deallocated
since the map was created.

Tables are built of the file extents, and the extents currently
mapped to dmstats regions: if a region no longer has a matching
file extent, it is deleted, and new regions are created for any
file extents without a matching region.

The FIEMAP call returns extents that are currently in-memory (or
journaled) and awaiting allocation in the file system. These have
the FIEMAP_EXTENT_UNKNOWN | FIEMAP_EXTENT_DELALLOC flag bits set
in the fe_flags field - these extents are skipped until they
have a known disk location.

Since it is possile for the 0th extent of the file to have been
deallocated this must also handle the possible deletion and
re-creation of the group leader: if no other region allocation
is taking place the group identifier will not change.

7 years agolibdm: test for DM_STATS_GROUP_NOT_PRESENT in _stats_group_id_present
Bryn M. Reeves [Wed, 25 Jan 2017 15:10:59 +0000 (15:10 +0000)]
libdm: test for DM_STATS_GROUP_NOT_PRESENT in _stats_group_id_present

If the group_id passed to _stats_group_id_present is equal to the
special value DM_STATS_GROUP_NOT_PRESENT there is no need to perform
any further tests: return false immediately.

7 years agolibdm: fix stats comment formatting in libdevmapper.h
Bryn M. Reeves [Tue, 24 Jan 2017 09:29:08 +0000 (09:29 +0000)]
libdm: fix stats comment formatting in libdevmapper.h

7 years agotoolcontext: action for LVM_RUN_BY_DMEVENTD env var
Zdenek Kabelac [Mon, 23 Jan 2017 13:24:27 +0000 (14:24 +0100)]
toolcontext: action for LVM_RUN_BY_DMEVENTD env var

When LVM_RUN_BY_DMEVENTD is set to 1, ensure there will
be no interaction with dmeventd.

7 years agodmeventd_thind: set LVM_RUN_BY_DMEVENTD
Zdenek Kabelac [Mon, 23 Jan 2017 13:23:24 +0000 (14:23 +0100)]
dmeventd_thind: set LVM_RUN_BY_DMEVENTD

Set LVM_RUN_BY_DMEVENTD envvar to expose the command is runing from
dmeventd environment.

7 years agoclean: move code to lib part
Zdenek Kabelac [Mon, 23 Jan 2017 13:21:56 +0000 (14:21 +0100)]
clean: move code to lib part

Move actual processing part of the lvm2_disable_dmeventd_monitoring()
into a /lib part so we can reuse the code later for other cases.

7 years agotests: umount when above 95
Zdenek Kabelac [Sat, 21 Jan 2017 21:53:57 +0000 (22:53 +0100)]
tests: umount when above 95

Add code to check if resulting data or metadata remained over 95%
and in such case invoke umount.

7 years agotests: properly quote heredoc
Zdenek Kabelac [Sat, 21 Jan 2017 18:21:08 +0000 (19:21 +0100)]
tests: properly quote heredoc

Prepend \$ for vars which should remain in script.
Also drop --lazy umount.
Move inittest call up, so mntdir and mntusedir have proper full path.

7 years agotests: implement umount in script
Zdenek Kabelac [Sat, 21 Jan 2017 16:37:53 +0000 (17:37 +0100)]
tests: implement umount in script

Since dmeventd no longer umounts thin devices, such logic
needs to be implemented by external script.
Add some very simple one for the start.

7 years agotests: enusure units in TiB
Zdenek Kabelac [Sat, 21 Jan 2017 15:20:41 +0000 (16:20 +0100)]
tests: enusure units in TiB

7 years agodmeventd_thin: internal command without lvm prefix
Zdenek Kabelac [Sat, 21 Jan 2017 16:37:01 +0000 (17:37 +0100)]
dmeventd_thin: internal command without lvm prefix

Internal command processing needs to go without 'lvm ' prefix.

7 years agodmeventd_thin: enable support for external command
Zdenek Kabelac [Fri, 20 Jan 2017 21:54:20 +0000 (22:54 +0100)]
dmeventd_thin: enable support for external command

With this commit we start to support configurable action
from thin-pool monitoring via  'dmeventd/thin_command'

7 years agodmeventd_thin: new logic for calling commands
Zdenek Kabelac [Fri, 20 Jan 2017 22:07:05 +0000 (23:07 +0100)]
dmeventd_thin: new logic for calling commands

For more advanced support we need to ensure better logic for calling
external much more advanced script for maintanance of thin-pool.

So this new code ensures:

When thin-pool data or metadata is bigger then 50%,
then with each 5% increment, action is called.
This is independent from autoextend_threshold.
This action always happens when thin-pool is over threshold,
(so no action when it's exactly i.e. 60%).
The only exception is 100% full thin-pool - which invokes 'last'
action.

Since thin-pool occupancy may change also downward, code needs
to also handle possibly reduction of occupancy  of thin-pool.
So when usage drop from 90% to 50%, thin-pool will start to call
again action when it will pass 55% threshold.

This give external commands lot of option i.e. to call 'fstrim'
before actual resize is needed.

7 years agodmeventd_thin: drop umounting on error path
Zdenek Kabelac [Fri, 20 Jan 2017 22:06:45 +0000 (23:06 +0100)]
dmeventd_thin: drop umounting on error path

Default internal logic will stop trying to do any 'rescue' action
when executed command fails.
This will be now fully in hands of external script if such
behaviour is needed.

7 years agodmeventd_thin: rework failure handling
Zdenek Kabelac [Fri, 20 Jan 2017 21:53:55 +0000 (22:53 +0100)]
dmeventd_thin: rework failure handling

Instead of stopping monitoring after couple failing retries,
keep monitoring forever, just make larger delays between command
retries (ATM upto ~42 minutes).

So syslog is not spammed too often, yet commands have a chance to
be retried and succeed eventually...

7 years agodmeventd_thin: SIGCHLD handler
Zdenek Kabelac [Wed, 18 Jan 2017 08:55:46 +0000 (09:55 +0100)]
dmeventd_thin: SIGCHLD handler

To improve reaction time on when child is finished,
lets handle SIGCHLD in particular thread.
Let's hope kernel will route SIGCHLD to matching thread.

7 years agodmeventd_thin: init command
Zdenek Kabelac [Fri, 20 Jan 2017 20:50:23 +0000 (21:50 +0100)]
dmeventd_thin: init command

When dmeventd configured command does not start with 'lvm ' prefix,
it's going to be an 'external' command.
In this case we split command by spaces to argv strings.

7 years agodmeventd_thin: add wait_pid
Zdenek Kabelac [Fri, 20 Jan 2017 20:42:55 +0000 (21:42 +0100)]
dmeventd_thin: add wait_pid

Add support handling command exit.

7 years agodmeventd_thin: add run_command
Zdenek Kabelac [Fri, 20 Jan 2017 20:41:23 +0000 (21:41 +0100)]
dmeventd_thin: add run_command

Implement forking of executable command.
When command is forked, dmeventd may continue monitor device.

7 years agodmeventd_thin: better warning logic
Zdenek Kabelac [Fri, 20 Jan 2017 20:53:13 +0000 (21:53 +0100)]
dmeventd_thin: better warning logic

When fullness is passing WARN_THRESHOLD, print warning,
when it drops bellow and crossed again, we should print
warning again, but always only once.

7 years agodmeventd_thin: switch to struct percent
Zdenek Kabelac [Wed, 18 Jan 2017 13:06:29 +0000 (14:06 +0100)]
dmeventd_thin: switch to struct percent

Later we can use stored percent values to pass them
to executed commands.

7 years agodmeventd_thin: handling of internal command
Zdenek Kabelac [Wed, 18 Jan 2017 08:56:15 +0000 (09:56 +0100)]
dmeventd_thin: handling of internal command

7 years agolvmcmd2lib: support new command
Zdenek Kabelac [Wed, 18 Jan 2017 08:53:46 +0000 (09:53 +0100)]
lvmcmd2lib: support new command

Internal command which reads lvm.conf settins and passes it
via envvar to dmeventd monitoring thread.

7 years agoconfig: new option dmeventd/thin_command
Zdenek Kabelac [Wed, 18 Jan 2017 08:54:32 +0000 (09:54 +0100)]
config: new option dmeventd/thin_command

This setting will allowing configuring which command gets executed
when thin-pool fullness goes from 50%..100%

7 years agocleanup: update config doc
Zdenek Kabelac [Fri, 20 Jan 2017 21:33:07 +0000 (22:33 +0100)]
cleanup: update config doc

7 years agolibdm: add human R|readable units
Zdenek Kabelac [Mon, 9 Jan 2017 15:30:49 +0000 (16:30 +0100)]
libdm: add human R|readable units

When showing sizes with 'H|human' units we do use standard rounding.
This however is confusing users from time to time,
when the printed number uses some biger units i.e. GiB and there is just
tiny fraction of space missing.

So here is some real-life example with new 'r' unit.

$lvs

  LV    VG Attr       LSize  Pool Origin
  lvol0 vg -wi-a-----  1.99g
  lvol1 vg -wi-a----- <2.00g
  lvol2 vg -wi-a----- <2.01g

Meaning is - lvol1 has 'slightly' less then 2.00g - from sign '<' user
can be aware the LV doesn't have full 2.00GiB in size so he
will be less surpriced allocation of 2G volume will not succeed.

$ vgs
  VG #PV #LV #SN Attr   VSize  VFree
  vg   2   2   0 wz--n- <6,00g <2,01g

For uses needing  'old'  undecorated human unit simply will continue
to use 'H|h' units.

The new R|r  may further change when we would recongnize some
other way how to improve readability.

7 years agodevices: Recognise Veritas Dynamic Multipathing
Alasdair G Kergon [Tue, 10 Jan 2017 22:23:23 +0000 (22:23 +0000)]
devices: Recognise Veritas Dynamic Multipathing

VxDMP doesn't interact very well with udev so always set
  devices/obtain_device_list_from_udev = 0
in lvm.conf on these systems.

7 years agotests: ignore racy test failure
Zdenek Kabelac [Fri, 6 Jan 2017 22:37:46 +0000 (23:37 +0100)]
tests: ignore racy test failure

When test fails here, make it just warning instead of failing whole
test.

7 years agotests: make test more race immune
Zdenek Kabelac [Fri, 6 Jan 2017 20:46:58 +0000 (21:46 +0100)]
tests: make test more race immune

Add more delay and increase raid size.
Speedup volume during wait for sync.
Drop --yes from lvcreate.

7 years agoraid: postpone archiving until metadata are changed
Zdenek Kabelac [Fri, 6 Jan 2017 22:36:31 +0000 (23:36 +0100)]
raid: postpone archiving until metadata are changed

Avoid archiving of lvm2 metadata when there is call of 'lvconvert --repair'
on healthy raid LV.

7 years agovgchange: also -l is uint32
Zdenek Kabelac [Fri, 6 Jan 2017 20:24:16 +0000 (21:24 +0100)]
vgchange: also -l is uint32

7 years agomirror: relax internal error for a while
Zdenek Kabelac [Fri, 6 Jan 2017 11:41:38 +0000 (12:41 +0100)]
mirror: relax internal error for a while

With recent commit d6a74025df1afb3d76bec435bc6a40d649217b42 using
INTERNAL_ERROR while cheking layer LV - it's been noticed mirror
logic currently doesn't do a correct thing during upconversion and
does a full-try instead of checking only allocator capabilities.
This leads to invalid usage of layer.

To keep existing code running before providing a fix, relax
INTERNAL_ERROR just an error and keep the 'code' running.

Once mirror code is fixed, these all check should be switched
to internal errors.

7 years agoblkdeactivate: also unmount mount point on top of MD device if using blkdeactivate -u
Peter Rajnoha [Fri, 6 Jan 2017 10:16:07 +0000 (11:16 +0100)]
blkdeactivate: also unmount mount point on top of MD device if using blkdeactivate -u

The blkdeactivate script processes MD devices too so we should unmount
any mount point on top of an MD device if blkdeactivate -u|--umount is
called.

Diagnosed and reported by: Rick Warner <rick@microway.com>
See also https://bugzilla.redhat.com/show_bug.cgi?id=1410585.

7 years agotests: slow down devs for raid more
Zdenek Kabelac [Wed, 4 Jan 2017 15:02:08 +0000 (16:02 +0100)]
tests: slow down devs for raid more

Since we still experience occasiaonal test failure - slow
things down even more to avoid race.

Add support for 'quick' table changes between normal & delayed tables.

7 years agotests: drop FIXME
Zdenek Kabelac [Wed, 4 Jan 2017 10:21:20 +0000 (11:21 +0100)]
tests: drop FIXME

Since we fixed core trouble with sequence of
suspend/resume/suspend without udev wait
we can drop 'should' and expect volume is still mounted.

7 years agoreport: report merged state for inactive LV
Zdenek Kabelac [Thu, 5 Jan 2017 14:52:00 +0000 (15:52 +0100)]
report: report merged state for inactive LV

This was missing piece in 77997c7673bfca56f51ae4eb55a50bc76e40fe79.
When merging origin is inactive (while driver is loaded) we
could already report merge in progress values as there is
no way to activate 'old state' now.

7 years agodebug: show proper error message for layer mismatch
Zdenek Kabelac [Thu, 5 Jan 2017 14:49:07 +0000 (15:49 +0100)]
debug: show proper error message for layer mismatch

Show proper internal error for failing command when there are some
inconsitencies in sizes of LV and its layer instead of rather
meaningless error code 5.

(Could be hit i.e. if user tried to 'resize' cached LV and then
uncache such LV.)

7 years agocache: resize is still unsupported
Zdenek Kabelac [Thu, 5 Jan 2017 14:32:25 +0000 (15:32 +0100)]
cache: resize is still unsupported

During rework of resize code this validation check
has been lost (in my resize branch). Upstream
is still not supporting resize of any cache type LV
so needs to be prevented.

7 years agocleanup: more use of lvseg_name
Zdenek Kabelac [Sat, 24 Dec 2016 23:29:30 +0000 (00:29 +0100)]
cleanup: more use of lvseg_name

Use existing function lvseg_name().

7 years agocleanup: use macros
Zdenek Kabelac [Sat, 24 Dec 2016 22:46:47 +0000 (23:46 +0100)]
cleanup: use macros

7 years agocleanup: defines
Zdenek Kabelac [Sat, 24 Dec 2016 22:24:37 +0000 (23:24 +0100)]
cleanup: defines

7 years agocleanup: reuse existing code
Zdenek Kabelac [Sat, 24 Dec 2016 22:10:06 +0000 (23:10 +0100)]
cleanup: reuse existing code

7 years agocache: add missing udev wait
Zdenek Kabelac [Tue, 3 Jan 2017 13:47:46 +0000 (14:47 +0100)]
cache: add missing udev wait

When we need to clear dirty cache content of cached LV, there
is table reload which usually is shortly followed by next metadata
change.  However  udev  can't (as of now)  process   udev event
while device is 'suspended'.

So whenever sequence of  'suspend/resume/suspend' is needed,
we need to wait first for finishing of 'resume' processing before
starting next 'suspend'. Otherwise there is  'race' danger of triggering
unwantend umount by systemd as  such event will trigger
SYSTEMD_READY=0 state for a moment for such changed device.

Such race is pretty ugly to trace so we may need to review more
sequencies for missing 'sync'.

(Other option is to enhnace 'udev' rules processing to avoid
such dramatic actions to be happening for suspended devices).

7 years agovgchange: max_pv limited to uint32
Zdenek Kabelac [Tue, 3 Jan 2017 12:04:51 +0000 (13:04 +0100)]
vgchange: max_pv limited to uint32

Solves: https://bugzilla.redhat.com/1280496

The only reasonable behaviour here is to error on
any number out of accepted range (i.e. now numbers
wrapping around with some hidden logic).

As this is plain bug there is no support for
backward compatibility since noone should
set numbers >UINT32_MAX and expect 0 or error
depending on how big number was used....

TODO: more fields might need to be converted.

7 years agolvmcmdline: support uint32
Zdenek Kabelac [Tue, 3 Jan 2017 12:02:52 +0000 (13:02 +0100)]
lvmcmdline: support uint32

Add simple function to wrap usage for only uint32 numbers.
Unlike  'int_arg'  which accepts full range of 64bit number
this function will error on numbers out of this range:

   <0, UINT32_MAX>

7 years agoman: fix name of 'write_time' field in dmstats.8.in
Bryn M. Reeves [Sun, 25 Dec 2016 17:36:35 +0000 (17:36 +0000)]
man: fix name of 'write_time' field in dmstats.8.in

7 years agotests: update test
Zdenek Kabelac [Fri, 23 Dec 2016 11:52:45 +0000 (12:52 +0100)]
tests: update test

lvm2 now correctly reports thin_id  after action of merged thin,
but before physical metadata update as we know the merge has happened.

7 years agovalidation: temporarily let pass linear with chunk_size
Zdenek Kabelac [Fri, 23 Dec 2016 11:40:40 +0000 (12:40 +0100)]
validation: temporarily let pass linear with chunk_size

Old pool format seems to be setting chunk_size.
For now let validation pass with this.

7 years agolvchange: allow a transiently failed RaidLV to be refreshed
Heinz Mauelshagen [Fri, 23 Dec 2016 02:35:13 +0000 (03:35 +0100)]
lvchange: allow a transiently failed RaidLV to be refreshed

Add to commits 87117c2b2546 and 0b8bf73a63d8 to avoid refreshing two
times altogether, thus avoiding issues related to clustered, remotely
activated RaidLV.  Avoid need to repeat "lvchange --refresh RaidLV"
two times as a workaround to refresh a RaidLV.  Fix handles removal
of temporary *-missing-* devices created for any missing segments
in RAID SubLVs during activation.

Because the kernel dm-raid target isn't able to handle transiently
failing devices properly we need
"[dm-devel][PATCH] dm raid: fix transient device failure processing"
as well.

test: add lvchange-raid-transient-failures.sh
      and enhance lvconvert-raid.sh

Resolves: rhbz1025322
Related:  rhbz1265191
Related:  rhbz1399844
Related:  rhbz1404425

7 years agotests: use hold_device_open
Zdenek Kabelac [Thu, 22 Dec 2016 22:31:22 +0000 (23:31 +0100)]
tests: use hold_device_open

7 years agotests: add device holding function
Zdenek Kabelac [Thu, 22 Dec 2016 21:21:09 +0000 (22:21 +0100)]
tests: add device holding function

Hold device open with sleep and wait till sleep really opens
given devices.

7 years agotests: workaround failure on fc23
Zdenek Kabelac [Tue, 20 Dec 2016 15:29:23 +0000 (16:29 +0100)]
tests: workaround failure on fc23

7 years agothin: refresh status when error processing fails
Zdenek Kabelac [Thu, 22 Dec 2016 22:28:04 +0000 (23:28 +0100)]
thin: refresh status when error processing fails

When thin-pool processes event and 'lvextend --use-policies' fails
rather capture up-to-date new info as the fullness percentage may
have jumped noticable. This way we could use 'more' correct numbers
when checking for thresholds.

7 years agoreport: show proper info for merging origin
Zdenek Kabelac [Thu, 22 Dec 2016 18:51:35 +0000 (19:51 +0100)]
report: show proper info for merging origin

When there is 'merging' of an origin in progress, but metadata stil
do provide both origin and snapshot, we should show data from merged
snapshot.  This is important mainly for thin case, where there was
a window, where i.e. 'lvs -o+device_id' would report information
about 'already gone' origin thin LV.

This race window is usually hard to trigger but can be ocasionally hit.
Usually shortly after activation, but before polling process manages
to update metadata after merge.

7 years agosnapshot: validate merge has started
Zdenek Kabelac [Thu, 22 Dec 2016 18:46:02 +0000 (19:46 +0100)]
snapshot: validate merge has started

Before starting polling process, validate the merge has actually started
so there is not pointless invoke of lvmpolld.

This also fixes reported message from command, so user has
correct info whether merging has already started or
if it's delayed for next activation.

7 years agolv: more exact check for merging origin
Zdenek Kabelac [Thu, 22 Dec 2016 20:15:31 +0000 (21:15 +0100)]
lv: more exact check for merging origin

Merging origin has 'MERGE_LV' and should also have its merging snapshot.

7 years agovalidation: rework segment validation
Zdenek Kabelac [Tue, 20 Dec 2016 14:59:11 +0000 (15:59 +0100)]
validation: rework segment validation

Move individual segment validation to a separate function
executed for 'complete_vg'.

Move some 'extra' validation bits from 'raid' validation to global
segtype validation (so extending existing normal validation)

TODO: still some test are left to be moved.
Reduce some duplication in validation process - there are still
some left thought so still room for improving overal speed.

7 years agolvmdbustest: Print messages if timeout value > 10%
Tony Asleson [Wed, 14 Dec 2016 21:32:08 +0000 (15:32 -0600)]
lvmdbustest: Print messages if timeout value > 10%

We will dump some informational messages if the time to return when we
specify a timeout exceeds 10% of requested.

7 years agolvmdbusd: Use timeout_add instead
Tony Asleson [Wed, 14 Dec 2016 21:30:01 +0000 (15:30 -0600)]
lvmdbusd: Use timeout_add instead

The function timeout_add_seconds has quite a bit of variability.  Using
timeout_add which specifies the timeout in ms instead of seconds.  Testing
shows that this is much more consistent which should improve clients that
are using shorter timeouts for the API and the connection.

7 years agolvmdbusd: Use cfg.reload() instead of dbo.refresh
Tony Asleson [Mon, 12 Dec 2016 22:15:12 +0000 (16:15 -0600)]
lvmdbusd: Use cfg.reload() instead of dbo.refresh

We want to update the data and send out any signals as needed, not just
update the in memory database.

7 years agolvmdbusd: Remove un-needed main thread execution
Tony Asleson [Mon, 12 Dec 2016 22:13:27 +0000 (16:13 -0600)]
lvmdbusd: Remove un-needed main thread execution

7 years agotests: usage of cached volume for snapshot
Zdenek Kabelac [Mon, 19 Dec 2016 13:05:16 +0000 (14:05 +0100)]
tests: usage of cached volume for snapshot

This page took 0.064785 seconds and 5 git commands to generate.