]> sourceware.org Git - lvm2.git/log
lvm2.git
9 years agotoolib: early validation of chunk size
Zdenek Kabelac [Sat, 4 Oct 2014 20:36:41 +0000 (22:36 +0200)]
toolib: early validation of chunk size

Since we now have validate_pool_chunk_size() we could
validate entered values directly prior openning vg.

9 years agopool: use validation
Zdenek Kabelac [Mon, 6 Oct 2014 10:22:51 +0000 (12:22 +0200)]
pool: use validation

9 years agopool: validate_pool_chunk_size
Zdenek Kabelac [Mon, 6 Oct 2014 10:18:57 +0000 (12:18 +0200)]
pool: validate_pool_chunk_size

Introduce pool function for validation of chunk size.
It's good idea to be able to reject invalid chunk size
when entered on command line before we open VG.

9 years agoman: document -ff for removal
Zdenek Kabelac [Sat, 4 Oct 2014 15:06:51 +0000 (17:06 +0200)]
man: document -ff for removal

Make it visible in man page that -ff could make removal
process proceed in case of damaged pool.

9 years agovg/lvremove: support --yes
Zdenek Kabelac [Sat, 4 Oct 2014 15:05:29 +0000 (17:05 +0200)]
vg/lvremove: support --yes

Make --yes equivalent to DONT_PROMT (--force).

So user could use 'lvremove --yes vg/lvol1' skipping prompt.

9 years agoman: lvconvert new split options
Zdenek Kabelac [Mon, 6 Oct 2014 12:43:25 +0000 (14:43 +0200)]
man: lvconvert new split options

Update man page with info how to split/uncache cached logical
volumes.

lvconvert: splitsnapshot support --yes

Allow to use --yes to skip prompt.

9 years agolvconvert: splitsnapshot supports --yes
Zdenek Kabelac [Mon, 6 Oct 2014 12:42:47 +0000 (14:42 +0200)]
lvconvert: splitsnapshot supports --yes

Handle --yes arg to skip prompt.

9 years agolvconvert more test for thin external origin
Zdenek Kabelac [Mon, 6 Oct 2014 11:15:31 +0000 (13:15 +0200)]
lvconvert more test for thin external origin

Some LV types were not properly disallowed to be used as external origin.

9 years agolvconvert: cache and thin conversion validation
Zdenek Kabelac [Mon, 6 Oct 2014 11:44:59 +0000 (13:44 +0200)]
lvconvert: cache and thin conversion validation

More test for supported conversion.

9 years agolvconvert: validate cache conversion to snapshot
Zdenek Kabelac [Mon, 6 Oct 2014 10:27:35 +0000 (12:27 +0200)]
lvconvert: validate cache conversion to snapshot

Cache cannot be converted into snapshot cow nor origin.

9 years agocache: use same alg for cache size calc
Zdenek Kabelac [Mon, 6 Oct 2014 10:22:03 +0000 (12:22 +0200)]
cache: use same alg for cache size calc

Use the same algorithm for cache metadata size as the cache tool is using.

9 years agocache: improve creation code
Zdenek Kabelac [Fri, 3 Oct 2014 21:51:54 +0000 (23:51 +0200)]
cache: improve creation code

Move code to better locations.
Improve test and remove invalid ones
(i.e. no reason to require cache size to be >= then origin).

Correctly comment where the code is doing actual conversion
of other existing volume - we do already a similar thing with
external origins.

Lots of new command line options and combinations is now supported.
Hopefully older syntax still works as well.

lvcreate --cache --cachepool vg/pool  -l1
lvcreate --type cache --cachepool vg/pool  -l1
lvcreate --type cache-pool vg/pool  -l1
lvcreate --type cache-pool --name pool vg  -l1
... and many many more ...

9 years agolvremove: detect cluster wide active state
Zdenek Kabelac [Fri, 3 Oct 2014 21:49:57 +0000 (23:49 +0200)]
lvremove: detect cluster wide active state

If the LV is active remotely do not skip question for deactivation.

9 years agocache: check activation of volume activated
Zdenek Kabelac [Fri, 3 Oct 2014 21:48:42 +0000 (23:48 +0200)]
cache: check activation of volume activated

volume_list may silently skip activation which is then still reported as
success.

9 years agocache: lvremoved cached LV removes cache pool
Zdenek Kabelac [Fri, 3 Oct 2014 21:36:11 +0000 (23:36 +0200)]
cache: lvremoved cached LV removes cache pool

