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

9625 Commits

Author SHA1 Message Date
Zdenek Kabelac
98414ca7dd vgchange: support clustered conversion for active lv
If we want to support conversion of VG to clustered type,
we currently need to relock active LV to get proper DLM lock.

So add extra loop after change of VG clustered attribute
to exlusively activate all active top level LVs.

When doing change -cy -> -cn  we should validate LVs are not
active on other cluster nodes - we could be sure about this only
when with local exclusive activation - for other types
we require user to deactivate volumes first.

As a workaround for this limitation there is always
locking_type = 0 which amongs other skip the detection
of active LVs.

FIXME:
 clvmd should handle looks for cluster locking type all the time.
2014-09-17 14:41:42 +02:00
Zdenek Kabelac
f90bc22ca5 locking: add locking_supports_remote_queries
Add function to detect whether locking could be used to
query for lock type so we could recognize exclusive
activation.
2014-09-17 14:36:38 +02:00
Jonathan Brassow
9d57aa9a0f cache-pool: Fix specification of cachemode when converting to cache-pool
Failure to copy the 'feature_flags' lvconvert_param to the matching
lv_segment field meant that when a user specified the cachemode argument,
the request was not honored.
2014-09-16 22:19:53 -05:00
Jonathan Brassow
b87a7683e2 clean-up: better macro usage
Use 'lv_is_mirror' instead of 'lv_is_mirrored && !lv_is_raid' - both
are the same as asking if the non-RAID mirror implementation is being
used.
2014-09-16 21:24:14 -05:00
Zdenek Kabelac
4a853361b0 vgchange: disable cluster convert for active LVs
While we could probably reacquire some type of lock when
going from non-clustered to clustered vg, we don't have any
single road back to drop the lock and keep LV active.

For now keep it safe and prohibit conversion when LV
is active in the VG.
2014-09-16 11:42:41 +02:00
Zdenek Kabelac
1ce21c19d5 va_list: properly pass va_list through functions
Code should not just pass va_list arg through the function
as args could be passed in many strange ways.
Use va_copy().

For details look in i.e.:

http://julipedia.meroh.net/2011/09/using-vacopy-to-safely-pass-ap.html
2014-09-16 11:42:40 +02:00
Alasdair G Kergon
b9c16b7506 devices: Detect rotational devices.
Add dev_is_rotational() for future use by allocation code.
2014-09-16 00:44:25 +01:00
Alasdair G Kergon
979be63f25 mirrors: Fix checks for mirror/raid/pvmove LVs.
Try to enforce consistent macro usage along these lines:

lv_is_mirror - mirror that uses the original dm-raid1 implementation
               (segment type "mirror")
lv_is_mirror_type - also includes internal mirror image and log LVs

lv_is_raid - raid volume that uses the new dm-raid implementation
             (segment type "raid")
lv_is_raid_type - also includes internal raid image / log / metadata LVs

lv_is_mirrored - LV is mirrored using either kernel implementation
                 (excludes non-mirror modes like raid5 etc.)

lv_is_pvmove - internal pvmove volume
2014-09-16 00:13:46 +01:00
Liuhua Wang
829e5a4037 cmirror: fix endian issues on s390
Cmirrord has endian bugs, which cause failure to lvcreate a mirrored lv
on s390.
- data_size is uint32, should not use xlate64 to convert, which will
  cause data_size 0 after xlate.
- request_type and data_size still used by local(v5_data_switch),
  should convert later.  If request_type xlate too early, it will
  cause request_type judge error; if data_size xlate too early, it
  will cause coredump in case DM_ULOG_CLEAR_REGION.
- when receiving package in clog_request_from_network. vp[0] will always
  be little endian.  We could use xlate64(vp[0]) == vp[0] to decide if
  the local node is little endian or not.

Signed-off-by: Lidong Zhong<lzhong@suse.com> & Liuhua Wang <lwang@suse.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2014-09-15 16:08:35 -05:00
Alasdair G Kergon
e9216eedfe cleanup: fix last commit 2014-09-15 22:04:14 +01:00
Alasdair G Kergon
2360ce3551 cleanup: Use lv_is_ macros.
Use lv_is_* macros throughout the code base, introducing
lv_is_pvmove, lv_is_locked, lv_is_converting and lv_is_merging.

