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

13815 Commits

Author SHA1 Message Date
Bryn M. Reeves
d28a50ec76 libdm: make dm_stats_destroy(NULL) a no-op
Test for NULL in dm_stats_destroy() and return immediately if
the struct dm_stats pointer is NULL (similar to free(NULL)).

This simplifies cleanup code which otherwise needs to:

  out:
    if (dms)
        dm_stats_destroy(dms);
    return;
2017-03-10 16:41:28 +00:00
Bryn M. Reeves
93644be44b libdm: dm_stats_start_filemapd() mode can never be < 0 2017-03-10 14:42:23 +00:00
Heinz Mauelshagen
bc3bec6c54 raid: fix compile time warning 2017-03-10 14:43:37 +01:00
Bryn M. Reeves
59e57be54f man: add man-generator and build artefacts to .gitignore 2017-03-10 13:14:02 +00:00
Bryn M. Reeves
1f7ac54bc4 tools: add generated headers to .gitignore 2017-03-10 13:13:41 +00:00
Bryn M. Reeves
6a0f597727 dmsetup: always initialise 'mode' in filemap create functions
Older compilers cannot tell that the 'mode' variable is only
used in branches in which it is assigned:

dmsetup.c:5651: warning: "mode" may be used uninitialized in this function
dmsetup.c:5023: warning: "mode" may be used uninitialized in this function

Avoid this by always assigning the variable a value.
2017-03-10 12:17:25 +00:00
Bryn M. Reeves
146b2582b0 libdm: move initialisation of group_id in _aggregate_histogram()
Older compilers are not able to determine that although group_id
is only assigned in one branch of a conditional, it is never used
used when the other branch is taken:

  libdm-stats.c:3319: warning: "group_id" may be used uninitialized in this function

Avoid this by always initialising the variable when it is
declared.
2017-03-10 11:45:08 +00:00
Tony Asleson
97b6486b27 lvmdbustest.py: Correct debug & assert order
If we do the assert first we won't get to the print statement.
2017-03-09 16:39:47 -06:00
Tony Asleson
ee7946ed82 lvmdbustest.py: Correct call_lvm doc 2017-03-09 16:39:47 -06:00
Tony Asleson
957e283de8 lvmdbusd: Simplify add_no_notify for loop 2017-03-09 16:39:47 -06:00
Tony Asleson
075f8e658c lvmdbusd: Correct utils.add_no_notify doc 2017-03-09 16:39:47 -06:00
Tony Asleson
00143753ee lvmdbusd: Add debug message to lvm ID lookup 2017-03-09 16:39:47 -06:00
Tony Asleson
28754145d8 lvmdbustest.py: Add unit test for external PV create
Ensure a PV created outside of the dbus service is immediately found by
service user.
2017-03-09 16:39:47 -06:00
Tony Asleson
e06e4d9355 lvmdbustest.py: Add unit test for external LV create
Ensure a LV created outside of the dbus service is immediately found by
service user.
2017-03-09 16:39:47 -06:00
Tony Asleson
43d0fbeba2 lvmdbustest.py: Add unit test for external VG create
Ensure a VG created outside of the dbus service is immediately found by
service user.
2017-03-09 16:39:47 -06:00
Tony Asleson
92b7c329ee lvmdbustest.py: Remove un-used import time 2017-03-09 16:39:47 -06:00
Tony Asleson
0c0002d765 lvmdbusd: Correct src doc for Manager.UseLvmShell
It returns a boolean.
2017-03-09 16:39:47 -06:00
Tony Asleson
11cfc58976 lvmdbusd: Disable notify_dbus for service command use
Utilizing the --config option  we will utilize global/notify_dbus=0 so
that the service itself doesn't generate change events which it then needs to
process.
2017-03-09 16:39:47 -06:00
Tony Asleson
e53454d6de lvmdbusd: Use work queue for queries too
We need to place query operations in the queue to prevent the case where
a client knows of something before the service does.  For example if a
client creates a PV/VG/LV outside of the dbus API and then immediately
tries to lookup and use that resource in the lvm dbus service it should
be present.  By placing the queries in the work queue any previous
refresh operation will complete before we process the query.
2017-03-09 16:39:47 -06:00
Tony Asleson
470a1f1c50 lvmdbusd: Add FlightRecorderDump
Diagnostic method for dumping flight recorder to syslog.
2017-03-09 16:39:47 -06:00
Heinz Mauelshagen
f2d7a48418 lvconvert: add raid1 <-> raid4 conversion
In addition to the already supported conversion between 2-legged
raid1 and raid5, raid1 and raid4 can be also converted into each
other with 2 legs (raid4/5 are limited to map a 2-legged raid1).