When we remove cached volume, whole tree must go down.
There is  'lvconvert --splitcache' to preserve cache pool.

9 years agopools: move removal of _pmspare
Zdenek Kabelac [Fri, 3 Oct 2014 21:34:16 +0000 (23:34 +0200)]
pools: move removal of _pmspare

Since _pmspare is internal volume move it to
lv_remove_single -  so it's automatically removed with
last remove thin-pool.

lv_remove_with_dependencies() is not always used for pool removal.

9 years agolvcreate: reuse validation of names
Zdenek Kabelac [Fri, 3 Oct 2014 17:04:45 +0000 (19:04 +0200)]
lvcreate: reuse validation of names

Use validate_lvname_param() for name validation.

9 years agolv_manip: fix out of order backup
Zdenek Kabelac [Fri, 3 Oct 2014 16:39:54 +0000 (18:39 +0200)]
lv_manip: fix out of order backup

We had only 2 remaining places that were leaving unbackuped metadata.

9 years agolvconvert: reuse cache validation
Zdenek Kabelac [Fri, 3 Oct 2014 16:52:08 +0000 (18:52 +0200)]
lvconvert: reuse cache validation

Validation is now already in
validate_lv_cache_create() so reuse it.

Also properly rename var origin -> origin_lv.

9 years agocache: add validate_lv_cache_create
Zdenek Kabelac [Fri, 3 Oct 2014 16:37:11 +0000 (18:37 +0200)]
cache: add validate_lv_cache_create

Move validation tests into separate function.

9 years agolvconvert: options splitcache, split, uncache
Zdenek Kabelac [Sat, 4 Oct 2014 13:32:24 +0000 (15:32 +0200)]
lvconvert: options splitcache, split, uncache

  --splitcache
  Splits only cached LV (also pool could be specified).
  Detaches cachepool from cached LV.

  --split
  Should be univerzal command to split various complex targets.
  At this moment it knows cache.

  --uncache
  Opposite command to --cache. Detaches and DELETES cachepool for
  cached LV.

Note: we support thin pool cached metadata device for uncaching.
Also use may specify wither cached LV or association cachepool device
to request split of cache.

9 years agotoollib: validate also name
Zdenek Kabelac [Tue, 30 Sep 2014 19:45:10 +0000 (21:45 +0200)]
toollib: validate also name

In validate_lvname_param() call also validate_name().

9 years agolvcreate: support --cache and --cachepool
Zdenek Kabelac [Tue, 30 Sep 2014 19:46:02 +0000 (21:46 +0200)]
lvcreate: support --cache and --cachepool

Enable in cmdline options for cache and cachepool.

9 years agocommands: support shortcut -H for cache objects
Zdenek Kabelac [Mon, 29 Sep 2014 18:43:11 +0000 (20:43 +0200)]
commands: support shortcut -H for cache objects

Introduce cache_long_ARG for those instancies
where --cache is not related to caching LV.
(pvchange,vg|lv|pvscan).

cache_ARG is now with -H shortcut.

9 years agothin: better thin snapshot error detection
Zdenek Kabelac [Mon, 6 Oct 2014 11:42:59 +0000 (13:42 +0200)]
thin: better thin snapshot error detection

While creating thin snapshot, we cannot use size argument.

9 years agothin: lvcreate improve check of thin params
Zdenek Kabelac [Mon, 6 Oct 2014 11:13:01 +0000 (13:13 +0200)]
thin: lvcreate improve check of thin params

Use arg_from_list_is_set()
Resolve pool_lv at one single place.
Replace use of find_lv_in_vg() with find_lv().

9 years agolvcreate: refactor code
Zdenek Kabelac [Sun, 28 Sep 2014 20:31:30 +0000 (22:31 +0200)]
lvcreate: refactor code

Over the time lvcreate code has accumulated various hacks.
So try to move that code in right places.

Detect all types early in _lvcreate_params() so functions like
_read_size_params() do not need to change volume types.

Also ultimately respect give volume --type, that its shortcut
(-T, H, -m, -s) and after that options which do type estimation.
(i.e. --cachepool, --thinpool)

Avoid repeative tests - if we know all types are decode at once
place we can 'optimize' number of validations.

9 years agotest: Show an activation bug in lvcreate of a cache over raid.
Petr Rockai [Mon, 6 Oct 2014 06:11:42 +0000 (08:11 +0200)]
test: Show an activation bug in lvcreate of a cache over raid.

