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

459 Commits

Author SHA1 Message Date
Zdenek Kabelac
e04a0184cb cleanup: use lv_is_partial
Check for PARTIAL_LV flag in standard way.
2016-03-03 10:17:03 +01:00
Zdenek Kabelac
5c29b54d4d cleanup: poll better check for internal errors 2016-02-25 23:30:25 +01:00
Zdenek Kabelac
cdcf4cc794 lvconvert: use lp->repair
Set variable for repair testing.
2016-02-25 23:30:25 +01:00
Zdenek Kabelac
ec8a75a321 lvconvert: use more display_lvname 2016-02-25 23:30:25 +01:00
Zdenek Kabelac
86a651854f lvconvert: simplify handler processing
Easier code for handler init.
Drop release of pool mem - not needed, as command pool get dropped just
later.
2016-02-25 23:30:25 +01:00
Zdenek Kabelac
abd9618dd8 lvconvert: fix vg parameter
Since we want to read env LVM_VG_NAME vg names,
we cannot just check LV names which do contain '/'.

So before the patch commands like:

> lvconvert --repair vg

Before:

Please provide a valid volume group name

After:
Path required for Logical Volume "vg".
Please provide a valid volume group name

> LVM_VG_NAME=vg lvconvert --repair vg

Before:
Please provide a valid volume group name

After:
Can't find LV vg in VG vg
2016-02-25 23:30:24 +01:00
Zdenek Kabelac
dbc71dc05e gcc: cleanup some sign warnings
When comparing unsigned with int, the comparision is made
as 'unsigned' type, so make it rather explicit which type
is being compared.
2016-02-23 12:25:25 +01:00
Zdenek Kabelac
740d27f9fe cleanup: rename usepolicies
Switch to ARG name without '_' in the middle (like all others args).
2016-02-11 18:35:06 +01:00
M.H. Tsai
e32e793c43 lvconvert: enable spare creation during conversion
Let user control pool metadata spare creation after repair as
the VG might not have enough free space.
2016-02-11 18:30:40 +01:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
David Teigland
48f270970f lvconvert: disallow test mode in shared VG
until test mode can be checked in all the necessary
locations related to lvmlockd to prevent making
actual changes.
2016-01-18 16:53:14 -06:00
Alasdair G Kergon
c24d913c47 lvconvert: Reinstate raid merge after splitmirror.
After commit 46c8d6bb8a
(lvconvert: Improve message for raid without -m)
2015-12-03 17:40:10 +00:00
Alasdair G Kergon
aec58c8620 lvconvert: Reinstate mirror to raid conversions.
Reinstate conversions from mirror to raid stopped
by commit 46c8d6bb8a
(lvconvert: Improve message for raid without -m).
2015-12-03 14:40:14 +00:00
Alasdair G Kergon
46c8d6bb8a lvconvert: Improve message for raid without -m. 2015-11-30 22:36:05 +00:00
Zdenek Kabelac
795616a87b cache: lvconvert repairs only thin pools
Avoid internal error message where thin pool repair code tries to
fix cache pool - was catched later in code stack, so rather
catch this early and make the repair function exlusive
to thin pools.

So far we have no code for repairing cache pools
(other then the automatic during activation/deactivation).
2015-11-19 14:40:24 +01:00
Zdenek Kabelac
d1608345df cache: enable raid conversion for _cdata and _cmeta
Since thin-pool supports convertion of data and metadata LV,
enable the same for cache data and metadata LV.
2015-11-19 14:38:36 +01:00
Zdenek Kabelac
8ebf2b0611 debug: lvconvert add missing display_lvname
Add missing display_lvname in _lvconvert_merge_thin_snapshot().

Also when we detect missing origin, report Internal error,
which would likely be the primary fault here
(and avoid dereft of NULL origin as noticed by Coverity).
2015-11-16 01:16:11 +01:00
Zdenek Kabelac
6dadebb1e4 cleanup: better error message
Use display_lvname.
2015-11-13 11:17:06 +01:00
Zdenek Kabelac
5c48ef993b cleanup: use NAME_LEN buffer instead of alloca
Drop alloca and use NAME_LEN size to get implicit check
for max len of LV name.
2015-11-09 10:22:51 +01:00
Zdenek Kabelac
18fd0bd20c lvconvert: add extra check for existance of pointer
Coverity here is not fully-in-picture - but please it
with validation of pointer which currently cannot be null,
since we always return at least empty string.
2015-11-09 10:19:19 +01:00
Zdenek Kabelac
175119fdcd cleanup: remove thin low_water_mark from metadata
This option could never have been printed in lvm2 metadata, so it could
be safely removed as it could have been set only as 0.

