]> sourceware.org Git - lvm2.git/log
lvm2.git
8 years agoWHATS_NEW
Alasdair G Kergon [Thu, 18 Feb 2016 00:01:02 +0000 (00:01 +0000)]
WHATS_NEW

8 years agolvmdbus: Add new daemon.
Alasdair G Kergon [Wed, 17 Feb 2016 23:53:35 +0000 (23:53 +0000)]
lvmdbus: Add new daemon.

8 years agoman: fix list of restricted LV name suffixes
Peter Rajnoha [Wed, 17 Feb 2016 14:38:27 +0000 (15:38 +0100)]
man: fix list of restricted LV name suffixes

8 years agometadata: add missing _repair_inconsinstent_vg call during PV ext repair
Peter Rajnoha [Tue, 16 Feb 2016 14:50:32 +0000 (15:50 +0100)]
metadata: add missing _repair_inconsinstent_vg call during PV ext repair

8 years agometadata: do not repair missing PV_EXT_USED flag for PVs belonging to foreign VG
Peter Rajnoha [Tue, 16 Feb 2016 12:55:31 +0000 (13:55 +0100)]
metadata: do not repair missing PV_EXT_USED flag for PVs belonging to foreign VG

The host that owns foreign VGs is responsible for fixing up PV_EXT_USED
flag - the same already applies to repairing any inconsistent VG.

This patch also moves the iteration over vg->pvs inside
_check_or_repair_pv_ext fn - it's cleaner this way.

8 years agorefactor: add common _is_foreign_vg fn
Peter Rajnoha [Tue, 16 Feb 2016 12:44:48 +0000 (13:44 +0100)]
refactor: add common _is_foreign_vg fn

8 years agopv: use pv->fmt to check for fake PVs, not pv->vg
Peter Rajnoha [Mon, 15 Feb 2016 14:50:11 +0000 (15:50 +0100)]
pv: use pv->fmt to check for fake PVs, not pv->vg