9 years agolvconvert: Forward --splitmirror to a cache origin when applicable.
Petr Rockai [Mon, 6 Oct 2014 06:11:06 +0000 (08:11 +0200)]
lvconvert: Forward --splitmirror to a cache origin when applicable.

9 years agotoollib: Rewrite process_each_lv.
David Teigland [Fri, 3 Oct 2014 22:37:49 +0000 (23:37 +0100)]
toollib: Rewrite process_each_lv.

Copy the same form as the new process_each_vg.
Replace unused struct cmd_vg and cmd_vg_read() replicator
code with struct vg and vg_read() directly.
The failed_lvnames arg is no longer used since the
cmd_vg replicator wrapper was removed.

[Committed by agk with cosmetic changes and tweaks.]

9 years agotoollib: Rewrite process_each_vg.
David Teigland [Fri, 3 Oct 2014 19:47:19 +0000 (20:47 +0100)]
toollib: Rewrite process_each_vg.

Split VG argument collection from processing.
This allows the two different loops through VGs to
be replaced by a single loop.
Replace unused struct cmd_vg and cmd_vg_read() replicator
code with struct vg and vg_read() directly.

[Committed by agk with cosmetic changes and tweaks.]

9 years agoman: lvmcache better cache mode info and other command variations
David Teigland [Tue, 26 Aug 2014 21:40:47 +0000 (16:40 -0500)]
man: lvmcache better cache mode info and other command variations

9 years agocache: include cache mode in vg metadata and display
David Teigland [Wed, 1 Oct 2014 21:06:01 +0000 (16:06 -0500)]
cache: include cache mode in vg metadata and display

The cache mode of a new cache pool is always explicitly
included in the vg metadata.  If a cache mode is not
specified on the command line, the cache mode is taken
from lvm.conf allocation/cache_pool_cachemode, which
defaults to "writethrough".

The cache mode can be displayed with lvs -o+cachemode.

9 years agocleanup: remove compiler warning about possible uninitialized variable use
Peter Rajnoha [Thu, 2 Oct 2014 11:21:24 +0000 (13:21 +0200)]
cleanup: remove compiler warning about possible uninitialized variable use

filters/filter-usable.c:22: warning: "ucp.check_..." may be used uninitialized in this function

This can't actually be hit in real, but let's clean this up for the compiler
to be happy again.

9 years agofilters: add cmd->full_filter - composite of cmd->filter and cmd->lvmetad_filter
Peter Rajnoha [Thu, 2 Oct 2014 10:00:57 +0000 (12:00 +0200)]
filters: add cmd->full_filter - composite of cmd->filter and cmd->lvmetad_filter

There are actually three filter chains if lvmetad is used:
  - cmd->lvmetad_filter used when when scanning devices for lvmetad
  - cmd->filter used when processing lvmetad responses
  - cmd->full_fiilter (which is just cmd->lvmetad_filter + cmd->filter chained together) used
    for remaining situations

This patch adds the third one - "cmd->full_filter" - currently this is
used if device processing does not fall into any of the groups before,
for example, devices which does not have the PV label yet and we're just
creating a new one or we're processing the devices where the list of the
devices (PVs) is not returned by lvmetad initially.

Currently, the cmd->full_filter is used exactly in these functions:
  - lvmcache_label_scan
  - _pvcreate_check
  - pvcreate_vol
  - lvmdiskscan
  - pvscan
  - _process_each_label

If lvmetad is used, then simply cmd->full_filter == cmd->filter because
cmd->lvmetad_filter is NULL in this case.

9 years agocleanup: remove symlink to profile in test dir for CLEAN target
Peter Rajnoha [Thu, 2 Oct 2014 07:30:38 +0000 (09:30 +0200)]
cleanup: remove symlink to profile in test dir for CLEAN target

9 years agotools: Add ENABLE_ALL_DEVS flag.
David Teigland [Wed, 1 Oct 2014 21:58:23 +0000 (22:58 +0100)]
tools: Add ENABLE_ALL_DEVS flag.

The ENABLE_ALL_DEVS flag is added to the command structure
for commands that should process all devs (pvs and non-pvs)
when they call process_each_pv and the command includes the
--all arg.  This will be used in a later process_each_pv patch.

9 years agotools: Add ALL_VGS_IS_DEFAULT flag.
David Teigland [Wed, 1 Oct 2014 21:58:00 +0000 (22:58 +0100)]
tools: Add ALL_VGS_IS_DEFAULT flag.

