]> sourceware.org Git - lvm2.git/log
lvm2.git
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.

8 years agoRevert "Revert "process_each_pv: remove unnecessary workaround""
David Teigland [Thu, 14 Jan 2016 19:47:44 +0000 (13:47 -0600)]
Revert "Revert "process_each_pv: remove unnecessary workaround""

This reverts commit 6d09c8c2c45ea1dea243134b8badc841a87cc979.

Try again to remove the workaround.

8 years agolvmlockd: cosemtic improvements to logging
David Teigland [Fri, 15 Jan 2016 21:34:49 +0000 (15:34 -0600)]
lvmlockd: cosemtic improvements to logging

Also pass our name to sanlock so it appears in
the sanlock status output.

8 years agolvmlockd: fix lvb validation for conversion
David Teigland [Fri, 15 Jan 2016 21:31:13 +0000 (15:31 -0600)]
lvmlockd: fix lvb validation for conversion

Make the lvb validation rules for convert match
those for unlock (even though it would be very
unlikely or impossible for convert to deal with
zero lvb.)

8 years agopvchange, pvresize: fix lockd_gl() usage
David Teigland [Fri, 15 Jan 2016 21:18:25 +0000 (15:18 -0600)]
pvchange, pvresize: fix lockd_gl() usage

When an orphan PV is changed/resized, the
lvmlockd global lock is converted from sh
to ex. If the command is changing two
orphan PVs, the conversion to ex should
be done only once.

8 years agoreport: add kernel_cache_settings field
Peter Rajnoha [Mon, 18 Jan 2016 13:32:17 +0000 (14:32 +0100)]
report: add kernel_cache_settings field

Existing cache_settings field displays the settings which are
saved in metadata. Add new kernel_cache_settings fields to display
the settings which are currently used by kernel, including fields
for which default values are used.

This way users have complete view of the set of cache settings
supported (and which they can set) and their values which are used
at the moment by kernel.

For example:

$  lvs -o name,cache_policy,cache_settings,kernel_cache_settings vg
  LV      Cache Policy Cache Settings                               KCache Settings
  cached1 mq    migration_threshold=1024,write_promote_adjustment=2 migration_threshold=1024,random_threshold=4,sequential_threshold=512,discard_promote_adjustment=1,read_promote_adjustment=4,write_promote_adjustment=2
  cached2 smq   migration_threshold=1024                            migration_threshold=1024
  cached3 smq   migration_threshold=2048

8 years agopost-release
Alasdair G Kergon [Sat, 16 Jan 2016 02:12:10 +0000 (02:12 +0000)]
post-release

8 years agopre-release v2_02_140
Alasdair G Kergon [Sat, 16 Jan 2016 02:11:21 +0000 (02:11 +0000)]
pre-release

8 years agolvm2app: fix lvm2app to return either 0 or 1 for lvm_vg_is_{clustered,exported}
Peter Rajnoha [Fri, 15 Jan 2016 13:39:43 +0000 (14:39 +0100)]
lvm2app: fix lvm2app to return either 0 or 1 for lvm_vg_is_{clustered,exported}

Fix lvm2app to return either 0 or 1 for lvm_vg_is_{clustered,exported},
including internal functions pvseg_is_allocated and vg_is_resizeable
which are not yet exposed in lvm2app but make them consistent with the
rest.

8 years agolvmlockd: fixes for test mode
David Teigland [Thu, 14 Jan 2016 21:57:09 +0000 (15:57 -0600)]
lvmlockd: fixes for test mode

Get the test mode working (lvmlockd running with no
lock manager).

8 years agoRevert "lvmcache: skip drop when vg_write lock is not held"
David Teigland [Thu, 14 Jan 2016 19:26:15 +0000 (13:26 -0600)]
Revert "lvmcache: skip drop when vg_write lock is not held"

This reverts e28e22b9e1e4f7243608aa24ddf43ec63afd1751
The problem that that commit was fixing (pytest failure)
no longer appears with the current code, so the commit is
not needed.

That commit is a problem for pvchange, because it prevents
lvmcache from retaining VG metadata even while the global
lock is held.  pvchange holds the global lock to ensure
that VG metadata is kept in lvmcache throughout processing.
If the cache is not kept, a PV with zero MDAs will appear
first in its actual VG and then appear again in the orphan VG.
It wrongly appears a second time in the orphan VG only if
the actual VG is dropped from lvmcache.