These configurable setting is supported via metadata profile.
2015-10-29 12:14:20 +01:00
Alasdair G Kergon
214e2cddf6 segtypes: Use SEG_TYPE_NAME_ string constants. 2015-09-22 19:04:12 +01:00
Zdenek Kabelac
fda853b573 thin: improve swapping of identifiers
Since we may want to swap names when LVs are complex types, we cannot
avoid doing full renames on both LV stacks.
Temporarily use 'pvmove_tmeta' as unused name to prevent validation troubles.
2015-09-11 21:51:11 +02:00
Zdenek Kabelac
280a6275ce thin: lvconvert use passed PVs for _pmspare
When PVs are given on 'lvconvert' respect them when converting
volume to thin-pool and allocating i.e. _pmspare.
2015-09-11 21:48:19 +02:00
Zdenek Kabelac
5911fa1d91 cache: warn if caching causes troubles
Certain stacks of cached LVs may have unexpected consequences.
So add a warning function called when LV is cached to detect
such caces and WARN user about them - the best we could do ATM.
2015-09-10 17:27:30 +02:00
Ondrej Kozina
6e4f2da9b3 lvconvert: skip polling in test mode 2015-09-02 17:25:29 +02:00
Zdenek Kabelac
9886fd236e cache: lvconvert accepts --cachemode for --cache
All cache args could be specified when caching LV
(means converting LV to cached).

When --cachemode arg is given during cache-pool conversion,
store it in the metadata.

https://bugzilla.redhat.com/show_bug.cgi?id=1255184
2015-08-26 11:24:41 +02:00
David Teigland
7b570840cd lockd: no error when unlock fails
The unlock call will fail in expected and normal cases,
and should not cause the command to fail.  (An actual
unlock in the lock manager should never fail.)
2015-08-18 11:18:40 -05:00
Zdenek Kabelac
a7abade088 cleanup: compare fgets pointer
Check pointer for not being NULL.
2015-08-18 16:05:04 +02:00
Zdenek Kabelac
3d08a49790 cleanup: add cast 2015-08-18 15:00:08 +02:00
Zdenek Kabelac
ae4db9f302 lockd: check for failing unlock
Avoid ignoring unlocking error.
2015-08-18 15:00:07 +02:00
Zdenek Kabelac
f0c18fceb4 cache: api update
Change logic and naming of some internal API functions.

cache_set_mode() and cache_set_policy() both take segment.

cache mode is now correctly 'masked-in'.

If the passed segment is 'cache' segment - it will automatically
try to find 'defaults' according to profiles if the are NOT
specified on command line or they are NOT already set for cache-pool.

These defaults are never set for cache-pool.
2015-08-12 14:32:24 +02:00
Zdenek Kabelac
969ee25a74 toollib: get_cache_params
Enhance  get_cache_params() to read common cache args.
2015-08-12 14:11:18 +02:00
David Teigland
819dc1845e lvconvert: fix lockd LV locking
Request a transient LV lock from lvmlockd when
converting an LV.  If the LV is inactive when
lvconvert is run, the LV lock will be acquired
and then released when the command is done.
If the LV is active, a persistent lock exists
already and the transient lock request does nothing.

This fixes the issue that had been mentioned in the
comment previously.
2015-08-11 12:17:24 -05:00
David Teigland
27e6aee390 lvconvert: merge polling fixes for lockd
. the poll check will eventually call finish which will
  write the VG, so an ex VG lock is needed from lvmlockd.

. fix missing unlock on poll error path

. remove the lockd locking while monitoring the progress
  of the command, as suggested by the earlier FIXME comment,
  as it's not needed.
2015-07-22 12:28:06 -05:00
Ondrej Kozina
00d24511bc lvconvert: remove unused struct members 2015-07-22 12:56:43 +02:00
Ondrej Kozina
03762f42c1 lvconvert: retain retcode consistency
Always return the highest retcode caught during convert command
(regression in commit ae88bf03a1).
Also minor code cleanup.
2015-07-22 12:26:46 +02:00
David Teigland
ae88bf03a1 lvconvert: fix polling outside of core lvconvert
Recent change to move the polling outside of core lvconvert
code was wrongly using 'lv' and 'vg' structs which can't be
used outside of the core code, which caused seg fault.