The ALL_VGS_IS_DEFAULT flag is added to the command structure
for commands that should process all vgs when they call
process_each_vg or process_each_lv with no args.
This will be used in later patches to process_each functions.

9 years agoman: lvmthin mention alternate syntax
David Teigland [Wed, 1 Oct 2014 15:29:30 +0000 (10:29 -0500)]
man: lvmthin mention alternate syntax

Users will probably run across the alternate syntax,
so we should explain how it relates to what is used here.

9 years agoRevert "Revert "man: lvmcache should use clearer cache pool options""
David Teigland [Wed, 1 Oct 2014 15:43:53 +0000 (10:43 -0500)]
Revert "Revert "man: lvmcache should use clearer cache pool options""

This reverts commit f120c954fc065d67c1aacd5cfba58843eb552b0f.

9 years agofilters: refresh filters when lvmetad use is toggled
Peter Rajnoha [Tue, 30 Sep 2014 14:08:05 +0000 (16:08 +0200)]
filters: refresh filters when lvmetad use is toggled

We need to use proper filter chain when we disable lvmetad use
explicitly in the code by calling lvmetad_set_active(0) while
overriding existing configuration. We need to reinitialize filters
in this case so proper filter chain is used. The same applies
for the other way round - when we enable lvmetad use explicitly in
the code (though this is not yet used).

9 years agofilters: use usable device filter and separate lvmetad filter chain so it's not reeva...
Peter Rajnoha [Tue, 23 Sep 2014 10:50:09 +0000 (12:50 +0200)]
filters: use usable device filter and separate lvmetad filter chain so it's not reevaluated for any lvmetad response

With this change, the filter chains used look like this now:

  A) When *lvmetad is not used*:
    - persistent filter -> regex filter -> sysfs filter ->
      global regex filter -> type filter ->
      usable device filter(FILTER_MODE_NO_LVMETAD) ->
      mpath component filter -> partitioned filter ->
      md component filter

  B) When *lvmetad is used* (two separate filter chains):
     - the lvmetad filter chain used when scanning devs for lvmetad update:
       sysfs filter -> global regex filter -> type filter ->
       usable device filter(FILTER_MODE_PRE_LVMETAD) ->
       mpath component filter -> partitioned filter ->
       md component filter

     - the filter chain used for lvmetad responses:
       persistent filter -> usable device filter(FILTER_MODE_POST_LVMETAD) ->
       regex filter

9 years agofilters: add "usable device" filter
Peter Rajnoha [Tue, 23 Sep 2014 10:49:01 +0000 (12:49 +0200)]
filters: add "usable device" filter

Usable device filter is responsible for filtering out unusable DM devices.
The filter has 3 modes of operation:

  - FILTER_MODE_NO_LVMETAD:
    When this mode is used, we check DM device usability by looking:
      - whether device is empty
      - whether device is blocked
      - whether device is suspended (only on devices/ignore_suspended_devices=1)
      - whether device uses an error target
      - whether device name/uuid is reserved

  - FILTER_MODE_PRE_LVMETAD:
    When this mode is used, we check DM device usability by looking:
      - whether device is empty
      - whether device is suspended (only on devices/ignore_suspended_devices=1)
      - whether device uses an error target
      - whether device name/uuid is reserved

  - FILTER_MODE_POST_LVMETAD:
    When this mode is used, we check DM device usability by looking:
      - whether device is blocked
      - whether device is suspended (only on devices/ignore_suspended_devices=1)

These modes will be used by subsequent patch to create different
instances of this filter, depending on lvmetad use.

9 years agorefactor: make it possible to select what to check exactly when calling device_is_usa...
Peter Rajnoha [Tue, 23 Sep 2014 10:47:11 +0000 (12:47 +0200)]
refactor: make it possible to select what to check exactly when calling device_is_usable fn

Currently, there are 5 things that device_is_usable function checks
(for DM devices only, of course):
  - is device empty?
  - is device blocked? (mirror)
  - is device suspended?
  - is device composed of an error target?
  - is device name/uuid reserved?

If answer to any of these questions is "yes", then the device is not usable.
This patch just adds possibility to choose what to check for exactly - the
device_is_usable function now accepts struct dev_usable_check_params make
this selection possible. This is going to be used by subsequent patches.