pv->vg is not set yet during pvcreate processing. Use pv->fmt instead to
check for these fake PVs (all normal PVs have format defined, devices
which are not PVs don't have this set).

This fixes commit 0000db7f98a07aa31c5b1cf13938b612e7f2821b.

8 years agocleanup: make the message about marked PVs consistent with the others
Peter Rajnoha [Mon, 15 Feb 2016 14:20:23 +0000 (15:20 +0100)]
cleanup: make the message about marked PVs consistent with the others

8 years agotoollib: skip PV if system ID is used and PV marked as used but metadata missing
Peter Rajnoha [Mon, 15 Feb 2016 14:11:54 +0000 (15:11 +0100)]
toollib: skip PV if system ID is used and PV marked as used but metadata missing

If we know that a PV belongs to some VG and we're missing metadata
(because we have only those PV(s) from VG present in the system that
don't have metadata areas), we should skip such PV when processing
under system ID.

This is because we know that the PV belongs to some VG, but we
really can't decide whether it matches system ID unless the VG
metadata is present again.

8 years ago pv: mark fake PVs as not used
Peter Rajnoha [Mon, 15 Feb 2016 13:46:31 +0000 (14:46 +0100)]
 pv: mark fake PVs as not used

Some of the PVs are not even orphan PVs - they're fake PVs - this can
happen if we're listing all devices with "pvs -a". Such PV must not
be marked as used.

8 years agocleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free...
Peter Rajnoha [Mon, 15 Feb 2016 12:30:37 +0000 (13:30 +0100)]
cleanup: use is_used_pv fn to detect whether PV is in use while reporting pv_free field

8 years agoWHATS_NEW: PV_EXT_USED flag and related
Peter Rajnoha [Mon, 15 Feb 2016 12:07:35 +0000 (13:07 +0100)]
WHATS_NEW: PV_EXT_USED flag and related

8 years agotests: fix tests checking pv_attr - there's a new bit now
Peter Rajnoha [Fri, 12 Feb 2016 11:05:59 +0000 (12:05 +0100)]
tests: fix tests checking pv_attr - there's a new bit now

8 years agotests: add pv-ext-flags.sh test
Peter Rajnoha [Tue, 7 Apr 2015 11:50:54 +0000 (13:50 +0200)]
tests: add pv-ext-flags.sh test

Testing PV extension flags. Currently, there's only one PV extension
flag present - the PV_EXT_USED flag (marking PV as used in a VG).

8 years agovg: automatically update to newest PV ext version during vg_write
Peter Rajnoha [Fri, 12 Feb 2016 13:22:02 +0000 (14:22 +0100)]
vg: automatically update to newest PV ext version during vg_write

8 years agoformat: format_text: add pv_needs_rewrite to format_handler and implemention for...
Peter Rajnoha [Fri, 12 Feb 2016 12:53:06 +0000 (13:53 +0100)]
format: format_text: add pv_needs_rewrite to format_handler and implemention for format_text

8 years agoreport: identify used PVs in pv_attr field with 'u' char
Peter Rajnoha [Thu, 11 Feb 2016 14:34:05 +0000 (15:34 +0100)]
report: identify used PVs in pv_attr field with 'u' char

8 years agoreport: always display 0 for pv_free field if we don't have any mda and PV is marked...
Peter Rajnoha [Thu, 11 Feb 2016 14:00:43 +0000 (15:00 +0100)]
report: always display 0 for pv_free field if we don't have any mda and PV is marked as used at the same time

8 years agobackup: backup_restore_vg: register PVs that need writing via vg->pvs_to_write list
Peter Rajnoha [Thu, 26 Mar 2015 13:20:46 +0000 (14:20 +0100)]
backup: backup_restore_vg: register PVs that need writing via vg->pvs_to_write list

The backup_restore_vg is used directly for restoring the VG from backup.
It's also used to do the VG conversions from one metadata format to
another which means vgconvert calls backup_restore_vg too.

When restoring VG from backup, we need to rewrite/write PV headers as
PVs may have been orphans before and now they're becoming part of some
VG - we need to write the PV_EXT_USED flag at least.

When using the backup_restore_vg for vgconvert, we need to write
completely new PV header in different format.

Avoid the special "pv_write" call and handling that was used before
this patch in vgconvert (vgconvert_single function to be more precise)
and reuse existing internal interface to register PV header for writing
(or rewriting) via vg->pvs_to_write list instead like we do it elsewhere
in the code.

This patch also resolves a problem in which PV headers with target
format were written in the vgconvert_single fn as orphans and VG
metadata were added later on - this was a tiny hack actually.
We can't do this now - we need to write the PV as belonging
to a VG because otherwise the PV_EXT_USED flag won't be written
properly (if the PV header is written as orphan, the PV_EXT_USED
is set to 0, of course, even though metadata are attached later).
So this patch removes this tiny inconsistency which was passing
just fine before because we didn't have any relation to the VG
in PV header before. Now we have the PV_EXT_USED flag which says
the "PV is used in some VG".

8 years agometadata: _vg_read: check if PV_EXT_USED flag is set correctly for non-orphan PVs...
Peter Rajnoha [Thu, 19 Mar 2015 06:53:22 +0000 (07:53 +0100)]
metadata: _vg_read: check if PV_EXT_USED flag is set correctly for non-orphan PVs and do a repair if needed

The same check as we already do for orphan PVs, just the other way
round now: if the PV is surely part of some VG and any PV the VG
contains does not have the PV_EXT_USED flag set, repair it.

For example - /dev/sda here is in VG vg and it's incorrectly not
marked as used by PV_EXT_USED flag:

pvs --binary -o pv_ext_vsn,pv_in_use
  WARNING: Volume Group vg is not consistent.
  WARNING: Repairing Physical Volume /dev/sda that is in Volume Group vg but not marked as used.
  PV         VG     Fmt  Attr PSize   PFree   ExtVsn PInUse
  /dev/sda   vg     lvm2 a--  124.00m 124.00m      2      1

8 years agoreport: add pv_ext_vsn field to display PV header extension version used
Peter Rajnoha [Tue, 17 Mar 2015 08:49:08 +0000 (09:49 +0100)]
report: add pv_ext_vsn field  to display PV header extension version used

For example:

$ pvs -o pv_name,vg_name,pv_ext_vsn,pv_in_use
  PV         VG     ExtVsn InUse
  /dev/sda               2
  /dev/sdb   vg          2    used
  /dev/vda2  fedora      1    used

8 years agometadata: check for PV extension version before doing any checks on PV extension...
Peter Rajnoha [Mon, 16 Mar 2015 17:23:43 +0000 (18:23 +0100)]
metadata: check for PV extension version before doing any checks on PV extension flags

PV header extension versions:
  0 - the original PV without any extensions
  1 - bootloader area support added
  2 - PV_EXT_USED flag support added

So do the associated checks related to PV_EXT_USED flag only if
PV header extension found is of version 2 and higher.

8 years agometadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and...
Peter Rajnoha [Wed, 11 Mar 2015 15:18:42 +0000 (16:18 +0100)]
metadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and do a repair if needed

If we know that the PV is orphan, meaning there's at least one MDA on
that PV which does not reference any VG and at the same time there's
PV_EXT_USED flag set, we're certainly in an inconsistent state and we
need to fix this.

For example, such situation can happen during vgremove/vgreduce if we
removed/reduced the VG, but we haven't written PV headers yet because
vgremove stopped abruptly for whatever reason just before writing new
PV headers with updated state, including PV extension flags (and so the
PV_EXT_USED flag).

However, in case the PV has no MDAs at all, we can't double-check
whether the PV_EXT_USED is correct or not - if that PV is marked
as used, it's either:
  - really used (but other disks with MDAs are missing)
  - or the error state as described above is hit

User needs to overwrite the PV header directly if it's really clear
the PV having no MDAs does not belong to any VG and at the same time
it's still marked as being in use (pvcreate -ff <dev_name> will fix this).

For example - /dev/sda here has 1 MDA, orphan and is incorrectly marked
with PV_EXT_USED flag:

$ pvs --binary -o+pv_in_use
  WARNING: Found inconsistent standalone Physical Volumes.
  WARNING: Repairing flag incorrectly marking Physical Volume /dev/sda as used.
  PV         VG     Fmt  Attr PSize   PFree   InUse
  /dev/sda          lvm2 ---  128.00m 128.00m     0

8 years agoreport: add pv_in_use field to display whether PV is in use or not
Peter Rajnoha [Tue, 10 Mar 2015 15:10:16 +0000 (16:10 +0100)]
report: add pv_in_use field to display whether PV is in use or not

For example:

$ pvs -o pv_name,vg_name,pv_in_use
  PV         VG     InUse
  /dev/sda   vg      used
  /dev/sdb
  /dev/sdc           used

(sda is part of vg - it's used
 sdb is not part of vg - it's not used
 sdc is part of vg, but MDAs missing - it's used)

8 years agopv: _pvcreate_write: do label removal and zeroing only if creating a new PV
Peter Rajnoha [Thu, 12 Mar 2015 14:18:52 +0000 (15:18 +0100)]
pv: _pvcreate_write: do label removal and zeroing only if creating a new PV

8 years agopv: issue different message of different type when we're overwriting existing PV...
Peter Rajnoha [Tue, 10 Mar 2015 13:19:20 +0000 (14:19 +0100)]
pv: issue different message of different type when we're overwriting existing PV header instead of creating a new one

Scenario:

$ pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created

We're adding the PV to a VG.

Before this patch:
$ vgcreate vg /dev/sda
  Physical volume "/dev/sda" successfully created
  Volume group "vg" successfully created

With this path applied:
$ vgcreate vg /dev/sda
  Volume group "vg" successfully created

...and verbose log containing: "Physical volume "/dev/sda" successfully written"

8 years agopv: check for the PV_EXT_USED flag and deny pvcreate/pvchange/pvremove/vgcreate on...
Peter Rajnoha [Tue, 10 Mar 2015 10:25:14 +0000 (11:25 +0100)]
pv: check for the PV_EXT_USED flag and deny pvcreate/pvchange/pvremove/vgcreate on such PV (unless forced)

Make sure we won't use a PV that is already marked as used. Normally,
VG metadata would stop us from doing that, but we can run into a
situation where such metadata is missing because PVs with MDAs
are missing and the PVs left are the ones with 0 MDAs.

(/dev/sda in this example has 0 MDAs and it belongs to a VG,
but other PVs with MDA are missing)

$ pvs -o pv_name,pv_mda_count /dev/sda
  PV         #PMda
  /dev/sda       0

$ pvcreate /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Can't initialize PV '/dev/sda' without -ff.

$ pvchange -u /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Can't change PV '/dev/sda' without -ff.
  Physical volume /dev/sda not changed
  0 physical volumes changed / 1 physical volume not changed

$ pvremove /dev/sda
  PV '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  (If you are certain you need pvremove, then confirm by using --force twice.)

$ vgcreate vg /dev/sda
  Physical volume '/dev/sda' is marked as belonging to a VG but its metadata is missing.
  Unable to add physical volume '/dev/sda' to volume group 'vg'.

8 years agopv: format-text: store PV_EXT_USED flag if PV is used and unset it otherwise
Peter Rajnoha [Fri, 12 Feb 2016 09:59:27 +0000 (10:59 +0100)]
pv: format-text: store PV_EXT_USED flag if PV is used and unset it otherwise

When adding a PV to VG, set the PV_EXT_USED flag in PV header and
vice versa - if the PV is no longer in a VG, unset the flag.

8 years agometadata: schedule PV for header rewrite if adding a PV to VG or restoring VG
Peter Rajnoha [Thu, 12 Mar 2015 13:49:10 +0000 (14:49 +0100)]
metadata: schedule PV for header rewrite if adding a PV to VG or restoring VG

When adding PV to VG, we need to rewrite PV header as there's a flip
in PV_EXT_USED flag. The same applies if we're restoring VG from backup.

8 years agometadata: add_pv_to_vg: add 'new_pv' arg to state if the PV is about to be created
Peter Rajnoha [Thu, 12 Mar 2015 13:37:50 +0000 (14:37 +0100)]
metadata: add_pv_to_vg: add 'new_pv' arg to state if the PV is about to be created

8 years agopv: add is_used_pv fn
Peter Rajnoha [Fri, 12 Feb 2016 09:17:18 +0000 (10:17 +0100)]
pv: add is_used_pv fn

8 years agolvmcache/lvmetad: cache PV extension version
Peter Rajnoha [Thu, 11 Feb 2016 15:25:36 +0000 (16:25 +0100)]
lvmcache/lvmetad: cache PV extension version

Store PV extension version in lvmcache/lvmetad for use throughout the code.

8 years agolvmcache/lvmetad: cache PV extension flags
Peter Rajnoha [Mon, 9 Mar 2015 11:52:07 +0000 (12:52 +0100)]
lvmcache/lvmetad: cache PV extension flags

Store PV extension flags in lvmcache/lvmetad for use throughout the code.

8 years agometadata: introduce PV_EXT_USED flag and bump PV_HEADER_EXTENSION_VSN
Peter Rajnoha [Fri, 12 Feb 2016 12:20:34 +0000 (13:20 +0100)]
metadata: introduce PV_EXT_USED flag and bump PV_HEADER_EXTENSION_VSN

8 years agoformat: add FMT_PV_FLAGS to indicate format supports PV flags
Peter Rajnoha [Fri, 12 Feb 2016 11:58:59 +0000 (12:58 +0100)]
format: add FMT_PV_FLAGS to indicate format supports PV flags

8 years agorefactor: rename struct pv_to_create --> struct pv_to_write
Peter Rajnoha [Mon, 9 Mar 2015 11:29:30 +0000 (12:29 +0100)]
refactor: rename struct pv_to_create --> struct pv_to_write

We'll use this struct in subsequent patches for PVs which should
be rewritten, not just created. So rename struct pv_to_create to
struct pv_to_write for clarity.

8 years agopost-release
Alasdair G Kergon [Mon, 15 Feb 2016 10:48:55 +0000 (10:48 +0000)]
post-release

8 years agopre-release v2_02_142
Alasdair G Kergon [Mon, 15 Feb 2016 10:35:16 +0000 (10:35 +0000)]
pre-release

8 years agoman: pvresize: remove old comment about inability to resize PV with more mdas
Peter Rajnoha [Fri, 12 Feb 2016 15:29:39 +0000 (16:29 +0100)]
man: pvresize: remove old comment about inability to resize PV with more mdas

8 years agotests: indent
Zdenek Kabelac [Fri, 12 Feb 2016 10:59:42 +0000 (11:59 +0100)]
tests: indent

Better bash indention

8 years agopvmove: fix possible memory pool corruption
Ondrej Kozina [Fri, 12 Feb 2016 10:34:26 +0000 (11:34 +0100)]
pvmove: fix possible memory pool corruption

This is a hotfix for a bug introduced in
6d7dc87cb356162f912b13c8a0cd198037c0226b.

The bug description: First we allocate memory for
processing handle (at an address 1) then we
allocate some memory on the same pool for later use
in pvmove_poll function inside the process_each_pv
function (at an address 2). After we jump out of
process_each_pv we called destroy_processing_handle.
As a result of destroying the handle memory pool could
deallocate all memory at address 1 or higher. The
pvmove_poll function tried to copy a memory allocated
at address 2 that could be returned to the system.
If it was so it led to segfault.

We need to rethink proper fix but in the same time
cmd->mem pool is recreated per each lvm command so
this should not cause problems even when we run
multiple commands in lvm shell.

A valgrind snapshot of the corruption:

Invalid read of size 1
    at 0x4C29F92: strlen (mc_replace_strmem.c:403)
    by 0x5495F2E: dm_pool_strdup (pool.c:51)
    by 0x1592A7: _create_id (pvmove.c:774)
    by 0x159409: pvmove_poll (pvmove.c:796)
    by 0x1599E3: pvmove (pvmove.c:931)
    by 0x15105B: lvm_run_command (lvmcmdline.c:1655)
    by 0x1523C3: lvm2_main (lvmcmdline.c:2121)
    by 0x1754F3: main (lvm.c:22)
Address 0xf15df8a is 138 bytes inside a block of size 8,192 free'd
    at 0x4C28430: free (vg_replace_malloc.c:446)
    by 0x5494E73: dm_free_wrapper (dbg_malloc.c:357)
    by 0x5495DE2: _free_chunk (pool-fast.c:318)
    by 0x549561C: dm_pool_free (pool-fast.c:151)
    by 0x164451: destroy_processing_handle (toollib.c:1837)
    by 0x1598C1: pvmove (pvmove.c:903)
    by 0x15105B: lvm_run_command (lvmcmdline.c:1655)
    by 0x1523C3: lvm2_main (lvmcmdline.c:2121)
    by 0x1754F3: main (lvm.c:22)

8 years agotests: update test
Zdenek Kabelac [Fri, 12 Feb 2016 09:21:07 +0000 (10:21 +0100)]
tests: update test

Upgrade test to count with much faster dmeventd work thanks
to low_watter_mark support.

Fix some wrong tests.

8 years agogcc: better code for older compiler
Zdenek Kabelac [Fri, 12 Feb 2016 09:17:39 +0000 (10:17 +0100)]
gcc: better code for older compiler

Address this gcc warning:

metadata/lv.c:243: warning: initialized field overwritten
metadata/lv.c:243: warning: (near initialization for 'status.seg_status')

Present with e.g.: gcc version 4.3.2 (Debian 4.3.2-1.1)

8 years agotests: check for automated dmeventd resize
Zdenek Kabelac [Thu, 11 Feb 2016 17:05:58 +0000 (18:05 +0100)]
tests: check for automated dmeventd resize

Watermark support should handle relatively quickly data LV resizes.
So check if it does what is expected.

8 years agodebug: cut_and_paste type in message
M.H. Tsai [Wed, 27 Jan 2016 11:11:03 +0000 (19:11 +0800)]
debug: cut_and_paste type in message

Typo in debug message.

8 years agocleanup: update messages
Zdenek Kabelac [Mon, 8 Feb 2016 12:08:54 +0000 (13:08 +0100)]
cleanup: update messages

8 years agocleanup: drop unneeded assigns
Zdenek Kabelac [Mon, 8 Feb 2016 12:14:43 +0000 (13:14 +0100)]
cleanup: drop unneeded assigns

8 years agocleanup: relocate function to vg.c
Zdenek Kabelac [Mon, 8 Feb 2016 11:53:54 +0000 (12:53 +0100)]
cleanup: relocate function to vg.c

8 years agocleanup: stripes_extents
Zdenek Kabelac [Fri, 22 Jan 2016 15:11:29 +0000 (16:11 +0100)]
cleanup: stripes_extents

Simplify calculation of extents rounding needed for
segment size.

Segment size has to divisible by 'extent count' needed to contain
whole stripe. LVM currently does not support stripes across segment.

In case the stripe size is bigger then extent size,
require bigger rounding.

8 years agocleanup: rename usepolicies
Zdenek Kabelac [Mon, 8 Feb 2016 12:09:37 +0000 (13:09 +0100)]
cleanup: rename usepolicies

Switch to ARG name without '_' in the middle (like all others args).

8 years agolvresize: check for given parameters
Zdenek Kabelac [Fri, 22 Jan 2016 12:08:13 +0000 (13:08 +0100)]
lvresize: check for given parameters

Check ac_ value as passed args.
Also drop reseting 'computed' values - since they get
assigned values later.

8 years agodm: alloc always 8byte aligned
Zdenek Kabelac [Thu, 11 Feb 2016 11:00:28 +0000 (12:00 +0100)]
dm: alloc always 8byte aligned

Fixing regression caused by 197b5e6dc7dd8ec161ebe43c97fd2ac8384b3433.
So the 'TODO' part now finally know the answer - there is 'sparc64'
architecture which imposes limitation to read 64b words only through
64b aligned address.

Since we never could know how is the user going to use the returned
pointer and the userusually expects it's aligned on the highest CPU
required alignement, preserve it also for char*.

Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809685
Reported-by: Anatoly Pugachev <matorola@gmail.com>
8 years agodm: fix thin-pool targer params order
M.H. Tsai [Wed, 27 Jan 2016 11:11:03 +0000 (19:11 +0800)]
dm: fix thin-pool targer params order

Wrong thin-pool feature flag ordering in dm table: It will lead to
unnecessary table reload.

Fix it by placeing feature flags in order they are returned from the
kernel so current 'table line diff' code will not see a difference.

8 years agolvconvert: enable spare creation during conversion
M.H. Tsai [Wed, 27 Jan 2016 11:11:03 +0000 (19:11 +0800)]
lvconvert: enable spare creation during conversion

Let user control pool metadata spare creation after repair as
the VG might not have enough free space.

8 years agoconfig: fix verbose type to int
M.H. Tsai [Wed, 27 Jan 2016 11:11:03 +0000 (19:11 +0800)]
config: fix verbose type to int

'verbose' was marked as a boolean option while it
takes integer args - so it has limited usage to 0 or 1,
but we supported 0-4 at least.

Fix it by switching to corrent int type.
(Hopefully noone was trying to use this variable as true/yes/false/no
way - as the would be unsupported/undocumented).

8 years agothin: fix low_water_mark threshold calc
Zdenek Kabelac [Thu, 11 Feb 2016 17:05:36 +0000 (18:05 +0100)]
thin: fix low_water_mark threshold calc

Reporter noticed lvm2 incorrectly translated
lvm2 threshold value to  water mark in commit:
99237f0908d87592815f4bdf3c239e8a108e835c

Fix it by properly translating size to number of
blocks in thin-pool and then calc for free blocks
matching configured lvm2 threshold value.

Reported-by: Ming-Hung Tsai <mingnus@gmail.com>
8 years agoconf: use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in
Peter Rajnoha [Wed, 10 Feb 2016 13:53:10 +0000 (14:53 +0100)]
conf: use use_blkid_wiping=0 if not defined in lvm.conf and support not compiled in

Normally, we generate and provide lvm.conf file where use_blkid_wiping
is set based on whether support for this is compiled in or not. This was
generated properly based on configure.

However, if lvm.conf is not used at all (someone deletes it) or the value
in lvm.conf is commented out (user edited it), we still need to use
proper default value that is based on DEFAULT_USE_BLKID_WIPING taken
from configure script - we used hardcoded value of "1" in this case
by mistake.

8 years agofilter: do not check for suspended devs in filter-usable in lvmetad mode
Peter Rajnoha [Wed, 3 Feb 2016 13:40:52 +0000 (14:40 +0100)]
filter: do not check for suspended devs in filter-usable in lvmetad mode

We already do check for suspended devs within udev rules where
the pvscan is to update lvmetad. So the check for suspended devs
in "pre-lvmetad" chain is not useful here - remove it - it may
be a source of hardly to detect races anyway (if udev rule detects
the device is not suspended and then the pvscan instance sees the
dev as suspended, we may end up not reacting to the event properly).

8 years agometadata: format: also delete bootloader areas from lvmcache when reading lvm1 and...
Peter Rajnoha [Tue, 2 Feb 2016 12:54:19 +0000 (13:54 +0100)]
metadata: format: also delete bootloader areas from lvmcache when reading lvm1 and pool label

lvm1 and pool format do not support bootloader areas and we need to
remove any existing associated bootloader areas when we read lvm1 and
pool labels.

This has its importance if we're converting from one format to another
and we're reusing lvmcache in long-running commands (e.g. clvmd or lvm
shell) and we need to make lvmcache consistent and valid for current format.

8 years agofilters: partitioned: fix partition table filter with external_device_info_source...
Peter Rajnoha [Tue, 2 Feb 2016 12:28:11 +0000 (13:28 +0100)]
filters: partitioned: fix partition table filter with external_device_info_source="udev" and blkid<2.20

Non-dm devices have ID_PART_TABLE_TYPE variable exported in
udev db from blkid scan for *both* whole devices and partitions.
We used ID_PART_ENTRY_DISK in addition to decide whether this
is the whole device or partition and then we filtered out only
whole devices where the partition table really is.

However, ID_PART_ENTRY_DISK was added in blkid 2.20 so we need
to use a different set of variables to decide on whole devices
and partitions on systems where older blkid is still used.

Now, we use ID_PART_TABLE_TYPE to detect that there's something
related to partitioning with this device and we use DEVTYPE variable
instead to decide between whole device (DEVTYPE="disk") and partition
(DEVTYPE="partition").

For dm devices it's simpler, we have ID_PART_TABLE_TYPE variable\
set in udev db for whole devices. It's not set for partitions,
hence we don't need more variable in addition to make the decision
on whole device vs. partition (dm devices do not have regular
partitions, hence DEVTYPE can't be used anyway, it's always set
to "disk" for whole disks and partitions).

8 years agolvmlockd: don't adopt locks from unused lm
David Teigland [Thu, 28 Jan 2016 15:42:45 +0000 (09:42 -0600)]
lvmlockd: don't adopt locks from unused lm

When built without dlm or sanlock support, don't
attempt to adopt locks from that lm.

8 years agopost-release
Alasdair G Kergon [Mon, 25 Jan 2016 01:12:27 +0000 (01:12 +0000)]
post-release

8 years agopre-release v2_02_141
Alasdair G Kergon [Mon, 25 Jan 2016 01:08:16 +0000 (01:08 +0000)]
pre-release

8 years agotests: add pv-check-dev-size.sh
Peter Rajnoha [Fri, 22 Jan 2016 12:58:35 +0000 (13:58 +0100)]
tests: add pv-check-dev-size.sh

8 years agoconf: add metadata/check_pv_device_sizes
Peter Rajnoha [Fri, 22 Jan 2016 12:20:21 +0000 (13:20 +0100)]
conf: add metadata/check_pv_device_sizes

8 years agometadata: check PV dev size is not less than PV size
Peter Rajnoha [Fri, 22 Jan 2016 10:37:09 +0000 (11:37 +0100)]
metadata: check PV dev size is not less than PV size

8 years agolvmcache: invalidate all cached dev sizes if all VGs got unlocked
Peter Rajnoha [Fri, 22 Jan 2016 10:13:00 +0000 (11:13 +0100)]
lvmcache: invalidate all cached dev sizes if all VGs got unlocked

8 years agodevice: also cache device size
Peter Rajnoha [Fri, 15 Jan 2016 15:41:27 +0000 (16:41 +0100)]
device: also cache device size

Add "size" and "size_seqno" to struct device to cache device's size
and also to control its lifetime - the cached value is valid as long
as the global _dev_size_seqno is equal to the device's size_seqno,
otherwise we need to get the size again and cache the new value.

This patch also adds new dev_size_seqno_inc() fn for the appropriate
parts of the code to increment current global value of _dev_size_seqno
and hence to cause all currently cached values for device sizes to
be invalidated.

The device size is now cached because we're planning to reuse this
information for further checks and we want to avoid checking it more
than necessary to save resources.

8 years agolvmlockd: remove noisy log_debug
David Teigland [Thu, 21 Jan 2016 20:37:15 +0000 (14:37 -0600)]
lvmlockd: remove noisy log_debug

The debug message appeared even when lvmlockd was not used,
and the lockd operation was simply being skipped.

8 years agovgimportclone: fix VG name variable reference in error message after failed PV uuid...
Peter Rajnoha [Thu, 21 Jan 2016 13:47:48 +0000 (14:47 +0100)]
vgimportclone: fix VG name variable reference in error message after failed PV uuid change

8 years agocleanup: add missing prototype
Zdenek Kabelac [Thu, 21 Jan 2016 12:25:56 +0000 (13:25 +0100)]
cleanup: add missing prototype

Commit 2304286f68debd4755b44fa8b779b762142bfada
missed to add function prototype.

8 years agotoollib: restore command break support
Zdenek Kabelac [Thu, 21 Jan 2016 12:19:27 +0000 (13:19 +0100)]
toollib: restore command break support

Fix regression caused by c9f021de0b4d2c873ef5b97d17c602d0380359fd.
This commit actually transfered real-action (e.g. device removal)
into the next loop which has however missed to check for break.
So add check for break also there.

8 years agotoollib: use cmd mempool for list
Zdenek Kabelac [Thu, 21 Jan 2016 12:18:11 +0000 (13:18 +0100)]
toollib: use cmd mempool for list

When creating a list in 'context of command' - use proper mempool.

vg->vgmem is mempool related to VG metadata - and can be eventually
locked read-only when VG struct is shared.

8 years agodoc: change fsf address
Zdenek Kabelac [Thu, 21 Jan 2016 10:49:46 +0000 (11:49 +0100)]
doc: change fsf address

Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date

8 years agocleanup: join if/else
Zdenek Kabelac [Thu, 21 Jan 2016 09:16:16 +0000 (10:16 +0100)]
cleanup: join if/else

8 years agoman: show hidden pieces
Zdenek Kabelac [Thu, 21 Jan 2016 10:31:18 +0000 (11:31 +0100)]
man: show hidden pieces

W: manual-page-warning /usr/share/man/man8/lvm.8.gz 491: warning: macro `_cdata',' not defined

rpmlint actually notices we had few hidden word in man page.
the line cannot start with apostrophe as it has then a different
meaning.

8 years agoman: dmsetup
Zdenek Kabelac [Thu, 21 Jan 2016 10:36:26 +0000 (11:36 +0100)]
man: dmsetup

Typo in CMD_UDEVCREATECOOKIE macro name noticed by rpmlint.

8 years agoconfigure: fix configure to set proper use_blkid_wiping if autodetected as disabled
Peter Rajnoha [Thu, 21 Jan 2016 08:56:07 +0000 (09:56 +0100)]
configure: fix configure to set proper use_blkid_wiping if autodetected as disabled

If not using explicit --enable-blkid-wiping/--disable-blkid-wiping
configure option, the configure script tries to enable/disable blkid
wiping feature automatically based on blkid library version found.

The script incorrectly set default value for lvm.conf's
allocation/use_blkid_wiping" setting to "1" (enabled) if proper
blkid library version was not found or the version found was less
than the minimum required. It should be set to "0" in this case.

8 years agocleanup: reformat sentence about max sizes
Zdenek Kabelac [Tue, 19 Jan 2016 15:07:39 +0000 (16:07 +0100)]
cleanup: reformat sentence about max sizes

The extent size must fits all blocks in 4294967295 sectors
(in 512b units) this is 1/2 KiB less then 2TiB.

So while previous statement 'suggested' 2TiB is still acceptable value,
make it clear it's not.

As now we support any multiples of 128KB as extent size -
values like 2047G will still 'flow-in' otherwise the largest power-of-2
supported value is 1TiB.

With 1TiB user needs 8388608 extents for 8EiB device.
(FYI such device is already unusable with todays glibc-2.22.90-27)

4GiB extent size is currently the smallest extent size which allows
a user to create 8EiB devices (with 2GiB  it's less then 8EiB).

TODO: lvm2 may possibly print amount of 'lost/unused space' on a PV,
since using such ridiculously sized extent size may result in huge
space being left unaccessible.

8 years agocleanup: drop extra cmd passed arg
Zdenek Kabelac [Mon, 18 Jan 2016 22:24:32 +0000 (23:24 +0100)]
cleanup: drop extra cmd passed arg

Use vg->cmd when needed cmd struct.

8 years agocleanup: relocate size assign
Zdenek Kabelac [Mon, 18 Jan 2016 22:22:48 +0000 (23:22 +0100)]
cleanup: relocate size assign

Directly set thin-pool size when thin data LV size changes.

8 years agocleanup: adjust once
Zdenek Kabelac [Tue, 19 Jan 2016 10:44:11 +0000 (11:44 +0100)]
cleanup: adjust once

8 years agocleanup: update check function
Zdenek Kabelac [Fri, 15 Jan 2016 13:41:02 +0000 (14:41 +0100)]
cleanup: update check function

Use display_lvname().
Use lv_is_lockd_sanlock_lv().
Order  'error' checks ahead of 'ignore' ones.

8 years agocleanup: shuffle check of threshold
Zdenek Kabelac [Fri, 15 Jan 2016 13:39:58 +0000 (14:39 +0100)]
cleanup: shuffle check of threshold

Check first threshold and then policy_amount.

8 years agocleanup: use log_print
Zdenek Kabelac [Fri, 15 Jan 2016 09:35:10 +0000 (10:35 +0100)]
cleanup: use log_print

Using log_print for ignoring message instead of log_warn.
Add some missing '.'.

8 years agoactivation: remote node check doesn't work yet
Alasdair G Kergon [Wed, 20 Jan 2016 02:54:11 +0000 (02:54 +0000)]
activation: remote node check doesn't work yet

8 years agoclvmd: Initialise udev.
Alasdair G Kergon [Wed, 20 Jan 2016 00:58:09 +0000 (00:58 +0000)]
clvmd: Initialise udev.

Since commit 2fc126b00d83991c6a2f3ed9aa61457294a4c45e, the library
code requires udev to be initialised for device scanning and
clvmd can fail to find VGs if devices/external_device_info_source
is set to "udev".

8 years agoactivation: Add lv_is_active_remotely.
Alasdair G Kergon [Tue, 19 Jan 2016 22:01:59 +0000 (22:01 +0000)]
activation: Add lv_is_active_remotely.

8 years agolocking: Add node parameter to query_resource.
Alasdair G Kergon [Tue, 19 Jan 2016 21:42:22 +0000 (21:42 +0000)]
locking: Add node parameter to query_resource.

8 years agoman: mention GPT id for LVM in pvcreate man page
Peter Rajnoha [Tue, 19 Jan 2016 14:28:44 +0000 (15:28 +0100)]
man: mention GPT id for LVM in pvcreate man page

8 years agoreport: fix off-by-one error when reporting LV segment's metadata device extent count
Peter Rajnoha [Tue, 19 Jan 2016 13:42:51 +0000 (14:42 +0100)]
report: fix off-by-one error when reporting LV segment's metadata device extent count

Commit a3f484f812bfb89063fbc25e378f34cacd50bf7d used "-1" two times by
mistake for the extent count when reporting seg_metadata_le_ranges.

8 years agoreport: add note about seg_pe_ranges and seg_le_ranges in -o help
Peter Rajnoha [Tue, 19 Jan 2016 12:53:30 +0000 (13:53 +0100)]
report: add note about seg_pe_ranges and seg_le_ranges in -o help

8 years agoreport: add seg_le_ranges report field
Peter Rajnoha [Tue, 19 Jan 2016 12:51:11 +0000 (13:51 +0100)]
report: add seg_le_ranges report field

8 years agoreport: make devices, metadata_devices, seg_pe_ranges and seg_metadata_le_ranges...
Peter Rajnoha [Tue, 19 Jan 2016 11:26:01 +0000 (12:26 +0100)]
report: make devices, metadata_devices, seg_pe_ranges and seg_metadata_le_ranges fields consistent

There are two basic groups of fields for LV segment device reporting:
  - related to LV segment's devices: devices and seg_pe_ranges
  - related to LV segment's metadata devices: metadata_devices and seg_metadata_le_ranges

The devices and metadata_devices report devices in this format:
    "device_name(extent_start)"

The seg_pe_ranges and seg_metadata_le_ranges report devices in
this format:
    "device_name:extent_start-extent_end"

This patch reverts partly what commit 7f74a995029caa41ee3cf9aec0bd024a34bfd89a
(v 2.02.140) introduced in this area - it added [] for
hidden devices to mark them for all four fields mentioned above.

We won't be marking hidden devices in devices and metadata_devices
fields.

The seg_metadata_le_ranges field will have hidden devices marked -
it's new enough that we don't need to care about compatibility much
yet.

The seg_pe_ranges is old enough that we shouldn't be changing this
one - so we're reverting to not marking hidden devices here.
Instead, there's going to be a new field "seg_le_ranges" which
is going to replace the seg_pe_ranges and it will mark hidden devices -
this is going to be introduced in a patch later.

So in the end we'll end up with:

   (LV segment's devices)
   devices field with "device_name(extent_start)" format, not marking hidden devices
   seg_pe_ranges field with "device_name:extent_start-extent_end" format, not marking hidden devices (deprecated, new seg_le_ranges should be used instead for standardized format)
   seg_le_ranges field with "device_name:extent_start-extent_end" format, marking hidden devices

   (LV segment's metadata devices)
   metadata_devices field with "device_name:extent_start-extent_end" format, not marking hidden devices
   seg_metadata_le_ranges field with "device_name:extent_start-extent_end" format, marking hidden devices

Also, both seg_le_ranges and seg_metadata_le_ranges will honour the
report/list_item_separator setting which can be used to configure
the delimiter used for list items.

So, to sum it up, we will recommend using the new seg_le_ranges and
seg_metadata_le_ranges fields because they display devices with
standard extent range format, they can mark hidden devices and they
honour the report/list_item_separator setting.

We'll be keeping devices,seg_pe_ranges and metadata_devices fields
for compatibility.

8 years agoreport: change _format_pvsegs to return list instead of plain string, change associat...
Peter Rajnoha [Tue, 19 Jan 2016 11:24:02 +0000 (12:24 +0100)]
report: change _format_pvsegs to return list instead of plain string, change associated report fields from STR to STR_LIST

The associated devices,metadata_devices,seg_pe_ranges and
seg_metadata_le_ranges are reported as genuine string lists now.
This allows for using the items separately in -S|--select
(so searching for subsets etc.) and also it allows for
configuring the separator using report/list_item_separator
which may be useful in scripts (however, we'll enable this
only for seg_le_metadata_ranges and not for devices,seg_pe_ranges
and seg_metadata_devices for compatibility reasons - see following
patch).

8 years agorefactor: add 'delimiter' variable for non-default delimiter when reporting string...
Peter Rajnoha [Tue, 19 Jan 2016 10:50:41 +0000 (11:50 +0100)]
refactor: add 'delimiter' variable for non-default delimiter when reporting string list

8 years agolvconvert: disallow test mode in shared VG
David Teigland [Mon, 18 Jan 2016 22:53:14 +0000 (16:53 -0600)]
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.

8 years agotoollib: add comment about missing device
David Teigland [Mon, 18 Jan 2016 21:40:42 +0000 (15:40 -0600)]
toollib: add comment about missing device

Add a comment in _process_pvs_in_vg() to document the
place where there have been problems with processing
PVs twice.

For a while we had a hacky workaround here where we'd
skip processing a PV if its device wasn't found in
all_devices (and !is_missing_pv since we want to
process PVs with missing devices.).  That workaround
was removed in commit 5cd4d46f because it was no
longer needed.

The workaround had originally been needed to prevent
a device from being processed twice when the PV had
no MDAs -- it would be processed once in its real VG
and then the workaround would prevent it from being
processed a second time in the orphan VG.

Wrongly appearing as an orphan likely happened because
lvmcache would consider the no-MDA PV an orphan unless
the real VG holding that PV was also in lvmcache.
This issue is also mentioned in pvchange where holding
the global lock allows VGs to remain in lvmcache so
PVs with 0 mdas are not considered orphans.

The workaround in _process_pvs_in_vg() was originally
intended for reporting commands, not for pvchange.
But, it was accidentally helping pvchange also because
the method described by the pvchange global lock
comment had been subverted by commit 80f4b4b8.
Commit 80f4b4b8 was found to be unnecessary, and was
reverted in commit e710bac0.  This restored the
intended global lock lvmcache effect to pvchange, and
it no longer relied on the workaround in toollib.

8 years agoreport: Fix seg_pe_ranges LV sizes.
Alasdair G Kergon [Mon, 18 Jan 2016 22:04:43 +0000 (22:04 +0000)]
report: Fix seg_pe_ranges LV sizes.

When reporting on LVs, take the end of the range from the size of the
underlying (hidden) LV rather than the logical size of the current
segment (that PVs use).

8 years agopvmove: use toollib
David Teigland [Tue, 12 Jan 2016 20:57:52 +0000 (14:57 -0600)]
pvmove: use toollib

Previously, pvmove used the function find_pv_in_vg() which did the
equivalent of process_each_pv() by doing:

  find_pv_by_name() -> get_pvs() ->

  get_pvs_internal() -> _get_pvs() -> get_vgids() ->

  /* equivalent to process_each_pv */
  dm_list_iterate_items(vgids)
    vg = vg_read_internal()
    dm_list_iterate_items(&vg->pvs)

With the found 'pv', it would do vg_read() on pv_vg_name(pv),
and then do the actual pvmove processing.

This commit simplifies by using process_each_pv() and putting
the actual pvmove processing into the "single" function.
This eliminates both find_pv_by_name() and the vg_read().
The processing code that followed vg_read remains the same.

The return code for the pvmove command is not based on the
process_each_pv return code, but is based on the success/fail
conditions in the existing code.

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