]> sourceware.org Git - lvm2.git/log
lvm2.git
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

7 years agocache: support cached origin for snapshot
Zdenek Kabelac [Mon, 19 Dec 2016 13:08:56 +0000 (14:08 +0100)]
cache: support cached origin for snapshot

Enable  'lvcreate/lvconvert -s' for cached LV.
and supported operations:

Create a snapshot of cached LV

Split/Join snapshot LV to cached origin LV.

7 years agolvconvert: fix shown lv name for snapshot split
Zdenek Kabelac [Mon, 19 Dec 2016 13:06:55 +0000 (14:06 +0100)]
lvconvert: fix shown lv name for snapshot split

We can't keep 'display_lvname' for too long - it's using
ringbuffer and keeps limited number of names. So it's
safe only per few simple tests,  but can't be used anymore
after some function calls..
(Fixes 00e641ef37a977129acc503f3fa1b67f556ac5eb)

7 years agolibdm: add dm_stats_bind_from_fd()
Bryn M. Reeves [Sun, 18 Dec 2016 14:40:57 +0000 (14:40 +0000)]
libdm: add dm_stats_bind_from_fd()

dmsetup already has a version of this function, and dmfilemapd will
need it too: move it to libdevmapper to avoid copying it around.

7 years agolibdm: clear region table in dm_stats_list()
Bryn M. Reeves [Thu, 15 Dec 2016 19:03:42 +0000 (19:03 +0000)]
libdm: clear region table in dm_stats_list()

Call _stats_regions_destroy() from dm_stats_list() if dms->regions
is non-NULL. This avoids leaking any pool allocations and ensures
the handle is in a known state: if an error occurs during the list,
dms->regions will be NULL and the handle will appear empty.

7 years agotests: using cached LV for external origin
Zdenek Kabelac [Sun, 18 Dec 2016 16:43:05 +0000 (17:43 +0100)]
tests: using cached LV for external origin

7 years agodebug: add debug message showing new lv
Zdenek Kabelac [Sun, 18 Dec 2016 14:05:18 +0000 (15:05 +0100)]
debug: add debug message showing new lv

Make trace easier to follow knowing which LV was added to dtree.

7 years agoactivate: further _info API refinement
Zdenek Kabelac [Sun, 18 Dec 2016 13:57:16 +0000 (14:57 +0100)]
activate: further _info API refinement

Another cleanup of internal _info() API simplifying code.
Also make sure 'error' on _info() call is properly passed upward
(return 0 is error path).

7 years agothin: add comment with future extension
Zdenek Kabelac [Sun, 18 Dec 2016 14:06:12 +0000 (15:06 +0100)]
thin: add comment with future extension

It could be actually better to use even cache origin in
read-only mode so there could no be some 'acidental'
change being done on this volume.

This however need further tools enhancment - where we would need
to handle whole subtree on 'lvchange -pr/-prw'.

7 years agobackup: show warning once per command
Zdenek Kabelac [Sun, 18 Dec 2016 15:36:33 +0000 (16:36 +0100)]
backup: show warning once per command

When command calls backup() more then once (which is actually not
wanted) this warning message is shown repeatedly:

"WARNING: This metadata update is NOT backed up."

Instead now print message just once and less confuse user.

7 years agolvconvert: support cache to external origin conversion
Zdenek Kabelac [Sat, 17 Dec 2016 21:41:27 +0000 (22:41 +0100)]
lvconvert: support cache to external origin conversion

Add this functionality to lvconvert:

'lvconvert --thin cachedLV --thinpool vg/poll'

Converts cachedLV to external origin (which will be read-only).
New thin volume is created in thinpool LV and it's using external
origin as source for unprovisioned chunks.
This conversion happens  online (while volume is in use).
Thin LV remains fully writable.
Cached external origin no longer could be written so cache will be used
ONLY for read operations. For this limitation we require cache mode
to be writethrough (as writeback cannot write to read-only volumes).

When  thinLV is later removed  cached external origin is again
fully usable, just note, LV remain in 'read-only' mode.
When read-write is needed,  'lvchange -prw' has to be used.

Single external origin could be user by multiple thinLV in
multiple differen thin pool.

7 years agocache: improve activation with -real
Zdenek Kabelac [Sun, 18 Dec 2016 14:05:31 +0000 (15:05 +0100)]
cache: improve activation with -real

When cache volume may be converted from normal to -real layer LV
we need to improve logic for call cache_check.

With this patch, we register call for cache_check only when metadata LV
is not yet present in active table slot (should match initial table
load).
This avoids unwanted checking when cache would become layer device
online.