9 years agoconf: Update comments on lvmetad+filters in example.conf.in.
Petr Rockai [Tue, 30 Sep 2014 09:39:07 +0000 (11:39 +0200)]
conf: Update comments on lvmetad+filters in example.conf.in.

9 years agoman: lvmthin remove unnecessary fixme
David Teigland [Mon, 29 Sep 2014 17:28:00 +0000 (12:28 -0500)]
man: lvmthin remove unnecessary fixme

The existing method for single step thin-pool + thin creation
makes sense.

9 years agoRevert "Revert "man: lvmthin should use clearer thin pool options""
David Teigland [Mon, 29 Sep 2014 17:26:16 +0000 (12:26 -0500)]
Revert "Revert "man: lvmthin should use clearer thin pool options""

This reverts commit 17a1869df506a3641d49d52c413b5bc04ec2adc9.

We've agreed on the clearer syntax.

9 years agovalgrind: don't eat mem with valgrind
Zdenek Kabelac [Sat, 27 Sep 2014 14:27:34 +0000 (16:27 +0200)]
valgrind: don't eat mem with valgrind

When compiled with valgrind pool support - don't waste time
with preallocation of memory - it just waste of CPU cycles to
trace access to this memory.

We also may get slightly better estimation about real memory usage
during command processing.

9 years agocleanup: drop unused variable
Zdenek Kabelac [Sat, 27 Sep 2014 18:43:32 +0000 (20:43 +0200)]
cleanup: drop unused variable

9 years agolvconvert: switch to validate_lvname_param
Zdenek Kabelac [Sun, 28 Sep 2014 11:07:18 +0000 (13:07 +0200)]
lvconvert: switch to validate_lvname_param

Use new toollib function for validation.

9 years agotoollib: introduce validate_lvname_param
Zdenek Kabelac [Sun, 28 Sep 2014 10:57:39 +0000 (12:57 +0200)]
toollib: introduce validate_lvname_param

Function for parsing and validating of lvname parameter.

9 years agocleanup: rename func
Zdenek Kabelac [Sat, 27 Sep 2014 16:53:08 +0000 (18:53 +0200)]
cleanup: rename func

Update name of function read_and_validate_major_minor
and put it into the right header file toollib.h.

(In release update for f09f85d027d8833)

9 years agotoollib: refactor extract_vgname
Zdenek Kabelac [Sat, 27 Sep 2014 14:29:43 +0000 (16:29 +0200)]
toollib: refactor extract_vgname

Split internals of extract_vgname into _extract_vgname.
This common code will be used for other similar function.

Reuse skip_dev_dir() instead of less mature coded to skip
device dir.

Instead of duplicating full vg/lv name - allocate string
only vg portion of lv name.

9 years agotoollib: refactor skip_dev_dir
Zdenek Kabelac [Sun, 28 Sep 2014 10:54:20 +0000 (12:54 +0200)]
toollib: refactor skip_dev_dir

Detect dev dir just once.

9 years agoRevert "man: lvmcache should use clearer cache pool options"
Zdenek Kabelac [Sat, 27 Sep 2014 13:10:44 +0000 (15:10 +0200)]
Revert "man: lvmcache should use clearer cache pool options"

Revert: --cachepool  and --thipnpool is the right way

they both take arg

This is a major difference from  --cache   and --thin

9 years agoRevert "man: lvmthin should use clearer thin pool options"
Zdenek Kabelac [Sat, 27 Sep 2014 13:08:31 +0000 (15:08 +0200)]
Revert "man: lvmthin should use clearer thin pool options"

Revert: --cachepool  and --thipnpool is the right way

they both take arg

This is a major difference from  --cache   and --thin

9 years agoman: lvmthin should use clearer thin pool options
David Teigland [Fri, 26 Sep 2014 21:05:30 +0000 (16:05 -0500)]
man: lvmthin should use clearer thin pool options

Previously, this was the recommended form for creating a thin pool:

lvconvert --thinpool VG/ThinDataLV --poolmetadata VG/ThinMetaLV

but this is confusing, because --thinpool does not actually take
an arg, and is more naturally used to specify an existing thin pool.

The new recommended form is:

lvconvert --type thin-pool --poolmetadata VG/ThinMetaLV VG/ThinDataLV

9 years agoman: lvmcache should use clearer cache pool options
David Teigland [Fri, 26 Sep 2014 19:40:40 +0000 (14:40 -0500)]
man: lvmcache should use clearer cache pool options