This patch supports the missing raid4 conversion in the sequence
linear -> 2-legged raid1 -> raid4/5, then restripe to more than one
data stripes for performance and resilience reasons and optionally
convert to striped/raid0.

The other conversion sequence is also possible by converting N-way
striped/raid0 to raid4/5, then restripe to 2 legs followed by a
conversion to raid1 and optionally to linear (loosing all resilience).
2017-03-09 23:18:13 +01:00
Heinz Mauelshagen
d2aae8cff4 man: add more examples to lvmraid(7)
Add examples for reshaping number of stripes
and converting from raid6 to striped to raid10.

Remove trailing spaces.

Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
2017-03-09 23:18:13 +01:00
Bryn M. Reeves
1ba11aa7ee dmfilemapd: always set the program_id after listing regions
The filemap daemon takes its program_id from the regions it is
managing: use DM_STATS_ALL_PROGRAMS when retrieving an initial
listing and then obtain the correct program_id from the group
leader.
2017-03-09 21:20:27 +00:00
Bryn M. Reeves
0104fd6c66 libdm: don't nest FIEMAP and DMFILEMAPD ifdefs 2017-03-09 21:20:27 +00:00
Bryn M. Reeves
af7a11bc57 configure: make --enable-dmfilemapd require fiemap.h 2017-03-09 21:20:27 +00:00
Heinz Mauelshagen
66fff1d774 raid: add missing lv_merge_segments() call
On conversion from striped to raid0, data LVs are created
and all segments and their respective areas of the striped
LV are moved across to new segments allocated for the raid0
image LVs.  This can cause non-canonical segments to be added
to the image LVs.

Add a call to lv_merge_segments() once all segments have been
added to an image LV to compensate for that.  This avoids
unsafe table loads on activation.

Fix comments.
2017-03-09 22:18:34 +01:00
Heinz Mauelshagen
76f6951c3e dmeventd: (workaround) fix mirror DSO to work with lvmetad
Automatic dmeventd repair of mirrors with active lvmetad configured
(mirror_image_fault_policy = "allocate") fails because the lvscan
run before the repair in the mirror DSO does not update the
lvmetad cache properly thus "lvconvert --repair ..." fails.

Need to scan the mirror LV before and after the repair
to have proper cache content after the repair finished.
The cache can't be relied on or the repair will fail.

Resolves: rhbz1380521
2017-03-09 20:41:07 +01:00
Bryn M. Reeves
67ddc0c292 man: add FILE MAPPING section to dmstats.8.in
Add a section to explain file mapping, outside of the individual
command descriptions, and to describe the limitations of the
current update strategy.
2017-03-09 18:50:15 +00:00
Bryn M. Reeves
b5c8accdf2 man: add dmfilemapd options to dmstats.8.in
Add descriptions of --follow and --nomonitor, and the behaviour
of create and update_filemap when starting dmfilemapd.
2017-03-09 18:50:15 +00:00
Bryn M. Reeves
baa8a9be4a dmstats: start dmfilemapd when creating or updating file maps
Launch an instance of the filemap monitoring daemon when creating,
or updating, a file mapped group, unless the --nomonitor switch is
given.

Unless --foreground is given the daemon will detach from the
terminal and run in the background until it is signaled or the
daemon termination conditions are met.

The --follow={inode|path} switch is added to control the daemon
behaviour when files are moved, unlinked, or renamed while they
are being monitored.

The daemon runs with the same verbosity as the dmstats command
that starts it.
2017-03-09 18:50:15 +00:00
Bryn M. Reeves
044f92e466 man: add dmfilemapd.8 2017-03-09 18:50:15 +00:00
Bryn M. Reeves
8b78982297 daemons: add dmfilemapd
Add a daemon that can be launched to monitor a group of regions
corresponding to the extents of a file, and to update the regions as the
file's allocation changes.

The daemon is intended to be started from a library interface, but can
also be run from the command line:

  dmfilemapd <fd> <group_id> <path> <mode> [<foreground>[<log_level>]]

Where fd is a file descriptor open on the mapped file, group_id is the
group identifier of the mapped group and mode is either "inode" or
"path". E.g.:

  # dmfilemapd 3 0 vm.img inode 1 3 3<vm.img
  ...

If foreground is non-zero, the daemon will not fork to run in the
background. If verbose is non-zero, libdm and daemon log messages will
be printed.

It is possible for the group identifier to change when regions are
re-mapped: this occurs when the group leader is deleted (regroup=1 in
dm_stats_update_regions_from_fd()), and another region is created before
the daemon has a chance to recreate the leader region.

The operation is inherently racey since there is currently no way to
atomically move or resize a dm_stats region while retaining its
region_id.

Detect this condition and update the group_id value stored in the
filemap monitor.

A function is also provided in the the stats API to launch the filemap
monitoring daemon:

  int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
                              dm_filemapd_mode_t mode, unsigned foreground,
                              unsigned verbose);

