]> sourceware.org Git - lvm2.git/log
lvm2.git
10 years agovgsplit: Fix VG component of lvid.
Alasdair G Kergon [Thu, 3 Jul 2014 18:06:04 +0000 (19:06 +0100)]
vgsplit: Fix VG component of lvid.

Fix VG component of lvid in vgsplit and vgmerge
Update vg_validate() to detect the error.
Call lv_is_active() before moving LV into new VG, not after.

10 years agoreport: Add lv_dm_path and lv_full_name fields.
Alasdair G Kergon [Wed, 2 Jul 2014 16:24:05 +0000 (17:24 +0100)]
report: Add lv_dm_path and lv_full_name fields.

10 years agoreport: Exclude hidden devices from lv_path field.
Alasdair G Kergon [Wed, 2 Jul 2014 13:57:00 +0000 (14:57 +0100)]
report: Exclude hidden devices from lv_path field.

10 years agotests: ensure data hits cow
Zdenek Kabelac [Wed, 2 Jul 2014 13:02:56 +0000 (15:02 +0200)]
tests: ensure data hits cow

10 years agocleanup: drop inline and add prefix _ for static
Zdenek Kabelac [Wed, 2 Jul 2014 13:09:06 +0000 (15:09 +0200)]
cleanup: drop inline and add prefix _ for static

Leave inline decision on compiler.
Add '_'prefix for static functions.