Previously, this was the recommended form for creating a cache pool:

lvconvert --cachepool VG/CacheDataLV --poolmetadata VG/CacheMetaLV

but this is confusing, because --cachepool does not actually take
an arg, and is more natually used to specify an existing cache pool.

The new recommended form is:

lvconvert --type cache-pool --poolmetadata VG/CacheMetaLV VG/CacheDataLV

9 years agolvchange: missed bits for a8aee7dba2b76
Zdenek Kabelac [Wed, 24 Sep 2014 14:27:35 +0000 (16:27 +0200)]
lvchange: missed bits for a8aee7dba2b76

lv_info is not used here any more.
This code should have been committed with
lv_check_not_in_use API change commit.

9 years agocleanup: Use segtype.h definitions of segment type names wherever possible
Heinz Mauelshagen [Wed, 24 Sep 2014 13:24:41 +0000 (15:24 +0200)]
cleanup: Use segtype.h definitions of segment type names wherever possible

We are not using already defined segement type names where we could.

There is a lot of other places in device-mapper and LVM2 we have those
hardcoded so we should better finally have a common interface in
libdevmapper to avoid this.

9 years agotests: add helper funcionality for using gdb
Zdenek Kabelac [Sat, 20 Sep 2014 23:16:57 +0000 (01:16 +0200)]
tests: add helper funcionality for using gdb

When there is need for using gdb within test suite
just prefix command with LVM_DBG and run test in
standard shell (for stdin).

9 years agotests: drop * from dmsetup
Zdenek Kabelac [Sat, 20 Sep 2014 23:11:42 +0000 (01:11 +0200)]
tests: drop * from dmsetup

We cannot use shell expansion for dmsetup here.

9 years agodebug: add debug message
Zdenek Kabelac [Wed, 24 Sep 2014 08:03:55 +0000 (10:03 +0200)]
debug: add debug message

Since we leave error printing on the called of deactivation,
at least put in debug log for this case.

9 years agodebug: show stacktrace on error path
Zdenek Kabelac [Mon, 22 Sep 2014 13:59:50 +0000 (15:59 +0200)]
debug: show stacktrace on error path

9 years agodebug: drop printing debug trace without labeler
Zdenek Kabelac [Mon, 22 Sep 2014 11:34:12 +0000 (13:34 +0200)]
debug: drop printing debug trace without labeler

Not having labeller on device is not reason eo generate backtrace in log.

9 years agodebug: add missing stack trace
Zdenek Kabelac [Sun, 21 Sep 2014 09:48:09 +0000 (11:48 +0200)]
debug: add missing stack trace

9 years agodebug: monitor_dev_for_events stack trace
Zdenek Kabelac [Wed, 24 Sep 2014 07:58:04 +0000 (09:58 +0200)]
debug: monitor_dev_for_events stack trace

9 years agocleanup: reindent
Zdenek Kabelac [Tue, 23 Sep 2014 14:47:27 +0000 (16:47 +0200)]
cleanup: reindent

Save some code lines.

9 years agocleanup: drop duplicate const usage
Zdenek Kabelac [Mon, 22 Sep 2014 13:51:49 +0000 (15:51 +0200)]
cleanup: drop duplicate const usage

const char == const char const.

9 years agocleanup: drop uneeded backup call
Zdenek Kabelac [Mon, 22 Sep 2014 12:11:12 +0000 (14:11 +0200)]
cleanup: drop uneeded backup call

lv_update_and_reload already handle backup.

9 years agocleanup: use supplied cmd pointer
Zdenek Kabelac [Tue, 23 Sep 2014 14:49:46 +0000 (16:49 +0200)]
cleanup: use supplied cmd pointer

9 years agocleanup: fix typo and use vg mempool
Zdenek Kabelac [Sat, 20 Sep 2014 23:16:06 +0000 (01:16 +0200)]
cleanup: fix typo and use vg mempool

Since we are updating VG -  we can use its own mempool.

9 years agocleanup: replace error with print message
Zdenek Kabelac [Sat, 20 Sep 2014 20:05:29 +0000 (22:05 +0200)]
cleanup: replace error with print message

These are not error messages.
They are informing a user about missconfigured
options which do not change resulting error status.

9 years agocleanup: simplier _lv_passes_volumes_filter
Zdenek Kabelac [Sat, 20 Sep 2014 23:08:43 +0000 (01:08 +0200)]
cleanup: simplier _lv_passes_volumes_filter