7 years agolibdm: drop callback on revert path
Zdenek Kabelac [Sat, 17 Dec 2016 21:40:59 +0000 (22:40 +0100)]
libdm: drop callback on revert path

The system is likely in some very inconsisten state.
Do not try to make it even more problematic with trying
to invoke tools like thin_check via callback.

7 years agolv: fix lock holder for external origin
Zdenek Kabelac [Sat, 17 Dec 2016 21:40:14 +0000 (22:40 +0100)]
lv: fix lock holder for external origin

External origin could be reloaded via more locks.
It's actually even more complex then thin-pool,
as it may be active on more nodes for linear LVs
(and maybe even more types).

External origin is always read-only thus unmodifiable
device so there should not be a problem accesing it
through multiple nodes.

Also for thin-pool check first presence of active thin-pool.

FIXME:
It's not easy to detect on which nodes this device is active
Thus manipulation with such device may require checking every
node and it active state and refresh.

But since such setup is quite complex to prepare and use,
hopefully there are not user trying to 'explore' this usage yet.

7 years agocache: prepare status checking for layer
Zdenek Kabelac [Sat, 17 Dec 2016 20:52:27 +0000 (21:52 +0100)]
cache: prepare status checking for layer

To be ready to show status of cache volume, call the status
with layer.  Layer is automatically detected in this case when
cache volume is used in 'layered' form (needs -real suffix).

7 years agocache: improve wait for cache clear
Zdenek Kabelac [Sun, 18 Dec 2016 14:05:57 +0000 (15:05 +0100)]
cache: improve wait for cache clear

Avoid printing misleading message about single dirty block.
Instead properly detect condition where the 'cleaner' policy
needs to be installed without 'overloading' dirty variable.

Also print warning if we would be clearing read-only volume.
(it really shouldn't happen).

7 years agovalidation: check external property is matching
Zdenek Kabelac [Sat, 17 Dec 2016 20:58:35 +0000 (21:58 +0100)]
validation: check external property is matching

Detect if number of external_count is matching
referencing devices for  external_origin LV.

7 years agothin: reload external origin with last thin
Zdenek Kabelac [Sat, 17 Dec 2016 20:55:02 +0000 (21:55 +0100)]
thin: reload external origin with last thin

External origin could be activated as stand-alone device.
When the last thin LV is removed, external origin is no longer
the external origin and it's layer property was dropped.

Ensure dm table is correct by reloading external origin
(when it's active).

7 years agolvs: show status for layer
Zdenek Kabelac [Sat, 17 Dec 2016 20:54:51 +0000 (21:54 +0100)]
lvs: show status for layer

When LV is external origin, show info for LV but
status for -layer.  So we expose more info to a user
as otherwise active external origin is only linear
mapping of -real layer.

We do the same for i.e. old snaphost origin.

7 years agoraid: fix activation of tracked image
Zdenek Kabelac [Wed, 14 Dec 2016 20:47:38 +0000 (21:47 +0100)]
raid: fix activation of tracked image

Activation of raid has brough up also splitted image with tracing
(without taking lock for this).

So when raid is now activate - such image is not put into
table (with _rmeta).  When user needs such device, just active it.

7 years agodmstats: don't declare _start_timestamp if HAVE_SYS_TIMERFD_H
Bryn M. Reeves [Sun, 18 Dec 2016 14:08:11 +0000 (14:08 +0000)]
dmstats: don't declare _start_timestamp if HAVE_SYS_TIMERFD_H

The _start_timestamp is not used by the TIMERFD clock.

7 years agodmstats: fix TIMERFD _timer_running() test
Bryn M. Reeves [Sun, 18 Dec 2016 14:07:25 +0000 (14:07 +0000)]
dmstats: fix TIMERFD _timer_running() test

7 years agodmstats: fix interval number reporting with --count=0
Bryn M. Reeves [Sun, 18 Dec 2016 12:58:03 +0000 (12:58 +0000)]
dmstats: fix interval number reporting with --count=0

When --count=0 interval numbers are miscalculated:

Interval     #18446744069414584325     time delta:    999920887ns
Interval     #18446744069414584325   current err:       -79113ns
End interval #18446744069414584325  duration:    999920887ns

This is because the command line argument is cast through the
uint32_t type, and fixed to UINT32_MAX:

  _count = ((uint32_t)_int_args[COUNT_ARG]) ? : UINT32_MAX;

We also need to handle --count=0 specially when calculating the
interval number: since intervals count from #1, this must account
for the implicit "minus one" when converting from zero to the
UINT64_MAX value used (which is too large to store in _int_args).

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