Zdenek Kabelac [Mon, 8 Sep 2014 20:48:42 +0000 (22:48 +0200)]
lvconvert: use lv_update_and_reload
Use lib function.
Zdenek Kabelac [Mon, 8 Sep 2014 20:39:58 +0000 (22:39 +0200)]
lv_manip: remove vg_revert
vg_commit is supposed to have implicit revert handling.
(however as of now it needs fixes).
Zdenek Kabelac [Tue, 9 Sep 2014 16:47:27 +0000 (18:47 +0200)]
lv_rename: fix snapshot rename
Fix rename operation for snapshot (cow) LV.
Only the snapshot's origin has the lock and by mistake suspend
and resume has been called for the snapshot LV.
This further made volumes unusable in cluster.
So instead of suspend and resuming list of LVs,
we need to just suspend and resume origin.
As the sequence write/suspend/commit/resume
is widely used in lvm2 code base - move it to
new lv_update_and_reload function.
Zdenek Kabelac [Mon, 8 Sep 2014 20:36:42 +0000 (22:36 +0200)]
cleanup: add stacktrace for error path
Peter Rajnoha [Thu, 4 Sep 2014 08:52:41 +0000 (10:52 +0200)]
so: make sure shared libs are built with RELRO option
In addition to using RELRO for daemons, use this option for shared
libraries. See also commit
a65ab773b4ddb06e87d678d3b2f4d0ca3e5b9fd0.
Alasdair G Kergon [Mon, 1 Sep 2014 00:53:44 +0000 (01:53 +0100)]
post-release
Alasdair G Kergon [Mon, 1 Sep 2014 00:51:47 +0000 (01:51 +0100)]
pre-release
Zdenek Kabelac [Fri, 29 Aug 2014 09:58:16 +0000 (11:58 +0200)]
cleanup: drop extra ()
Pure '==' test doesn't need extra ().
Zdenek Kabelac [Fri, 29 Aug 2014 09:51:53 +0000 (11:51 +0200)]
cleanup: drop duplicate const
No need to specify 'const' twice in these cases.
Zdenek Kabelac [Thu, 28 Aug 2014 11:53:36 +0000 (13:53 +0200)]
cleanup: assignment into ()
Put is_float=1 into () - so the intention is obvious.
Remove uneeded extra check for for *s != 0,
since it's already checked for either digit or '.'.
Zdenek Kabelac [Fri, 29 Aug 2014 10:51:28 +0000 (12:51 +0200)]
makefiles: include path missing
For deps calcs path for blkid.h needs to be known.
Zdenek Kabelac [Fri, 29 Aug 2014 11:00:16 +0000 (13:00 +0200)]
WHATS_NEW
Zdenek Kabelac [Fri, 29 Aug 2014 10:00:05 +0000 (12:00 +0200)]
clvmd: use correctly sized buffers for sscanf
sscanf needs extra 1 char for '\0'
Zdenek Kabelac [Fri, 29 Aug 2014 10:57:30 +0000 (12:57 +0200)]
WHATS_NEW_DM
Zdenek Kabelac [Fri, 29 Aug 2014 09:52:45 +0000 (11:52 +0200)]
libdm: revert incorrect path length size for sscanf
Commit
94786a3bbf0b68883a2618c9bc25fc88e367f9f8 introduced
another bug - since sscanf needs extra 1 byte for \0.
Since there is no easy way to do a macro evaluation for (PATH_MAX-1)
and string concatation of this number to get resulting (%4095s) - let's
go with easiest path and restore extra byte for 0.
Other option would be to prepare sscanf parsing string in runtime.
But lets resolve it when we look at PATH_MAX handling later...
Alasdair G Kergon [Wed, 27 Aug 2014 23:40:09 +0000 (00:40 +0100)]
lvextend: Reinstate --nosync logic for mirrors.
Reinstate the logic for syncing extensions of mirrors created with
--nosync. (Inadvertently disabled by the approximate allocation
changes.)
Zdenek Kabelac [Wed, 27 Aug 2014 14:52:32 +0000 (16:52 +0200)]
WHATS_NEW
Zdenek Kabelac [Wed, 27 Aug 2014 14:45:39 +0000 (16:45 +0200)]
cache: fix allocation size
Commit
0b3d0e79f694ac9dc5a29270b2f791a250980058 caused regression
in allocation of cache pool. This patch is restoring corect size
for allocation.
Jonathan Brassow [Mon, 25 Aug 2014 00:44:37 +0000 (19:44 -0500)]
cache: Clean-up error message.
It is not an internal error message to report to the user that they
cannot create a cache LV on top of a cache LV. It is simply not
supported yet.
Alasdair G Kergon [Tue, 26 Aug 2014 15:41:18 +0000 (16:41 +0100)]
post-release
Alasdair G Kergon [Tue, 26 Aug 2014 15:34:14 +0000 (16:34 +0100)]
pre-release
Peter Rajnoha [Tue, 26 Aug 2014 15:07:37 +0000 (17:07 +0200)]
Zdenek Kabelac [Tue, 26 Aug 2014 10:26:17 +0000 (12:26 +0200)]
tests: thin and volume_list testing
Zdenek Kabelac [Tue, 26 Aug 2014 10:09:03 +0000 (12:09 +0200)]
tests: fix volume list test
Proper use of \" escaping and shell vars.
Zdenek Kabelac [Tue, 26 Aug 2014 09:39:51 +0000 (11:39 +0200)]
cleanup: indent and stacktrack
Add missing stacktrace on error path
and newline indent.
Zdenek Kabelac [Thu, 21 Aug 2014 13:38:18 +0000 (15:38 +0200)]
cleanup: check pv_count is not 0
Since we already detect writemostly_ARG is non-zero
make it obvious pv_count will also be non-zero in this case.
Zdenek Kabelac [Thu, 21 Aug 2014 13:37:39 +0000 (15:37 +0200)]
cleanup: use unsigned 1bit elements
Avoid using signed 'int' type for 1 bit size.
Zdenek Kabelac [Thu, 21 Aug 2014 13:35:29 +0000 (15:35 +0200)]
cleanup: never return uninitialized buffer
Coverity noticed this function may return untouched buffer,
however in this state can't really happen, but anyway
ensure on error path the buffer will have zero lenght string.
Zdenek Kabelac [Thu, 21 Aug 2014 13:39:27 +0000 (15:39 +0200)]
libdm: add check transaction_id after message
Add extra safety detection for thin pool transaction id
and query pool status after confirmed message.
In case there is a missmatch, immeditelly abort further
processing.
Zdenek Kabelac [Tue, 26 Aug 2014 10:10:29 +0000 (12:10 +0200)]
thin: fix volume_list support
Fixing problem, when user sets volume_list and excludes thin pools
from activation. In this case pool return 'success' for skipped activation.
We need to really check the volume it is actually active to properly
to remove queued pool messages. Otherwise the lvm2 and kernel
metadata started to go async since lvm2 believed, messages were submitted.
Add also better check for threshold when create a new thin volume.
In this case we require local activation of thin pool so we are able
to check pool fullness.
Zdenek Kabelac [Tue, 26 Aug 2014 09:53:56 +0000 (11:53 +0200)]
thin: more forced ignoring of pool failure
Support also 'vgremove -ff' to properly remove even inactive/broken thin pools.
Update messages to use 'print_unless_silent' for the forced case.
Peter Rajnoha [Mon, 25 Aug 2014 08:02:32 +0000 (10:02 +0200)]
cleanup: consolidate lv_layout and lv_role reporting
This patch makes the keyword combinations found in "lv_layout" and
"lv_role" much more understandable - there were some ambiguities
for some of the combinations which lead to confusion before.
Now, the scheme used is:
LAYOUTS ("how the LV is laid out"):
===================================
[linear] (all segments have number of stripes = 1)
[striped] (all segments have number of stripes > 1)
[linear,striped] (mixed linear and striped)
raid (raid layout always reported together with raid level, raid layout == image + metadata LVs underneath that make up raid LV)
[raid,raid1]
[raid,raid10]
[raid,raid4]
[raid,raid5] (exact sublayout not specified during creation - default one used - raid5_ls)
[raid,raid5,raid5_ls]
[raid,raid5,raid6_rs]
[raid,raid5,raid5_la]
[raid,raid5,raid5_ra]
[raid6,raid] (exact sublayout not specified during creation - default one used - raid6_zr)
[raid,raid6,raid6_zr]
[raid,raid6,raid6_nc]
[raid,raid6,raid6_ns]
[mirror] (mirror layout == log + image LVs underneath that make up mirror LV)
thin (thin layout always reported together with sublayout)
[thin,sparse] (thin layout == allocated out of thin pool)
[thin,pool] (thin pool layout == data + metadata volumes underneath that make up thin pool LV, not supposed to be used for direct use!!!)
[cache] (cache layout == allocated out of cache pool in conjunction with cache origin)
[cache,pool] (cache pool layout == data + metadata volumes underneath that make up cache pool LV, not supposed to be used for direct use!!!)
[virtual] (virtual layout == not hitting disk underneath, currently this layout denotes only 'zero' device used for origin,thickorigin role)
[unknown] (either error state or missing recognition for such layout)
ROLES ("what's the purpose or use of the LV - what is its role"):
=================================================================
- each LV has either of these two roles at least: [public] (public LV that users may use freely to write their data to)
[public] (public LV that users may use freely to write their data to)
[private] (private LV that LVM maintains; not supposed to be directly used by user to write his data to)
- and then some special-purpose roles in addition to that:
[origin,thickorigin] (origin for thick-style snapshot; "thick" as opposed to "thin")
[origin,multithickorigin] (there are more than 2 thick-style snapshots for this origin)
[origin,thinorigin] (origin for thin snapshot)
[origin,multithinorigin] (there are more than 2 thin snapshots for this origin)
[origin,extorigin] (external origin for thin snapshot)
[origin,multiextoriginl (there are more than 2 thin snapshots using this external origin)
[origin,cacheorigin] (cache origin)
[snapshot,thicksnapshot] (thick-style snapshot; "thick" as opposed to "thin")
[snapshot,thinsnapshot] (thin-style snapshot)
[raid,metadata] (raid metadata LV)
[raid,image] (raid image LV)
[mirror,image] (mirror image LV)
[mirror,log] (mirror log LV)
[pvmove] (pvmove LV)
[thin,pool,data] (thin pool data LV)
[thin,pool,metadata] (thin pool metadata LV)
[cache,pool,data] (cache pool data LV)
[cache,pool,metadata] (cache pool metadata LV)
[pool,spare] (pool spare LV - common role of LV that makes it used for both thin and cache repairs)
Peter Rajnoha [Mon, 25 Aug 2014 08:05:27 +0000 (10:05 +0200)]
report: use dm_report_field_string_list_unordered for reporting lv_layout and lv_role fields
This makes it a bit more readable since we can report more general
layouts/roles first and keywords describing the LV more precisely
afterwards in the list.
Peter Rajnoha [Mon, 25 Aug 2014 08:04:08 +0000 (10:04 +0200)]
report: add dm_report_field_string_list_unsorted
Peter Rajnoha [Mon, 25 Aug 2014 07:07:03 +0000 (09:07 +0200)]
refactor: rename 'lv_type' field to 'lv_role'
The 'lv_type' field name was a bit misleading. Better one is 'lv_role'
since this fields describes what's the actual use of the LV currently -
its 'role'.
Alasdair G Kergon [Fri, 22 Aug 2014 22:47:44 +0000 (23:47 +0100)]
autoreconf
Alasdair G Kergon [Fri, 22 Aug 2014 22:42:55 +0000 (23:42 +0100)]
configure: Fix shared lvm1 typo.
via https://bugs.gentoo.org/520640
David Teigland [Fri, 22 Aug 2014 16:32:36 +0000 (11:32 -0500)]
lvcreate: disallow snapshot of cache lv
Alasdair G Kergon [Fri, 22 Aug 2014 00:26:14 +0000 (01:26 +0100)]
lvresize: Fix raid/mirror and %PE handling code.
Sort out the lvresize calculation code to handle size changes
specified as physical extents as well as logical extents
and to process mirror resizing and raid extensions correctly.
The 'approx alloc' option was masking the underlying problem.
Peter Rajnoha [Thu, 21 Aug 2014 08:26:16 +0000 (10:26 +0200)]
man: dmsetup: -n is shortcut for --notable, not --noheadings
The -n was defined for --notable since beginning, but the man page
got wrong at some time...
Zdenek Kabelac [Wed, 20 Aug 2014 12:35:57 +0000 (14:35 +0200)]
tests: proper /dev access
Commit
5ebff6cc9f631b7409d99b72fa0b39ccec30bf1f seemed to introduce
new 'for' loop but the mode is not yet used.
But the access to /dev dir needs to go through $DM_DEV_DIR
and whole path needs to be in "".
Peter Rajnoha [Wed, 20 Aug 2014 08:05:51 +0000 (10:05 +0200)]
lvconvert: snapshot: allow using raid1 for snapshot and snapshot origin
When testing conversion sanity, we checked lv->status & MIRRORED
which encompasses both old mirrors and raid1 mirrors. But we need to
ban only the old mirrors here hence allow raid1 mirrors.
Jonathan Brassow [Tue, 19 Aug 2014 14:57:30 +0000 (09:57 -0500)]
cleanup: Remove extra ';' from the end of a line.
Zdenek Kabelac [Tue, 19 Aug 2014 12:30:52 +0000 (14:30 +0200)]
cleanup: simplier struct init
Use simplier struct initilizer.
Zdenek Kabelac [Tue, 19 Aug 2014 12:19:11 +0000 (14:19 +0200)]
cleanup: avoid double assign
Skip setting a value to a variable which is never
used and overwritten/set afterwards.
Zdenek Kabelac [Tue, 19 Aug 2014 09:35:18 +0000 (11:35 +0200)]
cleanup: use just PATH_MAX size
Avoid playing with +1.
PATH_MAX code needs probably more thinking anyway, since
there is no MAX path in Linux - user may easily create path
with 64kB chars - so 4kB buffer is surelly not enough for
such dirs.
Note:
http://insanecoding.blogspot.cz/2007/11/pathmax-simply-isnt.html
Zdenek Kabelac [Mon, 18 Aug 2014 15:34:01 +0000 (17:34 +0200)]
cleanup: use _ prefix for static functions
Zdenek Kabelac [Mon, 18 Aug 2014 20:04:39 +0000 (22:04 +0200)]
cleanup: reindent and make obvious error path
Zdenek Kabelac [Tue, 19 Aug 2014 12:22:22 +0000 (14:22 +0200)]
libdm: check version prints error
Move 'bad' label above log_error, so the
error message is printed on 'bad' path.
(And return 0 is not without log_error()).
Zdenek Kabelac [Tue, 19 Aug 2014 12:27:03 +0000 (14:27 +0200)]
lv_manip: check for str_list_dup failure
Zdenek Kabelac [Tue, 19 Aug 2014 12:26:06 +0000 (14:26 +0200)]
lvscan: check result of id_write_format
Currently rather impossible to happen - but check
for returned value of id_write_format().
Zdenek Kabelac [Tue, 19 Aug 2014 12:25:02 +0000 (14:25 +0200)]
metadata: check result of refresh and rescan
Detect failure in case refresh_filters of lvmcache_label_scan fails.
Zdenek Kabelac [Tue, 19 Aug 2014 12:20:22 +0000 (14:20 +0200)]
dmeventd: fix test for select return value
Do not call read when select return -1 && EINTR.
Also check for return valuer from read() and
abort write function when unexpected error happens.
Peter Rajnoha [Tue, 19 Aug 2014 12:16:39 +0000 (14:16 +0200)]
lv: remove lv_type_name fn
The lv_type_name function is remnant from old code that reported
only single string for the LV type. LV types are now reported
in a more extended way as keyword list that describe the type
precisely (using lv_layout_and_type fn).
The lv_type_name was used in some error messages to display the
type of the LV so just reinstate the old messages back referencing
the type directly with a string - this is enough for error messages.
They don't need to display the LV type as precisely as it's used
on lvs output (which is optimized for selection anyway).
Peter Rajnoha [Tue, 19 Aug 2014 11:58:32 +0000 (13:58 +0200)]
report: also display "mirror" keyword in lv_layout for mirrored mirror log and "cache" keyword in lv_layout for cached cache pool
$ lvs -a -o name,vg_name,attr,layout,type
LV VG Attr Layout Type
lvol0 vg mwi-a-m--- mirror mirror
[lvol0_mimage_0] vg iwi-aom--- linear image,mirror
[lvol0_mimage_1] vg iwi-aom--- linear image,mirror
[lvol0_mlog] vg mwi-aom--- mirror log,mirror
[lvol0_mlog_mimage_0] vg iwi-aom--- linear image,mirror
[lvol0_mlog_mimage_1] vg iwi-aom--- linear image,mirror
(lvol0_mlog properly displayed as "mirror" layout for mirrored mirror log)
$ lvs -a -o name,vg_name,attr,layout,type
LV VG Attr Layout Type
lvol0 vg Cwi---C--- cache,pool cache,pool
[lvol0_cdata] vg Cwi------- linear cache,data,pool
[lvol0_cmeta] vg ewi------- linear cache,metadata,pool
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
lvol2 vg Cwi---C--- cache,pool cache,pool
[lvol2_cdata] vg Cwi---C--- cache cache,data,pool
[lvol2_cdata_corig] vg owi---C--- linear cache,origin
[lvol2_cmeta] vg ewi------- linear cache,metadata,pool
(lvol2_cdata properly displayed as cached cache pool data)
Peter Rajnoha [Tue, 19 Aug 2014 07:41:41 +0000 (09:41 +0200)]
report: also display "mirror" keyword in lv_type for pvmove LV and display "multiple" for external origin used for more than one thin snapshot
$ lvs -a -o name,vg_name,attr,layout,type
LV VG Attr Layout Type
lvol0 vg -wI-a----- linear linear
[pvmove0] vg p-C-aom--- mirror mirror,pvmove
(added "mirror" for pvmove LV)
$ lvs -a -o name,vg_name,attr,layout,type
LV VG Attr Layout Type
lvol0 vg ori------- linear external,multiple,origin,thin
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
lvol2 vg Vwi-a-tz-- thin snapshot,thin
lvol3 vg Vwi-a-tz-- thin snapshot,thin
pool vg twi-a-tz-- pool,thin pool,thin
[pool_tdata] vg Twi-ao---- linear data,pool,thin
[pool_tmeta] vg ewi-ao---- linear metadata,pool,thin
(added "multiple" for external origin used for more than one
thin snapshot - lvol0 in the example above)
Peter Rajnoha [Mon, 18 Aug 2014 13:58:48 +0000 (15:58 +0200)]
report: fix thin external snapshot identification for lv_layout and lv_type fields
Thin snapshots having external origins missed the "snapshot" keyword for
lv_type field. Also, thin external origins which are thin devices (from
another pool) were not recognized properly.
For example, external origin itself can be either non-thin volume (lvol0
below) or it can be a thin volume from another pool (lvol3 below):
Before this patch:
$ lvs -o name,vg_name,attr,pool_lv,origin,layout,type
Internal error: Failed to properly detect layout and type for for LV vg/lvol3
Internal error: Failed to properly detect layout and type for for LV vg/lvol3
LV VG Attr Pool Origin Layout Type
lvol0 vg ori------- linear external,origin,thin
lvol2 vg Vwi-a-tz-- pool lvol0 thin thin
lvol3 vg ori---tz-- pool unknown external,origin,thin,thin
lvol4 vg Vwi-a-tz-- pool1 lvol3 thin thin
pool vg twi-a-tz-- pool,thin pool,thin
pool1 vg twi-a-tz-- pool,thin pool,thin
- lvol2 as well as lvol4 have missing "snapshot" in type field
- lvol3 has unrecognized layout (should be "thin"), but has double
"thin" in lv_type which is incorrect
- (also there's double "for" in the internal error message)
With this patch applied:
$ lvs -o name,vg_name,attr,pool_lv,origin,layout,type
LV VG Attr Pool Origin Layout Type
lvol0 vg ori------- linear external,origin,thin
lvol2 vg Vwi-a-tz-- pool lvol0 thin snapshot,thin
lvol3 vg ori---tz-- pool thin external,origin,thin
lvol4 vg Vwi-a-tz-- pool1 lvol3 thin snapshot,thin
pool vg twi-a-tz-- pool,thin pool,thin
pool1 vg twi-a-tz-- pool,thin pool,thin
Jonathan Brassow [Sat, 16 Aug 2014 02:15:34 +0000 (21:15 -0500)]
RAID: Fail RAID4/5/6 creation if PE size is less than STRIPE_SIZE_MIN
The maximum stripe size is equal to the volume group PE size. If that
size falls below the STRIPE_SIZE_MIN, the creation of RAID 4/5/6 volumes
becomes impossible. (The kernel will fail to load a RAID 4/5/6 mapping
table with a stripe size less than STRIPE_SIZE_MIN.) So, we report an
error if it is attempted.
This is very rare because reducing the PE size down that far limits the
size of the PV below that of modern devices.
Alasdair G Kergon [Fri, 15 Aug 2014 23:34:48 +0000 (00:34 +0100)]
dmsetup: Support remove --deferred.
This patch adds a new flag --deferred to dmsetup remove. If this flag is
specified and the device is open, it is scheduled to be deleted on
close.
struct dm_info is extended.
The existing dm_task_get_info() is converted into a wrapper around the
new version dm_task_get_info_with_deferred_remove() so existing binaries
can still use the old smaller structure.
Recompiled code will pick up the new larger structure.
From: Mikulas Patocka <mpatocka@redhat.com>
Zdenek Kabelac [Fri, 15 Aug 2014 13:52:01 +0000 (15:52 +0200)]
cleanup: use display_lvname
Show more complete LV names.
Zdenek Kabelac [Fri, 15 Aug 2014 13:51:03 +0000 (15:51 +0200)]
cleanup: gcc warn fix
Since gcc fail to see the origin has been already set under condition
above, just set origin again.
Peter Rajnoha [Fri, 15 Aug 2014 13:43:42 +0000 (15:43 +0200)]
cleanup: gcc warning
One more:
metadata/thin_manip.c:503: warning: declaration of "snapshot_count" shadows a global declaration
Peter Rajnoha [Fri, 15 Aug 2014 13:32:04 +0000 (15:32 +0200)]
cleanup: gcc warning
metadata/lv_manip.c:269: warning: declaration of "snapshot_count" shadows a global declaration
There's existing function called "snapshot_count" so rename the
variable to "snap_count".
Peter Rajnoha [Fri, 15 Aug 2014 13:21:15 +0000 (15:21 +0200)]
man: missing (C)ache in target type lv_attr description
Zdenek Kabelac [Fri, 15 Aug 2014 12:08:06 +0000 (14:08 +0200)]
cleanup: quite gcc warn
gcc can't see dev_get_primary_dev returns only 0,1,2
so ensure 'name' is always defined in valid path.
Zdenek Kabelac [Fri, 15 Aug 2014 11:52:21 +0000 (13:52 +0200)]
cleanup: drop extra braces
Zdenek Kabelac [Thu, 14 Aug 2014 09:11:14 +0000 (11:11 +0200)]
cleanup: just easier word wrapping
Zdenek Kabelac [Wed, 13 Aug 2014 12:20:41 +0000 (14:20 +0200)]
cleanup: drop unneeded inits
Zdenek Kabelac [Wed, 13 Aug 2014 12:20:10 +0000 (14:20 +0200)]
cleanup: simplier struct initilization
Zdenek Kabelac [Wed, 13 Aug 2014 12:19:13 +0000 (14:19 +0200)]
cleanup: move test for free arg
Move test for list of volumes into common place.
Zdenek Kabelac [Fri, 15 Aug 2014 11:31:53 +0000 (13:31 +0200)]
cleanup: postpone confirmation prompt for snapshot
Prompt user for confimation after more checks are done.
(So we avoid case prompting and failing after prompt)
Zdenek Kabelac [Thu, 14 Aug 2014 09:10:36 +0000 (11:10 +0200)]
man: add some more reserved names
Zdenek Kabelac [Thu, 14 Aug 2014 09:09:30 +0000 (11:09 +0200)]
man: show lv name for lvs
Make it more obvious that either just vg name or lv name or path could
be passed as an argument.
Zdenek Kabelac [Fri, 15 Aug 2014 11:53:04 +0000 (13:53 +0200)]
toollib: print ignoring vorigin
When ignoring 'listed' volume, print info message.
(So the final command error message is a bit less confusing,
i.e. when user tries to deactive virtual origin:
> lvchange -an vg/lvol2_vorigin
Ignoring virtual origin logical volume vg/lvol2_vorigin.
One or more specified logical volume(s) not found.
Zdenek Kabelac [Thu, 14 Aug 2014 09:12:02 +0000 (11:12 +0200)]
lvconvert: show name of activated volume
Display the name of volume that needs to be activated for merging.
Peter Rajnoha [Wed, 13 Aug 2014 08:03:45 +0000 (10:03 +0200)]
Add lv_layout_and_type fn, lv_layout and lv_type reporting fields.
The lv_layout and lv_type fields together help with LV identification.
We can do basic identification using the lv_attr field which provides
very condensed view. In contrast to that, the new lv_layout and lv_type
fields provide more detialed information on exact layout and type used
for LVs.
For top-level LVs which are pure types not combined with any
other LV types, the lv_layout value is equal to lv_type value.
For non-top-level LVs which may be combined with other types,
the lv_layout describes the underlying layout used, while the
lv_type describes the use/type/usage of the LV.
These two new fields are both string lists so selection (-S/--select)
criteria can be defined using the list operators easily:
[] for strict matching
{} for subset matching.
For example, let's consider this:
$ lvs -a -o name,vg_name,lv_attr,layout,type
LV VG Attr Layout Type
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
pool vg twi-a-tz-- pool,thin pool,thin
[pool_tdata] vg rwi-aor--- level10,raid data,pool,thin
[pool_tdata_rimage_0] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_1] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_2] vg iwi-aor--- linear image,raid
[pool_tdata_rimage_3] vg iwi-aor--- linear image,raid
[pool_tdata_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_1] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_2] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_3] vg ewi-aor--- linear metadata,raid
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
[pool_tmeta_rimage_0] vg iwi-aor--- linear image,raid
[pool_tmeta_rimage_1] vg iwi-aor--- linear image,raid
[pool_tmeta_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tmeta_rmeta_1] vg ewi-aor--- linear metadata,raid
thin_snap1 vg Vwi---tz-k thin snapshot,thin
thin_snap2 vg Vwi---tz-k thin snapshot,thin
thin_vol1 vg Vwi-a-tz-- thin thin
thin_vol2 vg Vwi-a-tz-- thin multiple,origin,thin
Which is a situation with thin pool, thin volumes and thin snapshots.
We can see internal 'pool_tdata' volume that makes up thin pool has
actually a level10 raid layout and the internal 'pool_tmeta' has
level1 raid layout. Also, we can see that 'thin_snap1' and 'thin_snap2'
are both thin snapshots while 'thin_vol1' is thin origin (having
multiple snapshots).
Such reporting scheme provides much better base for selection criteria
in addition to providing more detailed information, for example:
$ lvs -a -o name,vg_name,lv_attr,layout,type -S 'type=metadata'
LV VG Attr Layout Type
[lvol1_pmspare] vg ewi------- linear metadata,pool,spare
[pool_tdata_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_1] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_2] vg ewi-aor--- linear metadata,raid
[pool_tdata_rmeta_3] vg ewi-aor--- linear metadata,raid
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
[pool_tmeta_rmeta_0] vg ewi-aor--- linear metadata,raid
[pool_tmeta_rmeta_1] vg ewi-aor--- linear metadata,raid
(selected all LVs which are related to metadata of any type)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={metadata,thin}'
LV VG Attr Layout Type
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs which hold metadata related to thin)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'type={thin,snapshot}'
LV VG Attr Layout Type
thin_snap1 vg Vwi---tz-k thin snapshot,thin
thin_snap2 vg Vwi---tz-k thin snapshot,thin
(selected all LVs which are thin snapshots)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout=raid'
LV VG Attr Layout Type
[pool_tdata] vg rwi-aor--- level10,raid data,pool,thin
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs with raid layout, any raid layout)
lvs -a -o name,vg_name,lv_attr,layout,type -S 'layout={raid,level1}'
LV VG Attr Layout Type
[pool_tmeta] vg ewi-aor--- level1,raid metadata,pool,thin
(selected all LVs with raid level1 layout exactly)
And so on...
Alasdair G Kergon [Fri, 15 Aug 2014 12:45:55 +0000 (13:45 +0100)]
libdm: Add DM_DEFERRED_REMOVE to dm-ioctl.h.
Peter Rajnoha [Fri, 15 Aug 2014 11:31:11 +0000 (13:31 +0200)]
WHATS_NEW: previous commit
Peter Rajnoha [Fri, 15 Aug 2014 11:21:29 +0000 (13:21 +0200)]
report: lvs: properly display 'o' for volume type bit and 'C' for target type bit in lv_attr field for cache origin LVs
Before this patch:
LV VG Attr
[cache_orig_corig] vg -wi-ao----
With this patch applied:
LV VG Attr
[cache_orig_corig] vg owi-aoC---
Peter Rajnoha [Fri, 15 Aug 2014 11:08:30 +0000 (13:08 +0200)]
cache+thin: add lv_is_{cache,thin}_origin fn to identify origin LVs
Peter Rajnoha [Fri, 15 Aug 2014 11:03:21 +0000 (13:03 +0200)]
refactor: add defines for raid segtypes
This will be reused later on in upcoming code...
Alasdair G Kergon [Thu, 14 Aug 2014 00:30:01 +0000 (01:30 +0100)]
pvcreate: Fix cache state with filters/sig wiping.
_pvcreate_check() has two missing requirements:
After refreshing filters there must be a rescan.
(Otherwise the persistent filter may remain empty.)
After wiping a signature, the filters must be refreshed.
(A device that was previously excluded by the filter due to
its signature might now need to be included.)
If several devices are added at once, the repeated scanning isn't
strictly needed, but we can address that later as part of the command
processing restructuring (by grouping the devices).
Replace the new pvcreate code added by commit
54685c20fc9dfb155a2e5bc9d8cf5f0aad944305 "filters: fix regression caused
by commit
e80884cd080cad7e10be4588e3493b9000649426"
with this change to _pvcreate_check().
The filter refresh problem dates back to commit
acb4b5e4de3c49d36fe756f6fb9997ec179b89c2 "Fix pvcreate device check."
Peter Rajnoha [Wed, 13 Aug 2014 15:19:58 +0000 (17:19 +0200)]
tests: update report-select test for latest changes
Peter Rajnoha [Wed, 13 Aug 2014 13:39:03 +0000 (15:39 +0200)]
select: add support for selection to match string list subset, recognize { } operator
Using "[ ]" operator together with "&&" (or ",") inside causes the
string list to be matched if and only if all the items given match
the value reported and the number of items also match. This is
strict list matching and the original behaviour we already have.
In contrast to that, the new "{ }" operator together with "&&" inside
causes the string list to be matched if and only if all the items given
match the value reported but the number of items don't need to match.
So we can provide a subset in selection criteria and if the subset
is found, it matches.
For example:
$ lvs -o name,tags
LV LV Tags
lvol0 a
lvol1 a,b
lvol2 b,c,x
lvol3 a,b,y
$ lvs -o name,tags -S 'tags=[a,b]'
LV LV Tags
lvol1 a,b
$ lvs -o name,tags -S 'tags={a,b}'
LV LV Tags
lvol1 a,b
lvol3 a,b,y
So in the example above the a,b is subset of a,b,y and therefore
it also matches.
Clearly, when using "||" (or "#") inside, the { } and [ ] is the
same:
$ lvs -o name,tags -S 'tags=[a#b]'
LV LV Tags
lvol0 a
lvol1 a,b
lvol2 b,c,x
lvol3 a,b,y
$ lvs -o name,tags -S 'tags={a#b}'
LV LV Tags
lvol0 a
lvol1 a,b
lvol2 b,c,x
lvol3 a,b,y
Also in addition to the above feature, fix list with single value
matching when using [ ]:
Before this patch:
$ lvs -o name,tags -S 'tags=[a]'
LV LV Tags
lvol0 a
lvol1 a,b
lvol3 a,b,y
With this patch applied:
$ lvs -o name,tags -S 'tags=[a]'
LV LV Tags
lvol0 a
In case neither [] or {} is used, assume {} (the behaviour is not
changed here):
$ lvs -o name,tags -S 'tags=a'
LV LV Tags
lvol0 a
lvol1 a,b
lvol3 a,b,y
So in new terms 'tags=a' is equal to 'tags={a}'.
Peter Rajnoha [Wed, 13 Aug 2014 13:27:00 +0000 (15:27 +0200)]
select: fix string list selection to match whole words only but not prefixes of searched string
$ lvs -o name,tags vg/lvol0
LV LV Tags
lvol0 a
Before this patch:
$ lvs -o name,tags vg/lvol0 -S 'tags=[a]'
LV LV Tags
lvol0 a
$ lvs -o name,tags vg/lvol0 -S 'tags=[ab]'
LV LV Tags
lvol0 a
(incorrect!)
$ lvs -o name,tags vg/lvol0 -S 'tags=[abc]'
LV LV Tags
lvol0 a
(incorrect!)
With this patch applied:
$ lvs -o name,tags vg/lvol0 -S 'tags=[a]'
LV LV Tags
lvol0 a
$ lvs -o name,tags vg/lvol0 -S 'tags=[ab]'
(no result - correct!)
$ lvs -o name,tags vg/lvol0 -S 'tags=[abc]'
(no result - correct!)
Peter Rajnoha [Fri, 8 Aug 2014 08:49:19 +0000 (10:49 +0200)]
filter-mpath: fix primary device lookup failure for partition when processing mpath filter
If using persistent filter and we're refreshing filters (just like we
do for pvcreate now after commit
54685c20fc9dfb155a2e5bc9d8cf5f0aad944305),
we can't rely on getting the primary device of the partition from the cache
as such device could be already filtered by persistent filter and we get
a device cache lookup failure for such device.
For example:
$ lvm dumpconfig --type diff
devices {
obtain_device_list_from_udev=0
}
$lsblk /dev/sda
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 128M 0 disk
`-sda1 8:1 0 127M 0 part
$cat /etc/lvm/cache/.cache | grep sda
"/dev/sda1",
$pvcreate /dev/sda1
dev_is_mpath: failed to get device for 8:1
Physical volume "/dev/sda1" successfully created
The problematic part of the code called dev_cache_get_by_devt
to get the device for the device number supplied. Then the code
used dev_name(dev) to get the name which is then used in check
whether there's any mpath on top of this dev...
This patch uses sysfs to get the base name for the partition
instead, hence avoiding the device cache which is a correct
approach here.
Peter Rajnoha [Thu, 7 Aug 2014 14:44:09 +0000 (16:44 +0200)]
activation: if LV inactive and non-clustered, do not issue "Cannot deactivate" on -aln
The message "Cannot deactivate remotely exclusive device locally." makes
sense only for clustered LV. If the LV is non-clustered, then it's
always exclusive by definition and if it's already deactivated, this
message pops up inappropriately as those two conditions are met.
So issue the message only if the conditions are met AND we have clustered VG.
Peter Rajnoha [Thu, 7 Aug 2014 13:23:58 +0000 (15:23 +0200)]
pvmove: remove spurious "Skipping mirror LV" message on pvmove of clustered mirror
With cmirrord, we can do pvmove of clustered mirror. The code checking
suitability of LVs on the PV being moved issued a message if a mirror
LV was found and the VG was clustered. However, the actual pvmove did
work correctly.
The top-level mirror LV is actually skipped in the code since it's
always layered on top of internal LVs making up the mirror LV and for pvmove
we consider these internal devices only as they're actually layered on
top of concrete PVs then. But we don't need to issue any message here
about skipping the top-level mirror LV - it's misleading here.
Alasdair G Kergon [Tue, 5 Aug 2014 01:12:20 +0000 (02:12 +0100)]
post-release
Alasdair G Kergon [Tue, 5 Aug 2014 01:07:35 +0000 (02:07 +0100)]
pre-release
Alasdair G Kergon [Tue, 5 Aug 2014 01:04:16 +0000 (02:04 +0100)]
report: Remove lv_volume_type field.
Like lv_target_type, this field needs reworking.
Petr Rockai [Mon, 4 Aug 2014 15:36:12 +0000 (17:36 +0200)]
lvscan: Fix possible gcc warnings in --cache implementation.
Petr Rockai [Mon, 4 Aug 2014 15:05:08 +0000 (17:05 +0200)]
WHATS_NEW: lvscan --cache SEGV fix
Petr Rockai [Mon, 4 Aug 2014 15:02:26 +0000 (17:02 +0200)]
lvscan: Make --cache impervious to already-missing devices.
Petr Rockai [Mon, 4 Aug 2014 15:00:34 +0000 (17:00 +0200)]
test: Add a test for lvscan --cache.
Peter Rajnoha [Fri, 1 Aug 2014 09:28:18 +0000 (11:28 +0200)]
filters: fix regression caused by commit
e80884cd080cad7e10be4588e3493b9000649426
Commit
e80884cd080cad7e10be4588e3493b9000649426 tried to dump filters
for them to be reevaluated when creating a PV to avoid overwriting
any existing signature that may have been created after last
scan/filtering.
However, we need to call refresh_filters instead of
persistent_filter->dump since dump requires proper rescannig to fill
up the persistent filter again. However, this is true only for pvcreate
but not for vgcreate with PV creation where the scanning happens before
this PV creation and hence the next rescan (if not full scan), does not
fill the persistent filter.
Also, move refresh_filters so that it's called sooner and only for
pvcreate, vgcreate already calls lvmcache_label_scan(cmd, 2) which
then calls refresh_filters itself, so no need to reevaluate this again.
This caused the persistent filter (/etc/lvm/cache/.cache file) to be
wrong and contain only the PV just being processed with
vgcreate <vg_name> <pv_name_to_create>.
This regression caused other block devices to be filtered out in case
the vgcreate with PV creation was used and then the persistent filter
is used by any other LVM command afterwards.
Alasdair G Kergon [Thu, 31 Jul 2014 23:35:43 +0000 (00:35 +0100)]
lvresize: Allow approximation with +%FREE.
Make lvresize -l+%FREE support approximate allocation.
Move existing "Reducing/Extending' message to verbose level
and change it to say 'up to' if approximate allocation is being used.
Replace it with a new message that gives the actual old and new size or
says 'unchanged'.
Marian Csontos [Thu, 31 Jul 2014 20:56:19 +0000 (22:56 +0200)]
test: Skip lvextend-thin when thin not available
Peter Rajnoha [Thu, 31 Jul 2014 07:30:25 +0000 (09:30 +0200)]
metadata: remove spurious "Physical volume <dev_name> not found"
This is addendum to commit
2e82a070f3c9224da5c9f383d47e75a1715586cf
which fixed these spurious messages that appeared after commit
651d5093edde3e0ebee9d75be1c9834efc152d91 ("avoid pv_read in
find_pv_by_name").
There was one more "not found" message issued in case the device
could not be found in device cache (commit
2e82a07 fixed this only
for PV lookup itself). But if we "allow_unformatted" for
find_pv_by_name, we should not issue this message even in case
the device can't be found in dev cache as we just need to know
whether there's a PV or not for the code to decide on next steps
and we don't want to issue any messages if either device itself
is not found or PV is not found.
For example, when we were creating a new PV (and so allow_unformatted = 1)
and the device had a signature on it which caused it to be filtered
by device filter (e.g. MD signature if md filtering is enabled),
or it was part of some other subsystem (e.g. multipath), this message
was issued on find_pv_by_name call which was misleading.
Also, remove misleading "stack" call in case find_pv_by_name
returns NULL in pvcreate_check - any error state is reported
later by pvcreate_check code so no need to "stack" here.
There's one more and proper check to issue "not found" message if
the device can't be found in device cache within pvcreate_check fn
so this situation is still covered properly later in the code.
Before this patch (/dev/sda contains MD signature and is therefore filtered):
$ pvcreate /dev/sda
Physical volume /dev/sda not found
WARNING: linux_raid_member signature detected on /dev/sda at offset 4096. Wipe it? [y/n]:
With this patch applied:
$ pvcreate /dev/sda
WARNING: linux_raid_member signature detected on /dev/sda at offset 4096. Wipe it? [y/n]:
Non-existent devices are still caught properly:
$ pvcreate /dev/sdx
Device /dev/sdx not found (or ignored by filtering).
Alasdair G Kergon [Wed, 30 Jul 2014 20:55:11 +0000 (21:55 +0100)]
activation: Fix upgrades using uuid suffixes.
2.02.106 added suffixes to some LV uuids in the kernel.
If any of these LVs is activated with 2.02.105 or earlier,
and then a later version is used, the LVs appear invisible and
activation commands fail.
The code now has to check the kernel for both old and new uuids.
This page took 0.129514 seconds and 5 git commands to generate.