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

13195 Commits

Author SHA1 Message Date
Tony Asleson
be06fa695e lvmdbustest.py: Skip test_job_handling_timer on loopback
This test never passes on loop back, so we will skip unless the
pv devices are real devices which contain `/dev/sd`.

We always fail because we need lvm to run slow to get a timer to
pop, and loopback are too fast.
2016-10-10 16:31:00 -05:00
Tony Asleson
3e45285b40 lvmdbustest.py: Denote failure if set_execution fails 2016-10-10 16:31:00 -05:00
Tony Asleson
0c51f369a4 lvmdbustest.py: Print to stderr
It's easier to follow if we print to stderr, so that our print messages
are in the lvm error log in the correct position to other printed
messages.
2016-10-10 16:31:00 -05:00
Tony Asleson
cb4e26dcb3 lvmdbustest.py: Ensure we exit non-zero on fail
If you run multiple runs of unittest.main, unless you don't pass exit=true
the test case always ends with a 0 exit code.  Add ability to store the
result of each invocation of the test and exit with a non-zero exit code
if anyone of them fail.
2016-10-10 16:31:00 -05:00
Tony Asleson
9f0195ec1e lvmdbusd: Ensure tmp dir gets cleaned up
Regardless of the outcome of starting up the lvm shell process, lets
ensure we clean up the temp directory and pipe.
2016-10-10 16:31:00 -05:00
Tony Asleson
2e941beb44 lvmdbusd: Ensure lvm shell still exists 2016-10-10 16:31:00 -05:00
Heinz Mauelshagen
088b3d036a lvconvert: certain repair of cache raid volumes fails "Cannot convert internal LV"
In case a RAID orig LV is being cached and fails, repair is impossible because
"lvconvert --repair" gets rejected.

Fix by allowing repair on cache orig RAID LVs and
"lvconvert --replace/--mirrors/--type {raid*|mirror|striped|linear}" as well.

Allow the same lvconvert actions on any cache pool and metadata RAID SubLVs.

Resolves: rhbz1380532
2016-10-10 17:31:29 +02:00
Tony Asleson
a8bb8dfb08 lvmdbusd: Add LvCommon.DataPercent 2016-10-05 15:55:41 -05:00
Tony Asleson
d54ffcfcd1 lvmdbusd: Add LvCommon.MovePv
Needed for feature parity for lvm2app.
2016-10-05 15:28:42 -05:00
Tony Asleson
a3f24aaf5c lvmdbusd: Add properties to LvCommon
The following LvCommon properties were added so that the API
would have the same functionality as lvm2app has.

LvCommon.MetaDataSizeBytes
LvCommon.Attr
LvCommon.MetaDataPercent
LvCommon.CopyPercent
LvCommon.SnapPercent
LvCommon.SyncPercent
2016-10-05 13:59:38 -05:00
David Teigland
bf5d0a2651 toollib: clean up coverity issue
in processing duplicate pvs.
2016-10-04 16:25:32 -05:00
Alasdair G Kergon
c900cf7ed4 Revert "cleanup: simplier assign of cmd vars"
This reverts commit cea441f4d1.

cmd->default_values is configurable and this code should not make
any assumptions about values it holds.
2016-10-03 18:14:17 +01:00
Zdenek Kabelac
9e33781d95 tests: proper wait usage
Fix missing wait so we have paired waiting.
Also 'wait' for precise PID to get 'exit' code.

Test for 'error' replacing only with newer snapshot targets.
The old one will wait for resume.