10 years agotests: replace cat with $(<
Zdenek Kabelac [Mon, 30 Jun 2014 19:00:08 +0000 (21:00 +0200)]
tests: replace cat with $(<

Use shell built-in $(<
Print lvm.conf in use for test.

10 years agotests: avoid hiding results in local
Zdenek Kabelac [Mon, 30 Jun 2014 18:04:24 +0000 (20:04 +0200)]
tests: avoid hiding results in local

There is a difference between:

local a=$(shell)

and

local a
a=$(shell)

The first return exit code from shells' local command.

10 years agocleanup: add braces for if()
Zdenek Kabelac [Wed, 2 Jul 2014 08:28:39 +0000 (10:28 +0200)]
cleanup: add braces for if()

10 years agocleanup: use unsigned type for command
Zdenek Kabelac [Wed, 2 Jul 2014 08:27:13 +0000 (10:27 +0200)]
cleanup: use unsigned type for command

Keep command unsigned (as _IOWR() produces them).

10 years agocleanup: a bit better error message
Zdenek Kabelac [Wed, 2 Jul 2014 07:50:04 +0000 (09:50 +0200)]
cleanup: a bit better error message

10 years agocleanup: verbose in human readable size
Zdenek Kabelac [Tue, 1 Jul 2014 09:03:31 +0000 (11:03 +0200)]
cleanup: verbose in human readable size

Use normal size like we use everywhere else.

10 years agocleanup: line indent
Zdenek Kabelac [Tue, 1 Jul 2014 08:17:41 +0000 (10:17 +0200)]
cleanup: line indent

10 years agocleanup: libdm simplier error comparation
Zdenek Kabelac [Tue, 1 Jul 2014 22:00:31 +0000 (00:00 +0200)]
cleanup: libdm simplier error comparation

When testing return value from snprintf
use simplier form '>=' instead of  '+1 >'.

10 years agodisplay: add display_lvname
Zdenek Kabelac [Tue, 1 Jul 2014 22:01:46 +0000 (00:01 +0200)]
display: add display_lvname

Add simple function to print vg/lv name.
Useful i.e. in error messages.

10 years agofsadm: avoid using -a in test
Zdenek Kabelac [Mon, 30 Jun 2014 18:03:05 +0000 (20:03 +0200)]
fsadm: avoid using -a in test

10 years agopool: delay conversion prompt
Zdenek Kabelac [Tue, 1 Jul 2014 09:06:36 +0000 (11:06 +0200)]
pool: delay conversion prompt

First validate as much params as possible before prompting user
about conversion to data and metadata LV.

10 years agothin: fix chunk_size conversion prompt skip
Zdenek Kabelac [Tue, 1 Jul 2014 09:04:14 +0000 (11:04 +0200)]
thin: fix chunk_size conversion prompt skip

Use --force only enables prompting for dangerous operation.
User has to add --yes to skip this prompt.

10 years agolvremove: remove thin volumes on damaged pools
Zdenek Kabelac [Tue, 1 Jul 2014 22:13:32 +0000 (00:13 +0200)]
lvremove: remove thin volumes on damaged pools

Support remove of thin volumes With --force --force
when thin pools is damaged.

This way it's possible to remove thin pool with
unrepairable metadata without requiring to
manually edit lvm2 metadata.

lvremove -ff vg/pool

removes all thin volumes and pool even when
thin pool cannot be activated (to accept
removal of thin volumes in kernel metadata)

10 years agoraid: don't skip prompt with force
Zdenek Kabelac [Tue, 1 Jul 2014 07:55:04 +0000 (09:55 +0200)]
raid: don't skip prompt with force

Yes is meant to be used to skip all new prompts.
(--force just adds more prompts).

10 years agoraid: switch to log_warn
Zdenek Kabelac [Tue, 1 Jul 2014 07:53:58 +0000 (09:53 +0200)]
raid: switch to log_warn

Use log_warn for warning message.
log_error is printed when command returns error code.

10 years agomirror: mirror_or_raid_type_requested update
Zdenek Kabelac [Tue, 1 Jul 2014 08:13:10 +0000 (10:13 +0200)]
mirror: mirror_or_raid_type_requested update

mirror_or_raid_type_requested really checks for mirror type.

Convert macros mirror_or_raid_type_requested() and
snapshot_type_requested() into inline functions.

10 years agomake: Fix pofile and .d file generation.
Alasdair G Kergon [Tue, 1 Jul 2014 23:48:50 +0000 (00:48 +0100)]
make: Fix pofile and .d file generation.

Use builddir not srcdir with make pofile.

Append 'incfile:' lines to %.d files to handle newly-missing dependencies
without 'make clean' after a file is moved or deleted.

10 years agouuid: revert uuids for mirrors and raids
Zdenek Kabelac [Mon, 30 Jun 2014 12:04:25 +0000 (14:04 +0200)]
uuid: revert uuids for mirrors and raids

Using suffixes for mirrors and raids will need more work,
before this could be enabled.

Meanwhile revert to previous behavior.

Keep suffixes for thins and caches.

10 years agocleanup: ignore vg_name in /lib
Zdenek Kabelac [Mon, 30 Jun 2014 10:02:05 +0000 (12:02 +0200)]
cleanup: ignore vg_name in /lib

Since  vg_name inside /lib function has already been ignored mostly
except for a few debug prints - make it and official internal API
feature.

vg_name is used only in  /tools while the VG is not yet openned,
and when  lvresize/lvcreate /lib function is called with VG pointer
already being used, then vg_name becomes irrelevant (it's not been
validated anyway).

So any internal user of lvcreate_params and lvresize_params does not
need to set vg_name pointer and may leave it NULL.

10 years agouuid: add more private uuid sufixes
Zdenek Kabelac [Thu, 26 Jun 2014 22:03:31 +0000 (00:03 +0200)]
uuid: add more private uuid sufixes

Use suffixes for easier detection of private volumes.

This commit makes older volume UUIDs incompatible and
it most probably needs machine reboot after upgrade.

10 years agocleanup: more lv_is_ functions
Zdenek Kabelac [Thu, 26 Jun 2014 22:02:58 +0000 (00:02 +0200)]
cleanup: more lv_is_ functions

10 years agothin: do not create reserved LVs
Zdenek Kabelac [Mon, 30 Jun 2014 09:33:23 +0000 (11:33 +0200)]
thin: do not create reserved LVs

When creating pool's metadata - create initial LV for clearing with some
generic name and after the volume is create & cleared - rename it to
reserved name '_tmeta/_cmeta'.

We should not expose  'reserved' names for public LVs.

10 years agothin: repaired LV uses _meta%d
Zdenek Kabelac [Mon, 30 Jun 2014 09:01:04 +0000 (11:01 +0200)]
thin: repaired LV uses _meta%d

Don't leave 'regular' LV with reserved suffix for a user.
After succefull repair use 'normal' (non-reserved) LV name
for backup of original metadata.

10 years agoactivation: fix typo in 'activation skip' message
Peter Rajnoha [Mon, 30 Jun 2014 09:02:45 +0000 (11:02 +0200)]
activation: fix typo in 'activation skip' message

10 years agolibdm: fix double const for "value" in dm_report_reserved_value structure
Peter Rajnoha [Mon, 30 Jun 2014 07:44:23 +0000 (09:44 +0200)]
libdm: fix double const for "value" in dm_report_reserved_value structure

C++ may have

10 years agoman: do not mention '(i)nherited' for alloc policy in vg_attr field
Peter Rajnoha [Thu, 26 Jun 2014 13:14:54 +0000 (15:14 +0200)]
man: do not mention '(i)nherited' for alloc policy in vg_attr field

VG has nothing to inherit from...

10 years agoraid: Allow repair to reuse PVs from same image that suffered a PV failure
Jonathan Brassow [Thu, 26 Jun 2014 03:26:06 +0000 (22:26 -0500)]
raid: Allow repair to reuse PVs from same image that suffered a PV failure

When repairing RAID LVs that have multiple PVs per image, allow
replacement images to be reallocated from the PVs that have not
failed in the image if there is sufficient space.

This allows for scenarios where a 2-way RAID1 is spread across 4 PVs,
where each image lives on two PVs but doesn't use the entire space
on any of them.  If one PV fails and there is sufficient space on the
remaining PV in the image, the image can be reallocated on just the
remaining PV.

10 years agomisc: after releasing a PV segment, merge it with any adjacent free space
Jonathan Brassow [Thu, 26 Jun 2014 03:04:58 +0000 (22:04 -0500)]
misc: after releasing a PV segment, merge it with any adjacent free space

Previously, the seg_pvs used to track free and allocated space where left
in place after 'release_pv_segment' was called to free space from an LV.
Now, an attempt is made to combine any adjacent seg_pvs that also track
free space.  Usually, this doesn't provide much benefit, but in a case
where one command might free some space and then do an allocation, it
can make a difference.  One such case is during a repair of a RAID LV,
where one PV of a multi-PV image fails.  This new behavior is used when
the replacement image can be allocated from the remaining space of the
PV that did not fail.  (First the entire image with the failed PV is
removed.  Then the image is reallocated from the remaining PVs.)

10 years agoraid/misc: Allow creation of parallel areas by LV vs segment
Jonathan Brassow [Thu, 26 Jun 2014 02:20:41 +0000 (21:20 -0500)]
raid/misc: Allow creation of parallel areas by LV vs segment

I've changed build_parallel_areas_from_lv to take a new parameter
that allows the caller to build parallel areas by LV vs by segment.
Previously, the function created a list of parallel areas for each
segment in the given LV.  When it came time for allocation, the
parallel areas were honored on a segment basis.  This was problematic
for RAID because any new RAID image must avoid being placed on any
PVs used by other images in the RAID.  For example, if we have a
linear LV that has half its space on one PV and half on another, we
do not want an up-convert to use either of those PVs.  It should
especially not wind up with the following, where the first portion
of one LV is paired up with the second portion of the other:
------PV1-------  ------PV2-------
[ 2of2 image_1 ]  [ 1of2 image_1 ]
[ 1of2 image_0 ]  [ 2of2 image_0 ]
----------------  ----------------
Previously, it was possible for this to happen.  The change makes
it so that the returned parallel areas list contains one "super"
segment (seg_pvs) with a list of all the PVs from every actual
segment in the given LV and covering the entire logical extent range.

This change allows RAID conversions to function properly when there
are existing images that contain multiple segments that span more
than one PV.

10 years agotest: Test addition to show incorrect allocator behavior
Jonathan Brassow [Sat, 21 Jun 2014 20:33:52 +0000 (15:33 -0500)]
test:  Test addition to show incorrect allocator behavior

If a RAID LV has images that are spread across more than one PV
and you allocate a new image that requires more than one PV,
parallel_areas is only honored for one segment.  This commit
adds a test for this condition.

10 years agofilters: always reevaluate filter before creating a PV
Peter Rajnoha [Wed, 25 Jun 2014 14:19:27 +0000 (16:19 +0200)]
filters: always reevaluate filter before creating a PV

...to avoid using cached value (persistent filter) and therefore
not noticing any change made after last scan/filtering - the state
of the device may have changed, for example new signatures added.

$ lvm dumpconfig --type diff
allocation {
use_blkid_wiping=0
}
devices {
obtain_device_list_from_udev=0
}

$ cat /etc/lvm/cache/.cache | grep sda

$ vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "fedora" using metadata type lvm2

$ cat /etc/lvm/cache/.cache | grep sda
"/dev/sda",

$ parted /dev/sda mklabel gpt
Information: You may need to update /etc/fstab.

$ parted /dev/sda print
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 134MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start  End  Size  File system  Name  Flags

$ cat /etc/lvm/cache/.cache | grep sda
"/dev/sda",

====

Before this patch:
$ pvcreate /dev/sda
  Physical volume "/dev/sda" successfully created

With this patch applied:
$ pvcreate /dev/sda
  Physical volume /dev/sda not found
  Device /dev/sda not found (or ignored by filtering).

10 years agocoverity: mark new switch cases with 'fall through' comment for coverity to stop...
Peter Rajnoha [Wed, 25 Jun 2014 06:51:37 +0000 (08:51 +0200)]
coverity: mark new switch cases with 'fall through' comment for coverity to stop complaining

10 years agocoverity: fix issues reported by coverity
Peter Rajnoha [Tue, 24 Jun 2014 12:58:53 +0000 (14:58 +0200)]
coverity: fix issues reported by coverity

10 years agopost-release
Alasdair G Kergon [Mon, 23 Jun 2014 14:23:09 +0000 (15:23 +0100)]
post-release

10 years agopre-release v2_02_107
Alasdair G Kergon [Mon, 23 Jun 2014 13:16:39 +0000 (14:16 +0100)]
pre-release

10 years agopre-release
Alasdair G Kergon [Mon, 23 Jun 2014 13:03:32 +0000 (14:03 +0100)]
pre-release

10 years agoman: More /dev/vg and /dev/mapper documentation.
Alasdair G Kergon [Mon, 23 Jun 2014 13:01:31 +0000 (14:01 +0100)]
man: More /dev/vg and /dev/mapper documentation.

10 years agoselect: add message about 'help' field to get more help on each error hit during...
Peter Rajnoha [Mon, 23 Jun 2014 10:12:01 +0000 (12:12 +0200)]
select: add message about 'help' field to get more help on each error hit during selection parsing

Inform about 'help' to get more help about selection fields and operators
after each syntax error hit:

  "Use 'help' for selection to get more help."

10 years agoselect: also mark uncomparable/unselectable fields in field/selection help
Peter Rajnoha [Mon, 23 Jun 2014 08:46:45 +0000 (10:46 +0200)]
select: also mark uncomparable/unselectable fields in field/selection help

10 years agoselect: add FLD_UNCOMPARABLE flag for fields which can't be compared
Peter Rajnoha [Mon, 23 Jun 2014 07:57:46 +0000 (09:57 +0200)]
select: add FLD_UNCOMPARABLE flag for fields which can't be compared

A field where it has no meaning to do any type of comparison is the
implicit "help" or "?" field. The error given was a bit cryptic
before this patch, the FLD_UNCOMPARABLE flag makes it easier to identify
this situation anywhere in the code and provide much better error message.
This flag can be applied to other fields that may appear in the future -
mostly usable for implicit fields as they always have special purpose
(so we're not exporting it in libdevmapper for now - usual reporting
fields don't need this).

Before this patch:

$ vgs -S help=1
  dm_report_object: no data assigned to field help
  dm_report_object: no data assigned to field help

(...which is true actually, but let's provide something better...)

With this patch applied:

$vgs -S help=1
  Selection field is uncomparable: help.
  Selection syntax error at 'help=1'.

$vgs -S '(name=vg && help=1) || vg_size > 1g'
  Selection field is uncomparable: help.
  Selection syntax error at 'help=1) || vg_size > 1g'.

10 years agolocking: fix cluster locking
Alasdair G Kergon [Fri, 20 Jun 2014 15:38:48 +0000 (16:38 +0100)]
locking: fix cluster locking

Hunk missed from last commit 78533f72d30f6e840f66e0aae89126ef139c1f2c.

10 years agolocking: Introduce LCK_ACTIVATION.
Alasdair G Kergon [Fri, 20 Jun 2014 12:24:02 +0000 (13:24 +0100)]
locking: Introduce LCK_ACTIVATION.

Take a local file lock to prevent concurrent activation/deactivation of LVs.
Thin/cache types and an extension for cluster support are excluded for
now.

'lvchange -ay $lv' and 'lvchange -an $lv' should no longer cause trouble
if issued concurrently: the new lock should make sure they
activate/deactivate $lv one-after-the-other, instead of overlapping.

(If anyone wants to experiment with the cluster patch, please get in touch.)

10 years agopvvmove: add a few comments
Alasdair G Kergon [Fri, 20 Jun 2014 10:41:20 +0000 (11:41 +0100)]
pvvmove: add a few comments

10 years agolv: fix lv_is_raid
Zdenek Kabelac [Fri, 20 Jun 2014 09:37:45 +0000 (11:37 +0200)]
lv: fix lv_is_raid

10 years agotests: add udev sync point
Zdenek Kabelac [Fri, 20 Jun 2014 09:11:39 +0000 (11:11 +0200)]
tests: add udev sync point

Missed synchronization with udev may lead to error on vgcreate,
if previous vgremove was not handled fast enough by udev.

10 years agocleanup: use simplier test
Zdenek Kabelac [Thu, 19 Jun 2014 19:08:05 +0000 (21:08 +0200)]
cleanup: use simplier test

Just like all other tests - use direct LV function test

10 years agomemlock: skip more entries
Zdenek Kabelac [Fri, 20 Jun 2014 09:10:42 +0000 (11:10 +0200)]
memlock: skip more entries

Add more entries for memlock skipping - since those are never
used by lvm code in critical section (suspend state).

10 years agodmsetup: no need to check for "help" field name after report init
Peter Rajnoha [Thu, 19 Jun 2014 16:20:30 +0000 (18:20 +0200)]
dmsetup: no need to check for "help" field name after report init

The "help" field (as well as "?") is implicit now - libdevmapper
takes care of it completely.

10 years agopvmove: Fix code that looks up the "move pv" for display
Jonathan Brassow [Thu, 19 Jun 2014 15:57:08 +0000 (10:57 -0500)]
pvmove: Fix code that looks up the "move pv" for display

'lvs' would segfault if trying to display the "move pv" if the
pvmove was run with '--atomic'.  The structure of an atomic pvmove
is different and requires us to descend another level in the
LV tree to retrieve the PV information.

10 years agopvmove: Clean-up iterator.
Jonathan Brassow [Thu, 19 Jun 2014 15:52:09 +0000 (10:52 -0500)]
pvmove: Clean-up iterator.

In 'find_pvmove_lv', separate the code that searches the atomic
pvmove LVs from the code that searches the normal pvmove LVs.  This
cleans up the segment iterator code a bit.

10 years agoreport: display explicit fields first, then implicit fields in field help
Peter Rajnoha [Thu, 19 Jun 2014 13:54:22 +0000 (15:54 +0200)]
report: display explicit fields first, then implicit fields in field help

It's better to have implicit fields at the very end of the output
so users can see them without scrolling back if the list of fields
is long (the "help" is also an implicit field now so it should be
easily visible).

10 years agolibdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d
Peter Rajnoha [Thu, 19 Jun 2014 13:47:24 +0000 (15:47 +0200)]
libdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d

We have "help" and "?" defined as implicit fields now. As such, we
don't need to export these names in libdevmapper (as it was introduced
by commit 7c86131233011c9fb81190bcb40d5d4ac54a533d within this release).
If anyone uses these field names by mistake, the libdevmapper code can
error out correctly if it detects that the set of explicit field names
(the ones supplied by "fields" arg in dm_report_init/dm_report_init_with_selection)
contains any of the implicit field names (the ones defined internally
by libdevmapper itself).

10 years agoreport: make "help" and "?" field implicit
Peter Rajnoha [Thu, 19 Jun 2014 13:33:16 +0000 (15:33 +0200)]
report: make "help" and "?" field implicit

Making "help" and "?" implicit also simplifies code since the
dm_report_init caller (lvm/dmsetup) doesn't need to check on
dm_report_init return whether "help" or "?" was hit while parsing
fields/sort keys in libdevmapper.

The libdevmapper now sets internal "RH_ALREADY_REPORTED" flag
after it reports the "help" or "?" implicit field. Then libdevmapper
itself checks for this flag in dm_report_object and if found,
the actual reporting is skipped (because the "help" implicit field
was reported instead of the actual report).

10 years agoselect: add list of allowed types for each selection operator mentioned in help
Peter Rajnoha [Thu, 19 Jun 2014 13:19:54 +0000 (15:19 +0200)]
select: add list of allowed types for each selection operator mentioned in help

10 years agopvmove: tidy
Alasdair G Kergon [Thu, 19 Jun 2014 12:40:47 +0000 (13:40 +0100)]
pvmove: tidy

10 years agotests: remove dmeventd usage
Zdenek Kabelac [Thu, 19 Jun 2014 10:48:21 +0000 (12:48 +0200)]
tests: remove dmeventd usage

This test is testing --use-policies on cmdline.
So monitoring must not be used.

10 years agocleanup: rename variable wait
Zdenek Kabelac [Thu, 19 Jun 2014 09:33:11 +0000 (11:33 +0200)]
cleanup: rename variable wait

With older system headers (sys/wait.h) this shadows declaration.

10 years agocleanup: more readable
Zdenek Kabelac [Thu, 19 Jun 2014 09:30:57 +0000 (11:30 +0200)]
cleanup: more readable

Older gcc complained a bit about uninitialized vars
so reorder code for better readability.

10 years agolvchange: better --refresh of raid and mirrors
Zdenek Kabelac [Thu, 19 Jun 2014 09:58:28 +0000 (11:58 +0200)]
lvchange: better --refresh of raid and mirrors

Use lv_check_not_in_use() to detect openned device.
Plain info.open_count is not good enough for udev random
device openning.

10 years agotest: Clean-up pvmove-basic for atomic pvmove test
Jonathan Brassow [Wed, 18 Jun 2014 20:40:06 +0000 (15:40 -0500)]
test: Clean-up pvmove-basic for atomic pvmove test

The way I was testing for the existence of pvmove mimages was
incorrect for rhel5.  This patch makes it more generic/universal.

10 years agoman: lvmthin
David Teigland [Wed, 18 Jun 2014 19:28:50 +0000 (14:28 -0500)]
man: lvmthin

Clean up inconsistencies in the last change.
Improve some bad formatting.

10 years agocleanup: use insert_layer_for_lv implicit rename
Zdenek Kabelac [Wed, 18 Jun 2014 12:58:09 +0000 (14:58 +0200)]
cleanup: use insert_layer_for_lv implicit rename

There is implicit rename for certain layered device.
Do it now for _tdata, _cdata and _corig.

TODO: use better API here...

10 years agolvconvert: print warning when not convert thinpool
Zdenek Kabelac [Wed, 18 Jun 2014 12:18:13 +0000 (14:18 +0200)]
lvconvert: print warning when not convert thinpool

Warning about destruction should not be printed,
When we are converting already existing pool
(improving original in-release commit bbf4b2c1c9d)

10 years agocompilation: fix warnings: build_dm_uuid now accepts whole struct logical_volume...
Peter Rajnoha [Wed, 18 Jun 2014 12:43:13 +0000 (14:43 +0200)]
compilation: fix warnings: build_dm_uuid now accepts whole struct logical_volume, not lvid

replicator/replicator.c:338:2: warning: passing argument 2 of 'build_dm_uuid' from incompatible pointer type [enabled by default]
replicator/replicator.c:629:3: warning: passing argument 2 of 'build_dm_uuid' from incompatible pointer type [enabled by default]
replicator/replicator.c:644:6: warning: passing argument 2 of 'build_dm_uuid' from incompatible pointer type [enabled by default]
replicator/replicator.c:668:7: warning: passing argument 2 of 'build_dm_uuid' from incompatible pointer type [enabled by default]
replicator/replicator.c:677:4: warning: passing argument 2 of 'build_dm_uuid' from incompatible pointer type [enabled by default]

10 years agoman: add man page entry for dmsetup info -c -S/--select + minor cleanups
Peter Rajnoha [Wed, 18 Jun 2014 11:48:27 +0000 (13:48 +0200)]
man: add man page entry for dmsetup info -c -S/--select + minor cleanups

10 years agocleanup: gcc warnings and report-select test vs snap_percent 0%
Peter Rajnoha [Wed, 18 Jun 2014 11:26:47 +0000 (13:26 +0200)]
cleanup: gcc warnings and report-select test vs snap_percent 0%

Fix gcc warnings:
libdm-report.c:1952:5: warning: "end_op_flag_hit" may be used uninitialized in this function [-Wmaybe-uninitialized]
libdm-report.c:2232:28: warning: "custom" may be used uninitialized in this function [-Wmaybe-uninitialized]

And snap_percent is not 0% in dm < 1.10.0 so
don't test comparison with 0% here.

10 years agoWHATS_NEW: commit 76467bdcfd297ffbe2c088b6340ecc7d17d56742
Peter Rajnoha [Wed, 18 Jun 2014 10:30:34 +0000 (12:30 +0200)]
WHATS_NEW: commit 76467bdcfd297ffbe2c088b6340ecc7d17d56742

Ordering string list items on reports is also new compared to
previous state where items were not ordered at all and they
got reported simply as they appeared/were processed.

10 years agoWHATS_NEW: commits 7dbbc05a69c4cb9756464720cad29e3c1ed971c3..b16f5633ab199dedfd25f085...
Peter Rajnoha [Wed, 18 Jun 2014 08:48:53 +0000 (10:48 +0200)]
WHATS_NEW: commits 7dbbc05a69c4cb9756464720cad29e3c1ed971c3..b16f5633ab199dedfd25f08562f686a6fb4aba9d

Report selection support...

10 years agopvmove: Enable all-or-nothing (atomic) pvmoves
Jonathan Brassow [Wed, 18 Jun 2014 03:59:36 +0000 (22:59 -0500)]
pvmove: Enable all-or-nothing (atomic) pvmoves

pvmove can be used to move single LVs by name or multiple LVs that
lie within the specified PV range (e.g. /dev/sdb1:0-1000).  When
moving more than one LV, the portions of those LVs that are in the
range to be moved are added to a new temporary pvmove LV.  The LVs
then point to the range in the pvmove LV, rather than the PV
range.

Example 1:
We have two LVs in this example.  After they were
created, the first LV was grown, yeilding two segments
in LV1.  So, there are two LVs with a total of three
segments.

Before pvmove:
      ---------  ---------   ---------
      | LV1s0 |  | LV2s0 |   | LV1s1 |
      ---------  ---------   ---------
         |           |           |
   -------------------------------------
PV | 000 - 255 | 256 - 511 | 512 - 767 |
   -------------------------------------

After pvmove inserts the temporary pvmove LV:
          ---------   ---------   ---------
          | LV1s0 |   | LV2s0 |   | LV1s1 |
          ---------   ---------   ---------
              |           |           |
        -------------------------------------
pvmove0 |   seg 0   |   seg 1   |   seg 2   |
        -------------------------------------
              |           |           |
        -------------------------------------
PV      | 000 - 255 | 256 - 511 | 512 - 767 |
        -------------------------------------

Each of the affected LV segments now point to a
range of blocks in the pvmove LV, which purposefully
corresponds to the segments moved from the original
LVs into the temporary pvmove LV.

The current implementation goes on from here to mirror the temporary
pvmove LV by segment.  Further, as the pvmove LV is activated, only
one of its segments is actually mirrored (i.e. "moving") at a time.
The rest are either complete or not addressed yet.  If the pvmove
is aborted, those segments that are completed will remain on the
destination and those that are not yet addressed or in the process
of moving will stay on the source PV.  Thus, it is possible to have
a partially completed move - some LVs (or certain segments of LVs)
on the source PV and some on the destination.

Example 2:
What 'example 1' might look if it was half-way
through the move.
             ---------   ---------   ---------
             | LV1s0 |   | LV2s0 |   | LV1s1 |
             ---------   ---------   ---------
                 |           |           |
           -------------------------------------
pvmove0    |   seg 0   |   seg 1   |   seg 2   |
           -------------------------------------
                 |           |           |
                 |     -------------------------
source PV        |     | 256 - 511 | 512 - 767 |
                 |     -------------------------
                 |           ||
           -------------------------
dest PV    | 000 - 255 | 256 - 511 |
           -------------------------

This update allows the user to specify that they would like the
pvmove mirror created "by LV" rather than "by segment".  That is,
the pvmove LV becomes an image in an encapsulating mirror along
with the allocated copy image.

Example 3:
A pvmove that is performed "by LV" rather than "by segment".

                   ---------   ---------
                   | LV1s0 |   | LV2s0 |
                   ---------   ---------
                       |           |
                 -------------------------
        pvmove0  |  * LV-level mirror *  |
                 -------------------------
                             /                \
   pvmove_mimage0   /          pvmove_mimage1
   -------------------------   -------------------------
   |   seg 0   |   seg 1   |   |   seg 0   |   seg 1   |
   -------------------------   -------------------------
        |            |               |           |
   -------------------------   -------------------------
   | 000 - 255 | 256 - 511 |   | 000 - 255 | 256 - 511 |
   -------------------------   -------------------------
           source PV                    dest PV

The thing that differentiates a pvmove done in this way and a simple
"up-convert" from linear to mirror is the preservation of the
distinct segments.  A normal up-convert would simply allocate the
necessary space with no regard for segment boundaries.  The pvmove
operation must preserve the segments because they are the critical
boundary between the segments of the LVs being moved.  So, when the
pvmove copy image is allocated, all corresponding segments must be
allocated.  The code that merges ajoining segments that are part of
the same LV when the metadata is written must also be avoided in
this case.  This method of mirroring is unique enough to warrant its
own definitional macro, MIRROR_BY_SEGMENTED_LV.  This joins the two
existing macros: MIRROR_BY_SEG (for original pvmove) and MIRROR_BY_LV
(for user created mirrors).

The advantages of performing pvmove in this way is that all of the
LVs affected can be moved together.  It is an all-or-nothing approach
that leaves all LV segments on the source PV if the move is aborted.
Additionally, a mirror log can be used (in the future) to provide tracking
of progress; allowing the copy to continue where it left off in the event
there is a deactivation.

10 years agotest: fix report_select test to work in cluster
Peter Rajnoha [Tue, 17 Jun 2014 16:28:27 +0000 (18:28 +0200)]
test: fix report_select test to work in cluster

The snapshot LV is used to check selection of percent values.
The orig volume must be activated exclusively in cluster.

10 years agotests: update lvcreate-thin for latest changes
Peter Rajnoha [Tue, 17 Jun 2014 16:19:59 +0000 (18:19 +0200)]
tests: update lvcreate-thin for latest changes

With recent changes introduced with the report selection support,
the content of lv_modules field is of string list type (before
it was just string type).

String list elements are always ordered now so update lvcreate-thin
test to expect the elements to be ordered.

10 years agoprop: update FIELD macro to accomodate the differentiation of number, size and percen...
Peter Rajnoha [Tue, 17 Jun 2014 16:14:38 +0000 (18:14 +0200)]
prop: update FIELD macro to accomodate the differentiation of number, size and percent field values

The differentiation of the original number field into number, size and
percent field types has been introduced with recent changes for report
selection support.

10 years agoreport: select: add man pages for report selection feature
Peter Rajnoha [Mon, 16 Jun 2014 14:23:55 +0000 (16:23 +0200)]
report: select: add man pages for report selection feature

10 years agoreport: select: add --select arg to lvm devtypes
Peter Rajnoha [Fri, 13 Jun 2014 10:57:22 +0000 (12:57 +0200)]
report: select: add --select arg to lvm devtypes

10 years agoreport: add support for implicit fields, add implicit "selected" field
Peter Rajnoha [Thu, 12 Jun 2014 11:57:22 +0000 (13:57 +0200)]
report: add support for implicit fields, add implicit "selected" field

Implicit fields are fields that are registered with the report
and reported internally by libdevmapper itself (compared to explicit
fields that are registered by the layer above libdevmapper - e.g. LVM,
dmsetup...).

The "selected" field is the implicit field (for now the only one)
that reports the result of the selection. Since the selection itself
is the property of the libdevmapper, the upper layer using dm_report_init
can't register this field itself and it must be done directly at
libdevmapper layer.

The "selected" field is internally registered as part of the "common"
report type with id 0x80000000 (the last bit in uin32_t) which is then
reserved (the explicit report types are then checked if they do not
contain this id and if yes, we error out).

This way, the "selected" field is recognized by all libdevmapper users
that initialize the reporting with "dm_report_init_with_selection".
If reporting is initialized with the classical "dm_report_init",
there's no functional change (so the "selected" field is not defined
and it's not recognized).

10 years agotests: select: add test for report selection feature
Peter Rajnoha [Tue, 10 Jun 2014 07:20:58 +0000 (09:20 +0200)]
tests: select: add test for report selection feature

10 years agoreport: select: add support for percent selection
Peter Rajnoha [Mon, 9 Jun 2014 14:23:45 +0000 (16:23 +0200)]
report: select: add support for percent selection

10 years agoreport: select: refactor: move percent handling code to libdm for reuse
Peter Rajnoha [Mon, 9 Jun 2014 10:08:27 +0000 (12:08 +0200)]
report: select: refactor: move percent handling code to libdm for reuse

10 years agoreport: select: add support for reserved value recognition in report selection string...
Peter Rajnoha [Fri, 30 May 2014 13:02:21 +0000 (15:02 +0200)]
report: select: add support for reserved value recognition in report selection string - add struct dm_report_reserved_value

Make dm_report_init_with_selection to accept an argument with an
array of reserved values where each element contains a triple:

  {dm report field type, reserved value, array of strings representing this value}

When the selection is parsed, we always check whether a string
representation of some reserved value is not hit and if it is,
we use the reserved value assigned for this string instead of
trying to parse it as a value of certain field type.

This makes it possible to define selections like:

   ... --select lv_major=undefined (or -1 or unknown or undef or whatever string representations are registered for this reserved value in the future)
   ... --select lv_read_ahead=auto
   ... --select vg_mda_copies=unmanaged

With this, each time the field value of certain type is hit
and when we compare it with the selection, we use the proper
value for comparison.

For now, register these reserved values that are used at the moment
(also more descriptive names are used for the values):

  const uint64_t _reserved_number_undef_64 = UINT64_MAX;
  const uint64_t _reserved_number_unmanaged_64 = UINT64_MAX - 1;
  const uint64_t _reserved_size_auto_64 = UINT64_MAX;

 {
  {DM_REPORT_FIELD_TYPE_NUMBER, _reserved_number_undef_64, {"-1", "undefined", "undef", "unknown", NULL}},
  {DM_REPORT_FIELD_TYPE_NUMBER, _reserved_number_unmanaged_64, {"unmanaged", NULL}},
  {DM_REPORT_FIELD_TYPE_SIZE, _reserved_size_auto_64, {"auto", NULL}},
  NULL
 }

Same reserved value of different field types do not collide.
All arrays are null-terminated.

The list of reserved values is automatically displayed within
selection help output:

  Selection operands
  ------------------
  ...

  Reserved values
  ---------------
    -1, undefined, undef, unknown   - Reserved value for undefined numeric value. [number]
    unmanaged                       - Reserved value for unmanaged number of metadata copies in VG. [number]
    auto                            - Reserved value for size that is automatically calculated. [size]

  Selection operators
  -------------------
  ...

10 years agoreport: select: show field type in field list if in context of selection
Peter Rajnoha [Mon, 16 Jun 2014 12:06:04 +0000 (14:06 +0200)]
report: select: show field type in field list if in context of selection

When the field list is displayed as help for constructing selection
criteria, show also the field value type. This is useful for users
to know what set of operators are allowed for the type - the subsequent
"Selection operands" section in the help output summarize all known
types that can be used in selection.

10 years agoreport: select: add help for creating selections
Peter Rajnoha [Thu, 29 May 2014 07:42:14 +0000 (09:42 +0200)]
report: select: add help for creating selections

The "<lvm command> -S/--select help" shows help (including list of fields to match against):

  ...field list here including the field type name...

  Selection operands
  ------------------
    field               - Reporting field.
    number              - Non-negative integer value.
    size                - Floating point value with units specified.
    string              - Characters quoted by ' or " or unquoted.
    string list         - Strings enclosed by [ ] and elements delimited by either
                          "all items must match" or "at least one item must match" operator.
    regular expression  - Characters quoted by ' or " or unquoted.

  Selection operators
  -------------------
    Comparison operators:
        =~  - Matching regular expression.
        !~  - Not matching regular expression.
         =  - Equal to.
        !=  - Not equal to.
        >=  - Greater than or equal to.
         >  - Greater than
        <=  - Less than or equal to.
         <  - Less than.

    Logical and grouping operators:
        &&  - All fields must match
         ,  - All fields must match
        ||  - At least one field must match
         #  - At least one field must match
         !  - Logical negation
         (  - Left parenthesis
         )  - Right parenthesis
         [  - List start
         ]  - List end

10 years agoreport: select: add support for comparing string lists with selection defined
Peter Rajnoha [Thu, 29 May 2014 07:42:02 +0000 (09:42 +0200)]
report: select: add support for comparing string lists with selection defined

10 years agoreport: select: add support for processing string lists in selection
Peter Rajnoha [Thu, 29 May 2014 07:41:50 +0000 (09:41 +0200)]
report: select: add support for processing string lists in selection

Selection list items are enclosed in '[' and ']' (if there's only
one item, the '[' and ']' can be omitted). Each element of the list
is a string (either quoted or unquoted, like the usual string operand
used in selection) and each element is delimited either by conjunction
(meaining "match all") or disjunction operator (meaning "match any").

For example, if "," is the conjuction operator and "/" is the
disjunction operator then:

  lv_tags=[a,b,c]

...will match all fields where tags contain *all* a, b and c.

  lv_tags=[a/b/c]

...will match all fields where tags contain *any* of a, b, or c.

Mixing operators within the list is not supported:

  lv_tags=[a,b/c]

...will give an error.

The order in which items are defined in the selection do not matter.

This patch enhances the selection parsing functionality to recognize
such lists.

10 years agoreport: select: add DM_REPORT_FIELD_TYPE_STRING_LIST to make a difference between...
Peter Rajnoha [Thu, 29 May 2014 07:41:36 +0000 (09:41 +0200)]
report: select: add DM_REPORT_FIELD_TYPE_STRING_LIST to make a difference between STRING and STRING_LIST

The {pv,vg,lv,seg}_tags and lv_modules fields are reported as string
lists using the new dm_report_field_string_list - so we just pass
the list to the fn that takes care of reporting and item sorting itself.

10 years agoreport: select: add dm_report_field_string_list to libdm
Peter Rajnoha [Thu, 29 May 2014 07:41:18 +0000 (09:41 +0200)]
report: select: add dm_report_field_string_list to libdm

Add a separate dm_report_field_string_list fn to libdevmapper to
support reporting string lists. Before, the code used libdevmappers's
dm_report_field_string fn which required formatting the list to a
single string. This functionality is now moved to libdevmapper
and the code that needs to report the string list just needs
to pass the list itself and libdevmapper will take care of this.
This also enhances code reuse.

The dm_report_field_string_list also accepts an argument to define
custom delimiter to use. If not defined, a default "," (comma) is
used as item delimiter in the string list reported.

The dm_report_field_string_list automatically sorts the items in
the list before formatting it to a final string. It also encodes
the position and length within the final string where each element
can be found. This can be used to support checking against each
list item reported since since when formatted as a single string
for the actual report, we would lose this information otherwise
(we don't want to copy each item, the position and length within
the final string is enough for us to get the original items back).

When such lists are checked against the selection tree, we can check
each item individually this way and we can support operators like
"match any" and "match all".

10 years agoreport: select: refactor: move str_list to libdm
Peter Rajnoha [Thu, 29 May 2014 07:41:03 +0000 (09:41 +0200)]
report: select: refactor: move str_list to libdm

The list of strings is used quite frequently and we'd like to reuse
this simple structure for report selection support too. Make it part
of libdevmapper for general reuse throughout the code.

This also simplifies the LVM code a bit since we don't need to
include and manage lvm-types.h anymore (the string list was the
only structure defined there).

10 years agoreport: select: add --select arg to pvdisplay, vgdisplay and lvdisplay
Peter Rajnoha [Thu, 29 May 2014 07:39:11 +0000 (09:39 +0200)]
report: select: add --select arg to pvdisplay, vgdisplay and lvdisplay

10 years agoreport: select: add --select arg to pvs, vgs and lvs
Peter Rajnoha [Thu, 29 May 2014 07:38:59 +0000 (09:38 +0200)]
report: select: add --select arg to pvs, vgs and lvs

10 years agoreport: select: add --select arg to dmsetup
Peter Rajnoha [Thu, 29 May 2014 07:38:49 +0000 (09:38 +0200)]
report: select: add --select arg to dmsetup

10 years agoreport: select: use _check_report_selection in dm_report_object to report only object...
Peter Rajnoha [Thu, 29 May 2014 07:38:36 +0000 (09:38 +0200)]
report: select: use _check_report_selection in dm_report_object to report only objects that satisfy the report selection

This is rebased and edited version of the original design and
patch proposed by Jun'ichi Nomura:
  http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

This activates the actual selection process in dm_report_object.

10 years agoreport: select: add _check_selection fn to support checking fields against given...
Peter Rajnoha [Thu, 29 May 2014 07:38:22 +0000 (09:38 +0200)]
report: select: add _check_selection fn to support checking fields against given selections

This is rebased and edited versions of the original design and
patch proposed by Jun'ichi Nomura:
  http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

The _check_selection implements the actual field checking against the
selection tree.

10 years agoreport: select: add dm_report_init_with_selection to libdm
Peter Rajnoha [Thu, 29 May 2014 07:38:08 +0000 (09:38 +0200)]
report: select: add dm_report_init_with_selection to libdm

This is rebased and edited version of the original design and
patch proposed by Jun'ichi Nomura:
  http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

The dm_report_init_with_selection is the same as dm_report_init
but it contains an additional argument to set the selection
in the form of a string that contains field names to check against and
selection operators. The selection string is parsend and a selection
tree is composed for use in the checks against individual fields when
the report is processed. The parsed selection tree is stored in dm_report
structure as "selection_root".

10 years agoreport: select: add supporting infrastucture for token parsing in report selections
Peter Rajnoha [Thu, 29 May 2014 07:37:54 +0000 (09:37 +0200)]
report: select: add supporting infrastucture for token parsing in report selections

This is rebased and edited version of the original design and
patch proposed by Jun'ichi Nomura:
  http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

Add support for parsing numbers, strings (quoted or unquoted), regexes
and operators amogst these operands in selection condition supplied.

10 years agoreport: select: add structs for report selection
Peter Rajnoha [Thu, 29 May 2014 07:37:41 +0000 (09:37 +0200)]
report: select: add structs for report selection

This is rebased and edited version of the original design and
patch proposed by Jun'ichi Nomura:
  http://www.redhat.com/archives/dm-devel/2007-April/msg00025.html

This patch defines operators and structures that will be used
to store the report selection against which the actual values
reported will be checked.

  Selection operators
  -------------------
    Comparison operators:
        =~  - Matching regular expression.
        !~  - Not matching regular expression.
         =  - Equal to.
        !=  - Not equal to.
        >=  - Greater than or equal to.
         >  - Greater than
        <=  - Less than or equal to.
         <  - Less than.

    Logical and grouping operators:
        &&  - All fields must match
         ,  - All fields must match
        ||  - At least one field must match
         #  - At least one field must match
         !  - Logical negation
         (  - Left parenthesis
         )  - Right parenthesis

10 years agoreport: select: add DM_REPORT_FIELD_TYPE_SIZE to make a difference between NUMBER...
Peter Rajnoha [Thu, 29 May 2014 07:37:22 +0000 (09:37 +0200)]
report: select: add DM_REPORT_FIELD_TYPE_SIZE to make a difference between NUMBER and SIZE

This makes it easier to check against the fields (following patches for
report selection) and check whether size units are allowed or not
with the field value.

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