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

13828 Commits

Author SHA1 Message Date
Zdenek Kabelac
375e4bb3da thin: getting default chunk_size from single place
Basically code moving operation to have a single place resolving
thin_pool_chunk_size_policy.

Supported are generic & performance profiles.

Function is now shared between thin manipulation code and configuration
_CFG logic to obtain defaults and handle correct reporting upward coding
stack.
2017-03-10 19:33:00 +01:00
Zdenek Kabelac
50441f2433 cache: properly translate DM_THIN_DISCARDS
DM status uses DM defines which need to be translated to LVM enum.
2017-03-10 19:33:00 +01:00
Zdenek Kabelac
f221ba97c9 lvcreate: avoid rejecting --metadataprofile
Likely user normaly have used 'shortcut' --profile option which
is (for lvcreate) decoded as metadataprofile.

However full option was rejected.
2017-03-10 19:33:00 +01:00
Zdenek Kabelac
fb38426d28 lvconvert: validate name before prompt
Before prompting make sure name fits.
2017-03-10 19:33:00 +01:00
Zdenek Kabelac
7ad57d55af lvconvert: indent and code simplification
Simple modifications to existing  _lvconvert_to_pool().
2017-03-10 19:33:00 +01:00
Heinz Mauelshagen
dd2881f277 raid: enhance lv_raid_convert() header relative to reshaping 2017-03-10 19:26:02 +01:00
Heinz Mauelshagen
2fcbe34fe8 lvcreate: fix "striped" limit
Fix regression limiting number of stripes to 8.
Raise back to 128 as before.

Resolves: rhbz1389546
2017-03-10 18:57:06 +01:00
David Teigland
43388f1220 commands: fix missing skip condition in coverity fixes
Fix for commit 5e6ea4b7
2017-03-10 11:50:00 -06:00
Bryn M. Reeves
a9341b18ef daemons: use DEFAULT_PROC_DIR in dmfilemapd
Include defaults.h and use it to obtain the default procfs mount
point in dmfilemapd.
2017-03-10 17:26:47 +00:00
Bryn M. Reeves
b17eb054cd daemons: cleanup dmeventd references from dmfilemapd/Makefile.in 2017-03-10 17:26:47 +00:00
David Teigland
5e6ea4b784 commands: coverity fixes 2017-03-10 10:54:42 -06:00
Bryn M. Reeves
8c6b8e90e3 libdm: use correct value for NR_FILEMAPD_ARGS
The argument count for the file mapping daemon needs to account
for the program's name in argv[0] to avoid indexing off the end
of the argument array.
2017-03-10 16:52:27 +00:00
Bryn M. Reeves
c713745314 dmsetup: always initialise 'dms' in _stats_update_file() 2017-03-10 16:44:08 +00:00
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