lv_is_mirror_type no longer includes pvmove.
2014-09-15 21:33:53 +01:00
Zdenek Kabelac
10a448eb2f tests: update lv_no_exists
On successful exit path remove debug.log file.
2014-09-15 13:51:19 +02:00
Zdenek Kabelac
f435bef957 test: test there is no leak of LV on error path 2014-09-15 13:51:19 +02:00
Zdenek Kabelac
75a5de1462 thin: check for active lv
Before calling deactivate, check the lv is actually active,
as we may reach this 'bad' error path with pool_lv inactive.
2014-09-15 13:51:19 +02:00
Petr Rockai
ef6508e9a4 WHATS_NEW for filter-related changes 2014-09-13 17:34:13 +02:00
Peter Rajnoha
30e0c0d863 libdm: finish the comment 2014-09-12 15:35:57 +02:00
Peter Rajnoha
5895657b59 libdm: fix dm_is_dm_major to not issue error about missing /proc lines for dm module.
This is probably better approach than 3880ca5eca.

If dm module is not loaded during dm_is_dm_major call, there are no
lines for dm in /proc/devices, of course. Normally, dm_is_dm_major
is called to check existing devices, hence if module is not loaded,
we can expect there's no DM device present at the same time so we
can directly return 0 here (meaning the major number being inspected
is not dm device's one).

See also https://bugzilla.redhat.com/show_bug.cgi?id=1059711.
2014-09-12 15:28:51 +02:00
Peter Rajnoha
25ae9383bb revert: commit 3880ca5eca
There's a better solution to this...
2014-09-12 15:28:51 +02:00
Zdenek Kabelac
ae08a3a294 cleanup: skip unused assign
Reset of tmp_names is only needed in else{} path.
2014-09-12 13:51:31 +02:00
Zdenek Kabelac
07b3e6cd74 cleanup: avoid strlen() we know max size
Just use max NAME_LEN size buffer and copy the name.
2014-09-12 13:51:31 +02:00
Zdenek Kabelac
ab7977de7b cleanup: simplify _extract_image_components
Reorder test - first check for writable flag and then allocate.
2014-09-12 13:51:31 +02:00
Zdenek Kabelac
6898131091 cleanup: missing error message 2014-09-12 13:51:31 +02:00
Zdenek Kabelac
3e57143abd cleanup: better error messages 2014-09-12 13:51:30 +02:00
Zdenek Kabelac
08914ed7c1 raid: destroy allocation handle on error path
Don't leak ah memory pool on error path.
2014-09-12 13:51:30 +02:00
Zdenek Kabelac
76c3c94bd2 cleanup: update _alloc_image_component function
Return allocated volume directly instead of 1/0.
2014-09-12 13:51:30 +02:00
Zdenek Kabelac
126463ad1f cleanup: plain code reindent
Just simple reindent and brace changes.
2014-09-12 13:51:30 +02:00
Zdenek Kabelac
ad376e9e00 debug: add missing stack trace on error path 2014-09-12 13:51:29 +02:00
Zdenek Kabelac
c10c16cc35 raid: use _generate_raid_name
Use new function to get implicit name validation
(so we do not exit with internal error on metadata validation).
2014-09-12 13:51:29 +02:00
Zdenek Kabelac
2db0312455 raid: add function for name creation
Add name for construction and validation of raid subvolume
name with a given suffix.

TODO: check if reusable for mirrors as well.
2014-09-12 13:51:29 +02:00
Zdenek Kabelac
40b7b107b1 raid: check result of get_segtype_from_string
Error here is rather highly unpexpected for these types, but
stay consistent with rest of the code and don't use unchecked value.
2014-09-12 13:45:50 +02:00
Zdenek Kabelac
08bde75093 raid: add missing archive call
Before starting to update raid metadata, archive existing unmodified one.
2014-09-12 13:45:49 +02:00
Zdenek Kabelac
569184a3bb raid: add missing vg_revert
After failing vg_write() and suspend_lv() there was missing vg_revert() call.
2014-09-12 13:45:14 +02:00
Zdenek Kabelac
dd1fa0e808 raid: add missing backups
Add backup() calls that were missing after successful update
of metadata.
2014-09-12 13:42:57 +02:00
Zdenek Kabelac
15ba2afdc2 allocation: use vg memory pool
Looks like forgotten memory allocation related to VG used cmd mem pool.
2014-09-12 13:39:58 +02:00
Peter Rajnoha
3880ca5eca libdm: use dm-mod autoloading during dm_is_dm_major call if needed
For dm_is_dm_major to determine whether the major number given as
an argument belongs to a DM device, libdm code needs to know what
the actual DM major is to do the comparison.

It may happen that the dm-mod module is not loaded during this
call and so for the completness let's try our best before we start
giving various errors - we can still make use of dm-mod autoloading,
though only since kernels 2.6.36 where this feature was introduced.
2014-09-12 12:49:37 +02:00
Peter Rajnoha
f0cafc9281 conf: add allocation/physical_extent_size config option for default PE size of VGs.
Removes a need to use "vgcreate -s <desired PE size>" all the
time time just to override hardcoded default which is 4096KiB.
2014-09-12 10:09:21 +02:00
Peter Rajnoha
80ac8f37d6 filters: fix incorrect filter indexing in composite filter array
Caused by recent changes - a7be3b12df.
If global filter was not defined, then part of the code
creating composite filter (the cmd->lvmetad_filter) incorrectly
increased index value even if this global filter was not created
as part of the composite filter. This caused a gap with "NULL"
value in the composite filter array which ended up with the rest
of the filters after the gap to be ignored and also it caused a mem
leak when destroying the composite filter.
2014-09-11 09:30:03 +02:00
Zdenek Kabelac
4748f4a9e4 tests: test for rename of snapshot 2014-09-10 22:59:13 +01:00
Petr Rockai
671d0ea1b1 lvmetad: Differentiate between filtered and truly missing devices.
We used to print an error message whenever we tried to deal with devices that
lvmetad knew about but were rejected by a client-side filter. Instead, we now
check whether the device is actually absent or only filtered out and only print
a warning in the latter case.
2014-09-10 22:58:22 +01:00
Petr Rockai
5f9b30d178 test: Add a test for MD component detection in pvscan --cache. 2014-09-10 22:58:12 +01:00
Petr Rockai
a7be3b12df lvmetad: Re-organise filters to properly avoid scans of component devices.
If a PV label is exposed both through a composite device (MD for example) and
through its component devices, we always want the PV that lvmetad sees to be the
composite, since this is what all LVM commands (including activation) will then
use. If pvscan --cache is triggered for multiple clones of the same PV, the last
to finish wins. This patch basically re-arranges the filters so that
component-device filters are part of the global_filter chain, not of the
client-side filter chain. This has a subtle effect on filter evaluation order,
but should not alter visible semantics in the non-lvmetad case.
2014-09-10 22:58:02 +01:00
Petr Rockai
1f0c4c811d dev-cache: Filter wipe does not guarantee a full /dev scan.
The code in dev_iter_create assumes that if a filter can be wiped, doing so will
always trigger a call to _full_scan. This is not true for composite filters
though, since they can always be wiped in principle, but there is no way to know
that a component filter inside will exist that actually triggers the scan.
2014-09-10 22:57:49 +01:00
Zdenek Kabelac
47ff145e08 debug: turn message into debug
This message should be printed only for activation commands,
however since the handling of this flag is not correct
(rhbz 1140029) and will require further changes,
do now just a minor change and switch message into log_debug
(so it's not printed i.e. with every  'lvs -v')
2014-09-10 10:10:13 +02:00
Zdenek Kabelac
55aa3cc813 tests: test for rename of snapshot 2014-09-09 20:17:47 +02:00
Zdenek Kabelac
a86d9a3b30 lv_rename: actual fix for snapshot
By my rebasing mistake it's been eliminated from previous patch set.
2014-09-09 20:15:51 +02:00
Zdenek Kabelac
c710f02e01 lv_update_and_reload: replace code sequence
Use lv_update_and_reload() and lv_update_and_reload_origin()
to handle write/suspend/commit/resume sequence.

In few places this properly handle vg_revert() after suspend failure,
and also ensures there is metadata backup after successful vg_commit().
2014-09-09 19:20:09 +02:00
Zdenek Kabelac
e4e50863a2 lvconvert: use lv_update_and_reload
Use lib function.
2014-09-09 19:15:26 +02:00
Zdenek Kabelac
aee8611af5 lv_manip: remove vg_revert
vg_commit is supposed to have implicit revert handling.
(however as of now it needs fixes).
2014-09-09 19:15:26 +02:00
Zdenek Kabelac
413fc9d3e6 lv_rename: fix snapshot rename
Fix rename operation for snapshot (cow) LV.
Only the snapshot's origin has the lock and by mistake suspend
and resume has been called for the snapshot LV.
This further made volumes unusable in cluster.

So instead of suspend and resuming list of LVs,
we need to just suspend and resume origin.

As the sequence write/suspend/commit/resume
is widely used in lvm2 code base - move it to
new lv_update_and_reload function.
2014-09-09 19:15:24 +02:00
Zdenek Kabelac
319f67b1ab cleanup: add stacktrace for error path 2014-09-08 22:36:42 +02:00