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

295 Commits

Author SHA1 Message Date
David Teigland
117160b27e Remove lvmetad
Native disk scanning is now both reduced and
async/parallel, which makes it comparable in
performance (and often faster) when compared
to lvm using lvmetad.

Autoactivation now uses local temp files to record
online PVs, and no longer requires lvmetad.

There should be no apparent command-level change
in behavior.
2018-07-11 11:26:42 -05:00
Zdenek Kabelac
6206bd0e79 lvchange: vdo support compression deduplication change
Add basic support for changing compression and deduplication state
of a VDO pool volume.

Allowing to access it also via top-level VDO volume.
2018-07-09 15:29:15 +02:00
David Teigland
616eeba6f2 use exclusive file lock on VG for activation
Make activation commands:
  vgchange -ay, lvchange -ay, pvscan -aay

take an exclusive file lock on the VG to serialize
multiple concurrent activation commands which could
otherwise interfere with each other.
2018-06-07 16:17:04 +01:00
David Teigland
18259d5559 Remove unused clvm variations for active LVs
Different flavors of activate_lv() and lv_is_active()
which are meaningful in a clustered VG can be eliminated
and replaced with whatever that flavor already falls back
to in a local VG.

e.g. lv_is_active_exclusive_locally() is distinct from
lv_is_active() in a clustered VG, but in a local VG they
are equivalent.  So, all instances of the variant are
replaced with the basic local equivalent.