Don't recreate string and just check components directly.

9 years agocleanup: use find_lv_in_vg_by_lvid
Zdenek Kabelac [Sun, 21 Sep 2014 09:46:34 +0000 (11:46 +0200)]
cleanup: use find_lv_in_vg_by_lvid

Replace another loop with existion function.

TODO: consider using hash maps for lvname & lvid lookups.

9 years agoactivate: update lv_check_not_in_use: API
Zdenek Kabelac [Wed, 24 Sep 2014 08:05:26 +0000 (10:05 +0200)]
activate: update lv_check_not_in_use: API

Use of lv_info() internally in lv_check_not_in_use(),
so it always could use with_open_count properly.

Skip sysfs() testing in open_count == 0 case.

Accept just 'lv' pointer like other functions.

The function has 'built-in' lv_is_active_locally check,
which however is not what we need to check in many place.
For now at least remotely active snapshot merge is
detected and for this case merge on next activation is scheduled.

9 years agolvconvert: reoder old snapshot merge
Zdenek Kabelac [Tue, 23 Sep 2014 18:23:09 +0000 (20:23 +0200)]
lvconvert: reoder old snapshot merge

Move check for snapshot-merge support before archiving.

Split code on 2 paths - with merge_on_activate
using vg_write & vg_commit
and lv_update_reload call for instant merging.

Move printing after backup.

9 years agocleanup: constify activation usage of lv pointer
Zdenek Kabelac [Mon, 22 Sep 2014 13:50:07 +0000 (15:50 +0200)]
cleanup: constify activation usage of lv pointer

Let's enforce cheking of write access to LV by compiler.
Activation part does never need to write anything to LV
so keep LV pointer const.

9 years agocleanup: move printing after backup
Zdenek Kabelac [Mon, 22 Sep 2014 12:06:52 +0000 (14:06 +0200)]
cleanup: move printing after backup

Print successful result after making backup.
In this place we are sure to not keep memlock.

9 years agovalidation: move check for spare correctness
Zdenek Kabelac [Sun, 21 Sep 2014 09:34:50 +0000 (11:34 +0200)]
validation: move check for spare correctness

Check lv feature when we check LVs

9 years agovgchange: use NULL 'feature' of lv_info call
Zdenek Kabelac [Wed, 24 Sep 2014 08:01:14 +0000 (10:01 +0200)]
vgchange: use NULL 'feature' of lv_info call

When NULL is passed for info the call itself
already does the same evaluation.

9 years agovgchange: add sync point
Zdenek Kabelac [Sun, 21 Sep 2014 21:22:23 +0000 (23:22 +0200)]
vgchange: add sync point

Before leaving _activate_lvs_in_vg() wait till devices
are active - so we do not print message about active
devices earlier then it really happens for a user.

9 years agothin and cache: improve conversion validation
Zdenek Kabelac [Mon, 22 Sep 2014 12:15:13 +0000 (14:15 +0200)]
thin and cache: improve conversion validation

More validations before any thin or cache related conversion begins.

We allow to use and stack:

pool data: cache or raid
pool metadata: raid

pool:  linear, striped
cache: linear, striped, raid
thin(extorig): linear, origin, cow, virtual, thin

9 years agothin: no pool can be used for external origins
Zdenek Kabelac [Mon, 22 Sep 2014 12:09:55 +0000 (14:09 +0200)]
thin: no pool can be used for external origins

Cache pool can't be external origin either.
For simplicity use vg from passed LV.

9 years agosnapshot: use lv_update_and_reload
Zdenek Kabelac [Sat, 20 Sep 2014 23:10:53 +0000 (01:10 +0200)]
snapshot: use lv_update_and_reload

9 years agosnapshot: add missing vg_revert
Zdenek Kabelac [Sat, 20 Sep 2014 23:10:06 +0000 (01:10 +0200)]
snapshot: add missing vg_revert

Error path missed vg_revert call.

9 years agomirror: extend adjusted_mirror_region_size API
Zdenek Kabelac [Mon, 22 Sep 2014 13:54:33 +0000 (15:54 +0200)]
mirror: extend adjusted_mirror_region_size API

We use adjusted_mirror_region_size() in two different contexts.

Either on command line -
 here we do want to inform user about reduction of size.

Or in pvmove activation context -
 here we should only use 'verbose' info.

