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

13209 Commits

Author SHA1 Message Date
Heinz Mauelshagen
8859d4508a lvconvert: fix RAID SubLV --splitmirror regression
Commit 088b3d036a allowed repair on cache origin RAID LVs
and restricted lvconvert actions on RAID SubLVs to change number of mirrors, repair,
replace and type changes in order to avoid unsuitable coversions on them.

This introduced a regression prohibiting --splitmirrors on any RAID SubLVs
(e.g. of cache or thin LVs; lvconvert-{cache,thin}-raid.sh tests failing).

Fix allows split mirrors again.

Fix some indenting whilst on it.
2016-10-12 00:24:57 +02:00
Tony Asleson
e57fd9d963 lvmdbustest.py: ws fixes 2016-10-11 13:16:57 -05:00
Tony Asleson
9c56902365 lvmdbustest.py: Add $PREFIX support
Use the env variable PREFIX for vg & lv names
2016-10-11 13:16:57 -05:00
Tony Asleson
595af62ebd lvmdbustest.py: Use more compatible syntax 2016-10-11 13:16:57 -05:00
Tony Asleson
4fab833920 lvmdbusd: Remove log ouput when ec=0 & stderr != 0 bytes
lvm likes to log to stderr virtually all the time, this isn't
helpful.
2016-10-11 13:16:57 -05:00
Tony Asleson
2830f72288 lvmdbusd: Disable lvm abort on too much log output
The commit:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=34c55d98eefd88f85476c0f62f0649c706bde6f0

introduced an abort if lvm logs too much.  In the case of utilizing
lvm shell this is a pretty normal occurance, so we will disable
when we use lvm shell.
2016-10-11 13:16:57 -05:00
Zdenek Kabelac
fe437a6e7d tests: notify dbus only for dbus test 2016-10-11 13:37:44 +02:00
Zdenek Kabelac
8f30069160 cleanup: indent 2016-10-11 13:37:43 +02:00
Zdenek Kabelac
6f576483a8 cleanup: lvconvert drop unused variable 2016-10-11 13:37:43 +02:00
Zdenek Kabelac
c8b6c13015 cleanup: use already set values
When we have already decoded arg_is_set into a local var
or already set  segment type - already use these
values instead of repeating calls and string checks.
2016-10-11 13:37:43 +02:00
Zdenek Kabelac
f4ae43934a cleanup: reorder code
Move some arg test into a single place with sort of alphabetic order
when possible to make reading easier.
2016-10-11 13:37:43 +02:00
Zdenek Kabelac
706d3ddf90 lvconvert: use _read_conversion_type
Code reodering and using same pattern for reading and validating arg
(--type in this case).
2016-10-11 13:36:51 +02:00
Zdenek Kabelac
1186cf2ad4 lvconvert: fix error value
Seems some error path where not converted to 'new' ECMD return value.
Fix them to always 'goto out'.
Also drop unneeded   'ret = 0' when ret already is 0.
2016-10-11 13:36:29 +02:00
Tony Asleson
20e74313cd lvmdbustest.py: Add profile and path for lvm binary 2016-10-10 16:33:42 -05:00
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