For local VGs, the same behavior remains as before.
For shared VGs, lvmlockd was written with the explicit
requirement of local behavior from these functions
(lvmlockd requires locking_type 1), so the behavior
in shared VGs also remains the same.
2018-06-07 16:17:04 +01:00
David Teigland
3e781ea446 Remove clvmd and associated code
More code reduction and simplification can follow.
2018-06-05 11:09:13 -05:00
Joe Thornber
dbba1e9b93 Merge branch 'master' into 2018-05-11-fork-libdm 2018-06-01 13:04:12 +01:00
David Teigland
7f7ec769d9 lvmlockd: do not use an LV lock for some lvchange options
Some lvchange options can be used even if the LV is active.
2018-05-30 09:25:45 -05:00
Joe Thornber
7f97c7ea9a build: Don't generate symlinks in include/ dir
As we start refactoring the code to break dependencies (see doc/refactoring.txt),
I want us to use full paths in the includes (eg, #include "base/data-struct/list.h").
This makes it more obvious when we're breaking abstraction boundaries, eg, including a file in
metadata/ from base/
2018-05-14 10:30:20 +01:00
Zdenek Kabelac
fade45b1d1 mirror: improve table update
Shift refresh of mirror table right into monitor_dev_for_events().
Use  !vg_write_lock_held() to recognize use of lvchange/vgchange.
(this shall change if this would no longer work, but requires
futher some API changes).

With this patch  dm mirror table is only refreshed when necassary.

Also update WARNING message about mirror usage without monitoring
and display LV name.
2018-04-30 10:41:51 +02:00
Zdenek Kabelac
ae27461777 lvchange: update mirror table when changing monitoring
Since for non-monitored mirrors we let mirror running without
error handling - when monitoring changes for mirror, updated
table (refresh) is needed.
2018-04-23 22:42:18 +02:00
Zdenek Kabelac
112846ce0b activation: support activation of component LVs
Occasionaly users may need to peek into 'component devices.
Normally lvm2 does not let users activation component.

This patch adds special mode where user can activate
component LV in a 'read-only' mode i.e.:

lvchange -ay vg/pool_tdata

All devices can be deactivated with:

lvchange -an vg  |  vgchange -an....
2018-03-06 15:42:46 +01:00
Zdenek Kabelac
406d6de651 cleanup: indent 2018-02-28 21:15:55 +01:00
Alasdair G Kergon
f1cc5b12fd tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
David Teigland
5406191cb9 lvchange: allow changing properties on thin pool data lv
Add an exception to not allowing lvchange to change properties
on hidden LVs.  When a thin pool data LV is a cache LV, we
need to allow changing cache properties on the tdata sublv of
the thin pool.
2017-05-15 10:59:48 -05:00
David Teigland
7ccb4825c7 lvchange/lvconvert: fix missing lvmlockd LV locks
lvchange/lvconvert operations that do not require the LV
to already be active need to acquire a transient LV lock
before changing/converting the LV to ensure the LV is not
active on another host.  If the LV is already active,
a persistent LV lock already exists on the host and the
transient LV lock request is a no-op.

Some lvmlockd locks in lvchange were lost in the cmd def
changes.  The lvmlockd locks in lvconvert seem to have
been missed from the start.
2017-04-05 16:46:38 -05:00
Heinz Mauelshagen
c9bc1c1c8c lvchange: tidy switch code in _lvchange_properties_single() 2017-04-05 17:29:31 +02:00
David Teigland
6fdc391bae lvchange: fix missing return value
A return value from lvchange_persistent_cmd() was missed
in commit 1c41898c07
2017-04-05 10:08:01 -05:00
David Teigland
a7d4156a9a lvchange: fix --poll value when set from option
The actual value specified by the --poll y|n option was not
being used.  The way the --poll value is used is hidden
through an indirection where the value is stored in a
global variable at the start of the command, and then the
value is read from there later.  Setting the global
variable early in the command had been lost with the
cmd def changes.
2017-04-04 17:04:45 -05:00
David Teigland
1c41898c07 vgchange/lvchange: fix poll and monitor use
Fill in some gaps where old versions of lvm allowed
--poll and --monitor in combination with other operations,
but those combinations had been lost since the cmd def work.
(The new cmd def code also added some combinations that
had been missed by the old code.)

Changes:

lvchange --activate: add poll and monitor options, and
                     add calls to them in implementation.

lvchange --refresh: add monitor option (poll already there),
                    and call to monitor in implementation.

lvchange <metadata ops>: add poll and monitor options, and
                         add calls to them in implementation.

vgchange <metadata ops>: add poll option (call to poll
                         already in implementation).

vgchange --refresh: remove monitor option (not used by code)

lvchange --persistent y: add poll and monitor options, and
                         add calls to them, and to activate
                         in the implementation. (Making it
                         match the main lvchange metadata
                         command.)

Summary of current usage:

lvchange --activate: monitor, poll
vgchange --activate: monitor, poll

lvchange --refresh: monitor, poll
vgchange --refresh: poll

lvchange --monitor: ok
lvchange --poll: ok
lvchange --monitor --poll: ok
vgchange --monitor: ok
vgchange --poll: ok
vgchange --monitor --poll: ok

lvchange <metadata ops>: monitor, poll
vgchange <metadata ops>: poll
2017-04-04 17:04:45 -05:00
Heinz Mauelshagen
a12b3af033 lvchange: enhance avoiding multiple metadata updates/reloads/backups
Enhance commit 25b5915c9b
to process options requiring immediate metadata commits
and reloads after those we can group together doing just
one commit and an optional reload for the whole group.

Backup metadata after processing options successfully.

Related: rhbz1437611
2017-04-04 23:53:55 +02:00
Heinz Mauelshagen
25b5915c9b lvchange: avoid multiple metadata updates/reloads/backups
_lvchange_properties_single() processes multiple command
line arguments in a loop causing metadata updates and/or
backups per argument.

Optimize to only perform one update and/or backup
(but necessary interim ones; e.g. for --resync)
per command run.

Related: rhbz1437611
2017-04-01 02:38:48 +02:00
Heinz Mauelshagen
6165e09221 lvchange: reject setting all raid1 images to writemostly
raid1 doesn't allow to set all images to writemostly because at
least one image is required to receive any written data immediately.

The dm-raid target will detect such invalid request and
fail it iwith a kernel error message.

Reject such request in uspace displaying a respective error message.
2017-03-26 20:28:04 +02:00
Zdenek Kabelac
4d2b1a0660 cache: enable usage of --cachemetadataformat
lvcreate and lvconvert may select cache metadata format when caching LV.
By default lvm2 picks best available format.
2017-03-10 19:33:01 +01:00
Zdenek Kabelac
c598e65de9 cache: get and set cache params 2017-03-10 19:33:00 +01:00
Zdenek Kabelac
4184331965 cache: use UNSELECTED enum
Switch from _UNDEFINED to _UNSELECTED which is more describing
its value 0, while value -1 is better match for UNDEFINED.
2017-03-10 19:33:00 +01:00
Zdenek Kabelac
b8cd0f4808 thin: add new ZERO/DISCARDS_UNSELECTED
To more easily recognize unselected state from select '0' state
add new 'THIN_ZERO_UNSELECTED' enum.
Same applies to THIN_DISCARDS_UNSELECTED.

For those we no longer need to use PASS_ARG_ZERO or PASS_ARG_DISCARDS.
2017-03-10 19:33:00 +01:00
Heinz Mauelshagen
8ab0725077 lvchange: reject writemostly/writebehind on raid1 during resync
The MD kernel raid1 personality does no use any writemostly leg as the primary.

In case a previous linear LV holding data gets upconverted to
raid1 it becomes the primary leg of the new raid1 LV and a full
resynchronization is started to update the new legs.

No writemostly and/or writebehind setting may be allowed during
this initial, full synchronization period of this new raid1 LV
(using the lvchange(8) command), because that would change the
primary (i.e the previous linear LV) thus causing data loss.

lvchange has a bug not preventing this scenario.

Fix rejects setting writemostly and/or writebehind on resychronizing raid1 LVs.

Once we have status in the lvm2 metadata about the linear -> raid upconversion,
we may relax this constraint for other types of resynchronization
(e.g. for user requested "lvchange --resync ").

New lvchange-raid1-writemostly.sh test is added to the test suite.

Resolves: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855895
2017-02-23 15:09:29 +01:00
David Teigland
c3faa5816d commands: move command def parsing into lvm binary
It was previously done at build time by the ccmd binary.
2017-02-13 08:20:10 -06:00
David Teigland
52c60b7e7b lvchange: make use of command definitions
Reorganize the lvchange code to take advantage of
the command definition, and remove the validation
that is done by the command definintion rules.
2017-02-13 08:20:10 -06:00
David Teigland
9c6c55c314 process_each_lv: add check_single_lv function
The new check_single_lv() function is called prior to the
existing process_single_lv().  If the check function returns 0,
the LV will not be processed.

The check_single_lv function is meant to be a standard method
to validate the combination of specific command + specific LV,
and decide if the combination is allowed.  The check_single
function can be used by anything that calls process_each_lv.

As commands are migrated to take advantage of command
definitions, each command definition gets its own entry
point which calls process_each for itself, passing a
pair of check_single/process_single functions which can
be specific to the narrowly defined command def.
2017-02-13 08:20:10 -06:00
Zdenek Kabelac
1f5dde38a7 cleanup: more use of lvseg_name
Use existing function lvseg_name().
2017-01-03 14:55:16 +01:00
Zdenek Kabelac
0e8449a5b9 thin: fix lvchange of discards and zero flag
Reload of thin-pool origin_only is designed to only post messages
to a thin-pool. It's not intended to be used for reload of thin-pool
table. Fix it by using standard call  'lv_update_and_reload()'.
2016-09-19 14:00:56 +02:00
Brassow Jonathan
5838c41a35 cache: scrubbing for cache origin LV - Bug 1169495
Allow RAID scrubbing on cache origin sub-LV

This patch adds the ability to perform RAID scrubbing on the cache
origin sub-LV (https://bugzilla.redhat.com/1169495).  Cache origin
operations are restricted to non-clustered RAID LVs until there can
be further testing in a cluster (even for exclusive activation).

User can either specify directly _corig LV
or he can specify cache LV and operation  --syncation is
passed ONLY to   _corig LV.

If users wants to manipulation with cache-pool devices - he
needs to specify this object name.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2016-09-07 16:42:32 +02:00
Heinz Mauelshagen
d2c3b23e6d lvchange: Allow device specification when requesting a repair
'lvchange --resync LV' or 'lvchange --syncaction repair LV' request the
RAID layout specific parity blocks in raid4/5/6 to be recreated or the
mirrored blocks to be copied again from the master leg/copy for raid1/10,
thus not allowing a rebuild of a particular PV.

Introduce repeatable option '--[raid]rebuild PV' to allow to request
rebuilds of specific PVs in a RaidLV which are known to contain corrupt
data (e.g. rebuild a raid1 master leg).

Add test lvchange-rebuild-raid.sh to test/shell doing rebuild
variations on raid1/10 and 5; add aux function check_status_chars
to support the new test.

 - Resolves rhbz1064592
2016-08-05 16:01:46 +02:00
Alasdair G Kergon
5af311ddd8 macros: Add lv_is_not_synced. 2016-07-14 14:21:01 +01:00
Heinz Mauelshagen
c77c59f3d9 lvchange: resync attempts on raid0 cause segfaults
Resync attempts on raid0/raid0_meta via 'lvchange --resync ...'
cause segfaults.

'lvchange --syncaction ...' doesn't get rejected either.

Prohibit both on raid0/raid0_meta LVs.

- resolves rhbz1354656
2016-07-12 17:23:05 +02:00
Zdenek Kabelac
3fd4584886 cleanup: lvchange uses display_lvname
Convert messages to report vg/lv name consistently.

Also drop unneeded 'info_obtaned' variable since the
obtained info is not reused in any code path.
2016-07-01 00:44:48 +02:00
Alasdair G Kergon
7e671e5dd0 tools: Use arg_is_set instead of arg_count. 2016-06-21 22:24:52 +01:00
Zdenek Kabelac
04003cf1ff cache: add log_error on error path
Validate and report error when lv_cache_status is called
for inactive LV, or pending delete or unused cache_pool.
2016-05-27 15:47:24 +02:00
David Teigland
2f2b3c9100 lvconvert: use process_each_lv
In the same way that process_each_vg() can be passed
a single VG name to process, also allow process_each_lv()
to be passed a single VG name and LV name to process.
2016-05-25 15:05:49 -05:00
Alasdair G Kergon
b896f7de1e raid0: Standardise meta_areas checks before access. 2016-05-23 22:55:13 +01:00
Zdenek Kabelac
197066c863 lvchange: allow change of cache mode
Add support for active cache LV.
Handle --cachemode args validation during command line processing.
Rework some lvm2 internal to use lvm2 defined  CACHE_MODE  enums
indepently on libdm defines and use enum around the code instead
of passing and comparing strings.
2016-05-19 18:40:14 +02:00
Zdenek Kabelac
e77b6968b6 lvchange: use better arg functions 2016-04-26 23:29:58 +02:00
Zdenek Kabelac
c215e1be5c lvchange: always check for sigint
Check sigint() state during process_each_lv.
2016-04-26 23:29:08 +02:00
Zdenek Kabelac
d8bdc7af37 lvchange: fix return code
We already opened VG for this - so not an invalid cmdline.
2016-04-26 23:28:01 +02:00
Alasdair G Kergon
01181a299e activate: Hide errors when snapshot merge delayed. 2016-04-21 22:14:10 +01:00
David Teigland
5e9e43074a lvmetad: rework command connection setup and checking
The lvmetad connection is created within the
init_connections() path during command startup,
rather than via the old lvmetad_active() check.

The old lvmetad_active() checks are replaced
with lvmetad_used() which is a simple check that
tests if the command is using/connected to lvmetad.

The old lvmetad_set_active(cmd, 0) calls, which
stopped the command from using lvmetad (to revert to
disk scanning), are replaced with lvmetad_make_unused(cmd).
2016-04-19 14:00:02 -05: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
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
Alasdair G Kergon
39a97d86f0 segtypes: Add and use new segtype macros.
Includes fixing an inverted raid10 segtype check in _raid_add_target_line.
2015-09-24 14:59:07 +01:00