9 years agolv_update_and_reload: use proper lock holder
Zdenek Kabelac [Mon, 22 Sep 2014 11:57:47 +0000 (13:57 +0200)]
lv_update_and_reload: use proper lock holder

When requesting to reload an LV imrove this API to
automatically reload its lock holding LV as in cluster
only top-level LVs are addressable with lock.

9 years agolv_ondisk: option search for lv without vg_ondisk
Zdenek Kabelac [Sun, 21 Sep 2014 21:10:04 +0000 (23:10 +0200)]
lv_ondisk: option search for lv without vg_ondisk

When vg_ondisk is NULL we do not need to search
through the whole VG to find out the same LV.

NOTE: as of now - VG locking is not enabled as some code parts
are breaking memory locking rules (lvm2app).

Once we enforce VG locking for read-only commands the effect
will be much better for larger VGs.

9 years agoactivate: lv_check_not_in_use no check of closed
Zdenek Kabelac [Sun, 21 Sep 2014 21:07:02 +0000 (23:07 +0200)]
activate: lv_check_not_in_use no check of closed

Don't perform expensive sysfs tests when the device is closed.
(having open_count == 0).

9 years agofix: regression for recent persistent commit
Zdenek Kabelac [Fri, 19 Sep 2014 15:05:35 +0000 (17:05 +0200)]
fix: regression for recent persistent commit

Do not let fly metadata with just 'minor' set
(since they would not be readable on older version)

Be permissive with invalid major/minor number and
just report them as problem, but allow to use
such metadata with default major:minor.

9 years agocleanup: use int32 for major minor
Zdenek Kabelac [Fri, 19 Sep 2014 15:04:28 +0000 (17:04 +0200)]
cleanup: use int32 for major minor

Use consistently int32_t for major, minor.

9 years agocache: fix regression and invert test
Zdenek Kabelac [Fri, 19 Sep 2014 14:16:36 +0000 (16:16 +0200)]
cache: fix regression and invert test

Last commit c710f02e0181cc2db5455f0c98033247a70ecc30
converting code to use lv_update_and_reload()
intoduced invalid test for error result.
Fix it and properly check for  if (!...)

9 years agodebug: enhance mmap catch code
Zdenek Kabelac [Fri, 19 Sep 2014 09:04:36 +0000 (11:04 +0200)]
debug: enhance mmap catch code

Use nice instruction_HLT macro
Use log_debug_mem()
Don't actually log things after we prohibit 'mmap'.
Move initialization of strerror & udev before blocking mmap.

9 years agoman: document obsoleted options
Zdenek Kabelac [Fri, 19 Sep 2014 12:53:14 +0000 (14:53 +0200)]
man: document obsoleted options

It's shown on comand line help and it's accepted argument,
so provide matching man entry.

9 years agobackup: drops locked memory
Zdenek Kabelac [Fri, 19 Sep 2014 13:31:41 +0000 (15:31 +0200)]
backup: drops locked memory

Since we want to backup metadata, this is the point
we no longer want to hold memory locked.

9 years agocleanup: lvchange remove some extra code.
Zdenek Kabelac [Fri, 19 Sep 2014 13:10:21 +0000 (15:10 +0200)]
cleanup: lvchange remove some extra code.

We do not need to restore LV content on error path - since
for reactivation we always use  ondisk/commited metadata,
so passed data are never used.

Drop some unneded extra message, since the called function
repeated logs same info.

9 years agolvchange: backup final metadata
Zdenek Kabelac [Fri, 19 Sep 2014 13:16:26 +0000 (15:16 +0200)]
lvchange: backup final metadata

Shift backup after final metadata commit.

Synchronize with wiping.

9 years agotools: common handling of --persistent option
Zdenek Kabelac [Fri, 19 Sep 2014 12:57:02 +0000 (14:57 +0200)]
tools: common handling of --persistent option

Move common code for reading and processing
of --persistent arguments for lvcreate and lvchange
into lvmcmdline.

Reuse validate_major_minor() routine for validation.

Don't blindly activate LVs after change in cluster
and instead only local reactivation is supported.
(we have now many limited targets now).

Dropping 'sigint_caught()' handling, since
prompt() is resolving this case itself.

9 years agometadata: validate major, minor numbers
Zdenek Kabelac [Fri, 19 Sep 2014 12:51:41 +0000 (14:51 +0200)]
metadata: validate major, minor numbers

Validate major, minor numbers after reading them from metadata.

This page took 0.072951 seconds and 5 git commands to generate.