Note: 'wait -n' is not always available so can't be used..
2016-10-03 17:49:56 +02:00
Zdenek Kabelac
43662fa081 cleanup :drop unneeded header file
Not needed  (Coverity).
2016-10-03 17:49:56 +02:00
Zdenek Kabelac
77ffd39dfb cleanup: drop test for NULL
Since lp->segtype has been already checked for not-being NULL,
drop this test so Coverity is not later confused it 'can be a NULL'.
2016-10-03 17:49:56 +02:00
Zdenek Kabelac
9fe4f2337b cleanup: drop assign before use
Drop unneeded assigns singe vars are set later in code before
their first use (Coverity).
2016-10-03 17:49:55 +02:00
Zdenek Kabelac
cea441f4d1 cleanup: simplier assign of cmd vars
Directly assign queried args as they provide matching values for
a setting.
2016-10-03 17:49:55 +02:00
Zdenek Kabelac
00f883a4aa dmeventd: pthread_sigmask in single function
Integrate back _unblock_sigalrm() and check for error code of
pthread_sigmask() function so we do not use uninitialized
sigmask_t on error path (Coverity).
2016-10-03 17:47:28 +02:00
Zdenek Kabelac
d70f112762 libdm: check for mem when _canonicalize_field_ids
Add missing check for dm_pool_strdup() call (Coverity).
2016-10-03 17:46:26 +02:00
Zdenek Kabelac
ee04f1fcfd raid: dmeventd plugin use 64bit arithmetic
Coverity suggested to used 64bit unsigned ints instead of signed 32b int.
Assuming there is no user of >31legs raid array.
2016-10-03 17:44:25 +02:00
Bryn M. Reeves
e95a252974 libdm: convert FIEMAP buffer allocation from stack to dm_zalloc 2016-10-03 15:14:33 +01:00
David Teigland
49a1c4d4b0 lvmlockd: fix segfault in error path
The log_debug statement was ignoring the NULL vg error case.
2016-09-28 13:29:55 -05:00
Tony Asleson
bd96036835 lvmdbusd: Use 'pv_missing' column instead of '[unknown]'
Previously using '[unknown]' for PV device path comparison which
is incorrect as it's not always true.
2016-09-28 12:07:48 -05:00
Tony Asleson
be5eb995d3 lvmdbusd: Remove extraneous parameter
Remove 'gen_new' parameter as it's not needed, correct documentation.
2016-09-28 12:05:44 -05:00
Tony Asleson
a93616cf66 lvmdbusd: Add diagnostic validate for look ups
Make sure that the lookup tables don't have extranoues stuff in
them.
2016-09-27 13:28:54 -05:00
Tony Asleson
d906fd5201 lvmdbustest.py: Make sure to test for hidden lookups
Test both vgname/[hidden] and vgname/hidden forms
2016-09-27 13:28:54 -05:00
Tony Asleson
063265eacd lvmdbusd: Allow PV device names to be '[unknown]'
When a PV device is missing lvm will return '[unknown]' for the device
path.  The object manager keeps a hash table lookup for uuid and for PV's
device name.  When we had multiple PVs with the same device path we
we only had 1 key in the table for the lvm id (device path).  This caused
a problem when the PV device transitioned from '[unknown]' to known as any
subsequent transitions would cause an exception:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/lvmdbusd/request.py", line 66, in run_cmd
    result = self.method(*self.arguments)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/manager.py", line 205, in _pv_scan
    cfg.load()
  File "/usr/lib/python3.5/site-packages/lvmdbusd/fetch.py", line 24, in load
    cache_refresh=False)[1]
  File "/usr/lib/python3.5/site-packages/lvmdbusd/pv.py", line 48, in load_pvs
    emit_signal, cache_refresh)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/loader.py", line 80, in common
    cfg.om.remove_object(cfg.om.get_object_by_path(k), True)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/objectmanager.py", line 153, in remove_object
    self._lookup_remove(path)
  File "/usr/lib/python3.5/site-packages/lvmdbusd/objectmanager.py", line 97, in _lookup_remove
    del self._id_to_object_path[lvm_id]
KeyError: '[unknown]'

when trying to delete a key that wasn't present.  In this case we don't add a
lookup key for the device path and the PV can only be located by UUID.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1379357
2016-09-27 13:28:54 -05:00
Tony Asleson
a882eb2b3b lvmdbusd: Clean up objectmanager.get_object_path_by_uuid_lvm_id
This method grew crufty with a number of stuble bugs.  Refactor and
simplify.
2016-09-27 13:28:54 -05:00
Tony Asleson
ec076b1df2 lvmdbustest.py: Make env variable work 2016-09-27 13:28:45 -05:00
Alasdair G Kergon
1bc546269a lvconvert: Disable thin pool raid conversion while active.
Works if the pool is inactive.