This carries out the first fork and execs dmfilemapd with the arguments
specified.

A dm_filemapd_mode_t value is specified by the mode argument: either
DM_FILEMAPD_FOLLOW_INODE, or DM_FILEMAPD_FOLLOW_PATH. A helper function,
dm_filemapd_mode_from_string(), is provided to parse a string containing
a valid mode name into the appropriate dm_filemapd_mode_t value.
2017-03-09 18:50:15 +00:00
Bryn M. Reeves
c98868181f libdm: remove unnecessary backtrace in _stats_group_id_present()
It's not an error to call dm_stats_group_present() on a handle
that contains no regions.

This causes dmfilemap to log a false backtrace during shutdown
if all regions are removed from the corresponding device:

  exiting _filemap_monitor_get_events() with deleted=0, check=0
  waiting for FILEMAPD_WAIT
  dm message   (253:1) [ opencount flush ]  @stats_list dmstats [32768] (*1)
  <backtrace>
  Filemap group removed: exiting.

Change this to only emit a backtrace if the handle is NULL.
2017-03-09 17:53:15 +00:00
David Teigland
fab088cbc7 man lvmraid: remove fixmes, use consistent example name 2017-03-09 11:48:30 -06:00
David Teigland
716c345334 tests relative-sign-options: only skip thin part 2017-03-09 11:29:54 -06:00
David Teigland
43bcd7393c tests relative-sign-options.sh: skip without thin 2017-03-09 10:43:41 -06:00
David Teigland
aa31272223 lvresize: poolmetadatasize cannot use minus 2017-03-09 09:51:24 -06:00
Heinz Mauelshagen
6dfe1ce251 lvconvert: prompt when splitting off LV of a 2-legged raid1 LV
Splitting off an image LV of a 2-legged
raid1 LV causes loss of resilience.

Ask user to avoid uninformed loss of all resilience.

Don't ask for N > 2 legged raid1 LVs.

Adjust tests.
2017-03-09 13:59:47 +01:00
Heinz Mauelshagen
6b1b66c266 test: raid1 down convert to linear
Missed one test in last commit.
2017-03-09 13:21:21 +01:00
Heinz Mauelshagen
4b0ae266c2 test: raid1 down convert to linear
Add/adjust more tests for commit 7fbe6ef16b.
2017-03-09 13:16:08 +01:00
Heinz Mauelshagen
413164765f lvconvert: remove superfluous compile time conditonal code 2017-03-09 12:16:11 +01:00
Heinz Mauelshagen
3d1df10af3 test: raid1 down convert to linear / split and track tests
Add/adjust tests for commits d250aa7208 and 7fbe6ef16b.
2017-03-09 04:01:47 +01:00
Heinz Mauelshagen
d250aa7208 lvconvert: prompt when splitting off a tracked LV of a 2-legged raid1 LV
Splitting off an image LV of a 2-legged raid1 LV tracking changes
causes loosing partial resilience for any newly written data set.
Full resilience will be provided again after the split off image LV
got merged back in and the new data set got fully synchronized.
Reason being that the data is only stored on the remaining single
writable image during the split.

Ask user to avoid uninformed loss of such partial resilience.

Don't ask for N > 2 legged raid1 LVs.
2017-03-09 03:22:55 +01:00
Heinz Mauelshagen
7fbe6ef16b lvconvert: prompt when converting raid1 to linear
Ask user when converting raid1 to linear to avoid
uninformed loss of all resilience.
2017-03-09 02:39:49 +01:00
Heinz Mauelshagen
8daad11666 test: "lvconvert --repair" after vgreduce
Add test for commit 921b496fff.
2017-03-09 02:35:57 +01:00
Heinz Mauelshagen
90ed3d5e8c raid: fix function description 2017-03-09 02:16:03 +01:00
Heinz Mauelshagen
921b496fff lvconvert: fix --repair after vgreduce
In case N images fail (N <= parity chunks) _and_
a "vgreduce --removemissing --force VG" was applied
a following repair of the RaidLV fails:

  Unable to remove N images:  Only 0 devices given.
  Failed to remove the specified images from tb/r.
  Failed to replace faulty devices in tb/r.

Fix as of this commit results in correct repair:

  Faulty devices in tb/r successfully replaced.
2017-03-09 02:11:52 +01:00
Heinz Mauelshagen
00b8c2bebc test: Copyright 2017-03-09 00:10:55 +01:00
David Teigland
b4e78b26f5 help: fix missing required option
Fix for previous commit 4d0172ff15.
2017-03-08 15:00:27 -06:00
David Teigland
4d0172ff15 man/help: use order of required options from cmd def
Follow the same as written in command-lines.in
2017-03-08 14:51:08 -06:00