8 years agoreport: add kernel_discards report field to display thin pool discard used in kernel
Peter Rajnoha [Thu, 14 Jan 2016 15:54:12 +0000 (16:54 +0100)]
report: add kernel_discards report field to display thin pool discard used in kernel

Thin pool discard mode set in metadata can be different from the one
actually used if any device underneath does not support that mode. Add
kernel_discard report field to make it possible to see this difference.

8 years agoRevert "process_each_pv: remove unnecessary workaround"
David Teigland [Thu, 14 Jan 2016 15:12:57 +0000 (09:12 -0600)]
Revert "process_each_pv: remove unnecessary workaround"

This reverts commit be1b1f3d8941543bcde2f42e65ed0f22fd07b122.

8 years agolvmanip: fix last commit and drop else
Zdenek Kabelac [Thu, 14 Jan 2016 10:54:37 +0000 (11:54 +0100)]
lvmanip: fix last commit and drop else

In last commit when removing if() branch
this 'else' now has to be dropped.

8 years agocleanup: order ac members
Zdenek Kabelac [Thu, 14 Jan 2016 10:21:47 +0000 (11:21 +0100)]
cleanup: order ac members

8 years agocleanup: spaces
Zdenek Kabelac [Mon, 11 Jan 2016 13:11:37 +0000 (14:11 +0100)]
cleanup: spaces

8 years agocleanup: replace log_warn
Zdenek Kabelac [Fri, 8 Jan 2016 10:08:07 +0000 (11:08 +0100)]
cleanup: replace log_warn

8 years agocleanup: explicit prohibition for virtual segs
Zdenek Kabelac [Wed, 6 Jan 2016 12:54:15 +0000 (13:54 +0100)]
cleanup: explicit prohibition for virtual segs

Internal _alloc_init() is only called from allocate_extents(),
which already does prevent usage of virtual segments.

So mark as internal error early and do not process it any further.

8 years agocleanup: simplier formula
Zdenek Kabelac [Fri, 8 Jan 2016 10:07:47 +0000 (11:07 +0100)]
cleanup: simplier formula

8 years agocleanup: more readable check
Zdenek Kabelac [Tue, 15 Dec 2015 14:13:11 +0000 (15:13 +0100)]
cleanup: more readable check

8 years agosnapshot: relocate alloc_snapshot_seg
Zdenek Kabelac [Thu, 7 Jan 2016 11:16:18 +0000 (12:16 +0100)]
snapshot: relocate alloc_snapshot_seg

Move alloc_snapshot_seg to snapshot_manip and make it local static.

8 years agosegtype: check for activation
Zdenek Kabelac [Thu, 17 Dec 2015 11:23:33 +0000 (12:23 +0100)]
segtype: check for activation

Before setting static variable with check passed state,
detect if we are allowed to talk to driver.

8 years agolvresize: check for poolmetadatasize arg earlier
Zdenek Kabelac [Wed, 16 Dec 2015 10:23:45 +0000 (11:23 +0100)]
lvresize: check for poolmetadatasize arg earlier

Since we check for poolmetadatasize, we need to detect it before
actual test.

8 years agolvmanip: add lv_is_snapshot
Zdenek Kabelac [Thu, 7 Jan 2016 13:30:21 +0000 (14:30 +0100)]
lvmanip: add lv_is_snapshot

Add new test for  lv_is_snapshot().
Also move few other bitchecks into same place as remaining bit tests.

TODO: drop lv_is_merging_origin() and keep using lv_is_merging().

8 years agovgcfgrestore: Retain allocatable PV attribute.
Alasdair G Kergon [Thu, 14 Jan 2016 00:46:45 +0000 (00:46 +0000)]
vgcfgrestore: Retain allocatable PV attribute.

pvchange -xn was getting lost.
All PVs were set to allocatable again after restore.

Moved setting ALLOCATABLE_PV outside pv_setup().

8 years agovgchange: fix lockd_gl results
David Teigland [Wed, 13 Jan 2016 21:55:41 +0000 (15:55 -0600)]
vgchange: fix lockd_gl results

The wrong error value was being checked from lockd_gl()
in two cases.

Clarify the use of lockd_gl() in the lock-start case.

8 years agolvmlockd: fix exit code
David Teigland [Wed, 13 Jan 2016 20:44:01 +0000 (14:44 -0600)]
lvmlockd: fix exit code

libdaemon uses 1 for success

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