Properly isolate all use of lv structs within the core of
the lvconvert code, saving any information necessary,
(esp lvid).  After the core of lvconvert is done, use
the saved information to do polling.

FIXME: the need for is_merging_origin and is_merging_origin_thin
in this patch is ugly, and a cleaner way should be found to deal
with that than what is done here.

Also it effectively removed all hacks in _lvconvert_merge_single
performing ugly: VG reread, unlock, polling, lock sequence.

Moreover all polling operations are postponed after all conversions
are finished.

lvm2 (while locking via lvmlockd) should now be able to run with
or without lvmpolld while performing poll operations originating
in lvconvert command.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
2015-07-22 10:38:02 +02:00
Zdenek Kabelac
e9e35b011e cache: handle policy_name separately
Keep policy name separate from policy settings and avoid
to mangling and demangling this string from same config tree.
Ensure policy_name is always defined.
2015-07-15 13:10:22 +02:00
Peter Rajnoha
ac3143c093 config: {thin,cache}_{check,repair}_options are never undefined
Require global/{thin,cache}_{check,repair}_options to be always defined.
If not defined directly by user in the configuration and if there's no
concrete default option to use, make "" (empty string) the default one -
it's then clearly visible in the "lvmconfig --type default" (and
generated lvm.conf) and also it makes its handling in the code more
straightforward so we don't need to handle undefined values.

This means, if there are no default values for these settings defined,
we end up with this generated now:
  {thin,cache}_{check,repair}_options = [ "" ]

So the value is never undefined and if it is, it's an error.

(The cache_repair_options is actually not used in the code at the moment,
but once the code using this setting is in, it will follow the same logic
as used for thin_repair_options.)
2015-07-14 10:13:41 +02:00
David Teigland
222bb2b88d lockd: note that external origins don't work in lockd VGs
in a comment at the point where it fails, and in the
lvmlockd man page.
2015-07-10 15:53:21 -05:00
David Teigland
c4fdcb04be lvconvert: disallow splitting in lockd VGs
A new lockd lock needs to be created for the new LV
created by split mirror and split snapshot.  Disallow
these options in lockd VGs until that is implemented.
2015-07-10 15:53:21 -05:00
Peter Rajnoha
3ec4813ba2 coverity: fix missing initialization
... Using uninitialized value "lockd_state" when calling "lockd_vg"
(even though lockd_vg assigns 0 to the lockd_state, but it looks at
previous state of lockd_state just before that so we need to have
that properly initialized!)

libdm/libdm-report.c:2934: uninit_use_in_call: Using uninitialized value "tm". Field "tm.tm_gmtoff" is uninitialized when calling "_get_final_time".

daemons/lvmlockd/lvmlockctl.c:273: uninit_use_in_call: Using uninitialized element of array "r_name" when calling "format_info_r_action". (just added FIXME as this looks unfinished?)
2015-07-08 14:53:30 +02:00
Peter Rajnoha
3b6840e099 config: replace find_config_tree_node with find_config_tree_array where appropriate 2015-07-08 13:03:08 +02:00
Alasdair G Kergon
dfe3eb12d0 include: Standardise around new tool.h. 2015-07-06 17:30:18 +01:00
Alasdair G Kergon
810ab095e6 macros: Wrap PRI with FMT.
Create a set of wrappers with embedded % such as
  #define FMTu64 "%" PRIu64
2015-07-06 15:09:17 +01:00
David Teigland
fe70b03de2 Add lvmlockd 2015-07-02 15:42:26 -05:00
Ondrej Kozina
a72a805896 lvconvert.c: fix whitespace mess 2015-05-26 16:26:57 +02:00
Lidong Zhong
9d558fbcc2 lvconvert: change how to get failed mirrors number
Commit  b00711e312 improperly
convert _area_missing() replacment and moved check for
AREA_PV seg_type() into same if() section.

Signed-off-by: Lidong Zhong <lzhong@suse.com>
2015-05-22 15:35:36 +02:00
David Teigland
cf5b4a2286 lvconvert.c: drop get_vg_lock_and_logical_volume fn 2015-05-19 20:56:32 +02:00