Activation code doesn't notice a new raid dependency in on-disk metadata
when a thin LV is already active.

https://bugzilla.redhat.com/1365286
2016-09-27 18:22:54 +01:00
Bryn M. Reeves
56c90ffa5e libdm: fix dm_stats_delete_region() backwards compat
The dm_stats_delete_region() call removes a region from the bound
device, and, if the region is grouped, from the group leader
group descriptor stored in aux_data.

To do this requires a listed handle: previous versions of the
library do not since no dependencies exist between regions without
grouping.

This leads to strange behaviour when a command built against an old
version of the library is used with one supporting groups. Deleting
a region with dmstats succeeds, but logs errors:

  # dmstats list
  Name             RgID RgSta RgSiz #Areas ArSize ProgID
  vg_hex-root         0     0 1.00g      1  1.00g dmstats
  vg_hex-root         1 1.00g 1.00g      1  1.00g dmstats
  vg_hex-root         2 2.00g 1.00g      1  1.00g dmstats
  # dmstats delete --regionid 2 vg_hex/root
  Region ID 2 does not exist
  Could not delete statistics region.
  Command failed
  # dmstats list
  Name             RgID RgSta RgSiz #Areas ArSize ProgID
  vg_hex-root         0     0 1.00g      1  1.00g dmstats
  vg_hex-root         1 1.00g 1.00g      1  1.00g dmstats

This happens because the call to dm_stats_delete_region() is inside
a dm_stats_walk_*() iterator: upon entry to the call, the iterator
is at its end conditions and about to terminate. Due to the call to
dm_stats_list() inside the function, it returns with an iterator at
the beginning of a walk and performs a further iteration before
exiting. This final loop makes a further attempt to delete the
(already deleted) region, leading to the confusing error messages.
2016-09-27 17:58:05 +01:00
Bryn M. Reeves
6ec8854fdb libdm: fix stats walk compatibility with older dmsetup
The current dmsetup.c handles DR_STATS and DR_STATS_META reports
separately in _display_info_cols(), meaning that the stats walk
functions are never called for these report types.

Versions before v2.02.159 have a loop using dm_stats_walk_do() and
dm_stats_walk_while(), that executes once for non-stats reports,
and once per region, or area, for DR_STATS/DR_STATS_META reports.

This older behaviour relies on the documented behaviour that the
walk functions will accept a NULL pointer as the struct dm_stats*
argument.

This was broken by commit f1f2df7b: the NULL test on dms and
dms->regions were incorrectly moved from the dm_stats_walk_end()
wrapper to the internal '_stats_walk_end()' helper.

Since the pointer is dereferenced in between these points, using
an older dmsetup with current libdm results in a segfault when
running a non-stats report:

  # dmsetup info -c vg00/lvol0
  Segmentation fault (core dumped)

