summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* dev: detect mismatch between devices used and devices assumed for an LVdev-prajnoha-check-devices-used-and-assumed-for-lvsPeter Rajnoha2016-03-215-2/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible for an LVM LV to use a device during activation which then differs from device which LVM assumes based on metadata later on. For example, such device mismatch can occur if LVM doesn't have complete view of devices during activation or if filters are misbehaving or they're incorrectly set during activation. This patch adds code that can detect this mismatch by creating VG UUID and LV UUID index while scanning devices for device cache. The VG UUID index maps VG UUID to a device list where each device is a slave of an LVM LV for which we know the VG UUID (and similarly for LV UUID index). We can acquire VG and LV UUID by reading /sys/block/<dm_dev_name>/dm/uuid. So these indices represent the actual state of PV device use in the system by LVs and then we compare that to what LVM assumes based on metadata. For example: [0] fedora/~ # lsblk /dev/sdq /dev/sdr /dev/sds /dev/sdt NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdq 65:0 0 104M 0 disk |-vg-lvol0 253:2 0 200M 0 lvm `-mpath_dev1 253:3 0 104M 0 mpath sdr 65:16 0 104M 0 disk `-mpath_dev1 253:3 0 104M 0 mpath sds 65:32 0 104M 0 disk |-vg-lvol0 253:2 0 200M 0 lvm `-mpath_dev2 253:4 0 104M 0 mpath sdt 65:48 0 104M 0 disk `-mpath_dev2 253:4 0 104M 0 mpath In this case the vg-lvol0 is mapped onto sdq and sds becauset this is what was available and seen during activation. Then later on, sdr and sdt appeared and mpath devices were created out of sdq+sdr (mpath_dev1) and sds+sdt (mpath_dev2). Now, LVM assumes (correctly) that mpath_dev1 and mpath_dev2 are the PVs that should be used, not the mpath components (sdq/sdr, sds/sdt). [0] fedora/~ # pvs Found duplicate PV xSUix1GJ2SK82ACFuKzFLAQi8xMfFxnO: using /dev/mapper/mpath_dev1 not /dev/sdq Using duplicate PV /dev/mapper/mpath_dev1 from subsystem DM, replacing /dev/sdq Found duplicate PV MvHyMVabtSqr33AbkUrobq1LjP8oiTRm: using /dev/mapper/mpath_dev2 not /dev/sds Using duplicate PV /dev/mapper/mpath_dev2 from subsystem DM, ignoring /dev/sds WARNING: Device mismatch detected for vg/lvol0 which is accessing /dev/sdq, /dev/sds instead of /dev/mapper/mpath_dev1, /dev/mapper/mpath_dev2. PV VG Fmt Attr PSize PFree /dev/mapper/mpath_dev1 vg lvm2 a-- 100.00m 0 /dev/mapper/mpath_dev2 vg lvm2 a-- 100.00m 0
* device: add DEV_OPEN_FAILURE flagPeter Rajnoha2016-03-212-0/+4
| | | | | DEV_OPEN_FAILURE flag is set if the most recent "open" for a device failed and it's unset if any subsequent "open" succeeds.
* post-releaseAlasdair G Kergon2016-03-194-2/+8
|
* pre-releasev2_02_147Alasdair G Kergon2016-03-194-6/+3
|
* fsadm: use stat to get major:minor pair for non-standard /dev layoutsPeter Rajnoha2016-03-181-0/+7
| | | | | | | If we're using non-standard /dev layout so we can't get the dm-X name easily, we can't also look at the /sys/blocl/dm-X/dev to get the major:minor pair. Use "stat" in this case even though it triggers automounts (but there's no better way for now).
* fsadm: if available, use /proc/self/mountinfo to detect mounted volumePeter Rajnoha2016-03-182-4/+26
| | | | | | | | | | | The /proc/self/mountinfo is not bound to device names like /proc/mounts and it uses major:minor pairs instead. This fixes a situation in which a volume is mounted and then renamed later on - that makes /proc/mounts unreliable when detecting mounted volumes. See also https://bugzilla.redhat.com/show_bug.cgi?id=1196910.
* tests: stacked resize of thin on raidZdenek Kabelac2016-03-151-0/+35
|
* lvresize: fix stacked resizeZdenek Kabelac2016-03-152-15/+29
| | | | | | | | Commit b64703401da1f4bef60579a0b3766c087fcfe96a cause regression when handling stacked resize of pool metadata volume that would be a raid LV. Fix it by properly setting up size also for layer extension.
* tests: update lvconvert testZdenek Kabelac2016-03-141-1/+8
|
* tests: use own PID path for lvmetad checkingZdenek Kabelac2016-03-141-0/+1
| | | | Do not try to check PID of running lvmetad and use own path.
* lvconvert: fix error path testZdenek Kabelac2016-03-142-1/+2
| | | | | lvremove_single toollib function returns ECMD_FAILED or ECMD_PROCESSED.
* report: Use default vg_name field width too.Alasdair G Kergon2016-03-141-1/+1
|
* post-releaseAlasdair G Kergon2016-03-114-2/+8
|
* pre-releasev2_02_146Alasdair G Kergon2016-03-118-8/+130
|
* man: vgcreate sharedDavid Teigland2016-03-101-1/+2
|
* pvchange, pvresize: move exported VG checkDavid Teigland2016-03-102-3/+12
| | | | | | | | | | | | | Allow pvchange and pvresize to process exported VGs, and have them check for the exported state in their single function. Previously, the exported VG state would trigger a failure in vg_read()/ignore_vg() because the VGs are being read with READ_FOR_UPDATE. Because these commands read all VGs to search for the intended PVs, any exported VG would trigger a failure, even if it was not related to the intended PV.
* lvconvert: update --helpZdenek Kabelac2016-03-101-21/+21
| | | | | | | | | | | | | Use <> around user entered option parameters to make it visually different (just like we use Italic style in man page). TODO: In the future we should consistently provide such notation and possibly generate it automagically from some internal data structures. Preferably for man pages as well so we report actual set of supported options.
* tests: uncache with missing PVZdenek Kabelac2016-03-101-0/+121
| | | | | For now repair of cache with missing PVs via usage of --uncache. More will follow later.
* cleanup: display_lvnameZdenek Kabelac2016-03-101-23/+23
|
* cleanup: reoder linesZdenek Kabelac2016-03-101-10/+10
|
* cleanup: add backtraceZdenek Kabelac2016-03-101-10/+8
|
* gcc: cast time_t to 64bitZdenek Kabelac2016-03-101-1/+1
| | | | | Value is printed as uint64, so make sure right type is passed on all platforms. Fixes gcc warning on some 32bit platforms.
* topology: handle reported sizes smaller then sectorZdenek Kabelac2016-03-101-0/+6
| | | | | | | | | | Recent kernel (4.4) start to report values smaller then sector size (but in reporting size for SSD which support data zeroing on discard). For now log warning and assume it really means 1 sector. Addressing RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1313377
* man: drop extra bracesZdenek Kabelac2016-03-102-3/+4
| | | | doclifter tool noticed wrong brackets.
* man: updatesZdenek Kabelac2016-03-104-62/+61
| | | | | | | | | | | | | Continuing with lvconvert style updates. Minimize usage of '\:' as zero-width break space, since html renderers do not handle this groff sign well (some of them seems to even render ':' there). But since we do not want see badly rendered man pages itself, prefer the 'man visual' appearence over html page generation (man2html should be actually fixed). Start to use 'user input option' with Capitals more consistently.
* makefiles: avoid using vpath for rules filesZdenek Kabelac2016-03-102-2/+2
| | | | | | | | | | | | | Fixing vpath usage as it has been checking for existance of generated file also in the $(scrdir) e.g.: No need to remake target '10-dm.rules.in'; using VPATH name '...' If the $(srcdir) had been also $(builddir) and contained already generated rules file, it's been used instead generating new one. (See: http://make.mad-scientist.net/papers/how-not-to-use-vpath/)
* lvconvert: improve vg parameter parsingZdenek Kabelac2016-03-102-15/+11
| | | | | | | | | | | | | | | Commit abd9618dd8b77ca1974074ae76fa6a08f1a687d9 tried to improve parsing of vg name from logical path - but still missed couple corner cases. This patch further improves the logic and reuses validate_lvname_param() for parsing of lv_name. Also explicitly checks for LVM_VG_NAME in the right case. So now also properly parses cases like: 'lvconvert --repairt vg/' and will provide correct error message.
* cache: check for cache fail during flushZdenek Kabelac2016-03-105-13/+52
| | | | Just WARN if the cache can't be flushed because it's failed.
* lvconvert: uncache handles missing PVZdenek Kabelac2016-03-102-3/+46
| | | | | | | Allow to process with --uncache when some PVs are missing in VG. So it's now possible to --uncache cached LV if the cache-pool has missing PV.
* libdm: parse more info from cache statusZdenek Kabelac2016-03-103-1/+26
| | | | Parse Fail/Error/need_check/ro status info from cache.
* metadata: do not issue warning message about PV dev size being 0 when the ↵Peter Rajnoha2016-03-101-2/+8
| | | | | | | | | | | | | | | | | | | | | | device has gone just after VG read There's a window between doing VG read and checking PV device size against real device size. If the device is removed in this window, the dev cache still holds struct device and pv->dev still references that and that PV is not marked as missing. However, if we're trying to get size for such device, the open fails because that device doesn't exists anymore. We called existing pv_dev_size in _check_pv_dev_sizes fn. But pv_dev_size assigned a size of 0 if the dev_get_size it called failed (because the device is gone). So call the dev_get_size directly and check for the return code in _check_pv_dev_sizes and go further only if we really know the device size. This is to avoid confusing warning messages like: Device /dev/sdd1 has size of 0 sectors which is smaller than corresponding PV size of 31455207 sectors. Was device resized? One or more devices used as PVs in VG helter_skelter have changed sizes.
* remove unused defineDavid Teigland2016-03-091-2/+0
|
* test: Remove work-in-progress code from dbustestMarian Csontos2016-03-091-35/+0
| | | | (cherry picked from commit 3189d4d50492f5b78cf3920a7f499fd1020983c6)
* spec: Fix gobject dependencyMarian Csontos2016-03-091-1/+1
| | | | | | Use python3-gobject-base instead of python3-gobject requiring xorg (cherry picked from commit d929d82116759f53484e662b967165ef4fe4257c)
* test: skip unrelated tests while testing lvmpolldOndrej Kozina2016-03-0910-0/+15
|
* test: fix inverted conditionOndrej Kozina2016-03-091-1/+1
|
* test: Add prepare_lvmdbusdMarian Csontos2016-03-092-1/+51
| | | | | - Check for running lvmdbusd at start - Add teardown for lvmdbusd
* spec: Add missing dependency for dbusdMarian Csontos2016-03-091-0/+1
| | | | (cherry picked from commit 7435de21492f6b37ac7664d1f27b4a8dcc4d0dd4)
* test: Comment out incorrect lockd setupMarian Csontos2016-03-092-5/+6
|
* test: Move udev-lvmlockd-test to check_systemMarian Csontos2016-03-091-2/+2
|
* test: Update kernels to skip thin-flags withMarian Csontos2016-03-091-0/+2
| | | | See ed5e5c38b5ac4b7c8cb7e809d9d35c72f087e29e
* lvmdbus: Fix deprecated warnings for GObject useTony Asleson2016-03-082-6/+5
| | | | | | | While running on F24 a number of warnings were being emitted from using the deprecated GObject instead of GLib. Tested on python 3.4 and 3.5. Signed-off-by: Tony Asleson <tasleson@redhat.com>
* lvmdbus: Fix exception during exception handlingTony Asleson2016-03-081-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 3.5 in F24 was throwing the following exception: Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/lvmdbusd/main.py", line 73, in process_request req.run_cmd() File "/usr/lib/python3.5/site-packages/lvmdbusd/request.py", line 73, in run_cmd self.register_error(-1, st) File "/usr/lib/python3.5/site-packages/lvmdbusd/request.py", line 123, in register_error self._reg_ending(None, error_rc, error) File "/usr/lib/python3.5/site-packages/lvmdbusd/request.py", line 115, in _reg_ending self.cb_error(self._rc_error) File "/usr/lib64/python3.5/site-packages/dbus/service.py", line 669, in <lambda> keywords[error_callback] = lambda exception: _method_reply_error(connection, message, exception) File "/usr/lib64/python3.5/site-packages/dbus/service.py", line 293, in _method_reply_error exception)) File "/usr/lib64/python3.5/traceback.py", line 136, in format_exception_only return list(TracebackException(etype, value, None).format_exception_only()) File "/usr/lib64/python3.5/traceback.py", line 442, in __init__ if (exc_value and exc_value.__cause__ is not None AttributeError: 'str' object has no attribute '__cause__' This was caused because we were calling the dbus error callback with a string instead of an actual exception. On python 3.4 this was apparently OK, but not with 3.5. Corrected to pass the exception to error callback. Change tested on both python 3.4 and 3.5. Reported-by: Vratislav Podzimek <vpodzime@redhat.com> Signed-off-by: Tony Asleson <tasleson@redhat.com>
* report: Tidy some field names, widths and headings.Alasdair G Kergon2016-03-084-127/+119
| | | | | | | | | | | | | | Specifying an output width of 0 now leads to a default minimum width taken from the width of the column heading. (Most fields should use this.) Components of field names are generally separated by underscores (which are optional at run-time). (Dropped 3 duplicate fields now covered by this rule.) Each field heading must be unique and generally doesn't have spaces between words (which get capitalised) unless they are already short and the fields are normally longer or clarity demands it.
* toollib: always process in use pvsDavid Teigland2016-03-071-6/+0
| | | | | | | | | | | | With the recent conversion of pvcreate/pvremove to the common toollib processing function, skipping in-use PVs in _process_pvs_in_vg prevented them from being protected as intended by the in-use flag. The processing code for pvcreate/pvremove checks for the in-use state itself and prevents using an in-use PV. If a PV is skipped, it looks like an unused device and is not protected from being used in pvcreate/pvremove.
* vgscan: add --notifydbus to send a notificationDavid Teigland2016-03-077-1/+36
| | | | | | | | | This command option can be used to trigger a D-Bus notification independent of the usual notifications that are sent from other commands as an effect of changes to PV/VG/LV state. If lvm is not built with dbus notification support or if notify_dbus is disabled in the config, this command will exit with an error.
* dbus: add notification from commandsDavid Teigland2016-03-0717-1/+187
| | | | | | | When a command modifies a PV or VG, or changes the activation state of an LV, it will send a dbus notification when the command is finished. This can be enabled/disabled with a config setting.
* raid_manip: allow for raid leg to be replaced when not both data and ↵Heinz Mauelshagen2016-03-071-1/+1
| | | | | | metadata image are on pvs resolves rhbz#1130329
* coverity: fix possible resource leak in _print_historical_lv functionPeter Rajnoha2016-03-072-6/+7
| | | | | | | | | | | | | | | | | The code in _print_historical_lv function works with temporary "descendants_buffer" that is allocated and freed within this function. When printing text out, we used "outf" macro which called "out_text" fn and it checked return value and if failed, the macro called "return_0" automatically. But since we use the temporary buffer, if any of the out_text calls fails, we need to deallocate this buffer properly - that's the "goto_out", otherwise we'll be leaking memory. So add new "outfgo" helper macro which does the same as "outf", but it calls "goto_out" instead of "return_0" so we can jump to a cleanup hook at the end.
* post-releaseAlasdair G Kergon2016-03-044-2/+8
|