Restore the NULL checks to the wrapper function as intended.
2016-09-27 14:46:00 +01:00
Peter Rajnoha
0a480c5c52 systemd: disable service start rate limiting for lvm2-pvscan@.service
We shouldn't be losing pvscans just because of the fact that the
underlying device (PV) appears and disappears quickly in the system,
otherwise lvmetad may not see the device if it appears again (or it may
still keep the device in cache even it's already gone).
2016-09-27 10:48:01 +02:00
Alasdair G Kergon
397c246fe0 post-release 2016-09-26 14:29:35 +01:00
Alasdair G Kergon
5233a3468c pre-release 2016-09-26 14:20:08 +01:00
Zdenek Kabelac
f93cddeafd man: fix dmsetup stats
Fix typo  STATS -> STATUS.
2016-09-26 12:38:32 +02:00
Timur Bakeyev
70be57c8da systemd: fix extra space in unit generated by lvm2-activation-generator 2016-09-26 09:54:19 +02:00
Peter Rajnoha
b5e093624d toolcontext: read all configuration sources when checking config values in lvm2-activation-generator through lighweight toolcontext handler
We added lightweight toolcontext handle to avoid useless initialization
of some parts of the context and also to avoid problems when using the
handle very soon at system boot, like in lvm2-activation-generator
through lvm2app interface. However, we missed reading all the other
config sources like lvmlocal.conf as well as any tag config - we need to
read these too to get the final config value which may be overriden in
any of these additional config sources.

Currently, we use this lightweight toolcontext handle to read
global/use_lvmetad and global/use_lvmpolld config values in
lvm2-activation-generator using lvm2app interface (lvm_config_find_bool
lvm2app function).
2016-09-23 14:57:44 +02:00
Peter Rajnoha
dbcfd59714 make: also clean up lvmdump.sh with substitutions - there's original lvmdump.sh.in 2016-09-23 12:48:52 +02:00
Heinz Mauelshagen
f2efd04052 tests: fix raid rebuild tests to work with older target versions
Pre 1.9 dm-raid targets status output was racy, which caused
the device status chars to be unreliable _during_ synchronization.
This shows paritcularly with tiny test devices used.

Enhance lvchange-rebuild-raid.sh to not check status
chars _during_ synchronization. Just check afterwards.
2016-09-22 23:35:37 +02:00
Zdenek Kabelac
38a6a39daa tests: raid repair needs devices in-sync
Though I'm not quite sure why we push this limit on user,
current --repair logic requires user to wait outside of command.

TODO: I'm not quite sure this repair logic is 'the most wanted'.
2016-09-22 15:46:18 +02:00
Zdenek Kabelac
eb6b2a11e3 tests: check for TRIM support
passdown can really work only on discardable device.
Skip 'status' test when PV does no support discard.
2016-09-22 15:37:52 +02:00
Peter Rajnoha
f1cad4c710 config: use config_tree_from_string_without_dup_node_check throughout code to construct metadata trees 2016-09-21 18:18:15 +02:00
Peter Rajnoha
045772aa30 config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed 2016-09-21 18:18:15 +02:00
Peter Rajnoha
e40fbd08c8 config: parse config tree without dup node checking if it's metadata tree 2016-09-21 18:16:05 +02:00
Peter Rajnoha
7563e69cf1 libdm: add dm_config_parse_without_dup_node_check
Introduce function for config parsing tree without checking
for duplicate nodes.
2016-09-21 18:15:18 +02:00
Peter Rajnoha
094488ffab cleanup: remove unused variables 2016-09-21 15:53:50 +02:00
Peter Rajnoha
926a565781 coverity: dmsetup: fix possible use of uninitialized value 2016-09-21 15:52:23 +02:00
Bryn M. Reeves
7ea5758c91 dmsetup: ensure --filemap histogram bounds are freed
Make sure that the temporary dm_histogram used for the bounds
argument is freed in the case that the user provided a --bounds
argument on the command line.
2016-09-21 10:09:20 +01:00
Heinz Mauelshagen
5d455b28fc lvconvert: fix (automatic) raid repair regression
The dm-raid target now rejects device rebuild requests during ongoing
resynchronization thus causing 'lvconvert --repair ...' to fail with
a kernel error message. This regresses with respect to failing automatic
repair via the dmeventd RAID plugin in case raid_fault_policy="allocate"
is configured in lvm.conf as well.

Previously allowing such repair request required cancelling the
resynchronization of any still accessible DataLVs, hence reasoning
potential data loss.

Patch allows the resynchronization of still accessible DataLVs to
finish up by rejecting any 'lvconvert --repair ...'.

It enhances the dmeventd RAID plugin to be able to automatically repair
by postponing the repair after synchronization ended.

More tests are added to lvconvert-rebuild-raid.sh to cover single
and multiple DataLV failure cases for the different RAID levels.

- resolves: rhbz1371717
2016-09-21 00:39:29 +02:00