1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00
Commit Graph

108 Commits

Author SHA1 Message Date
Zdenek Kabelac
87e80b6aac report: proper lv_attr_dup emulation
We need to create a mempool for proper emulation of lv_attr_dup
for lvm2api.
2015-01-20 16:24:45 +01:00
Zdenek Kabelac
d80d832ae9 report: seg_monitor undefined
Add 'undefined' value for segment which do not support monitoring.
Fixes crash for commands like 'pvs -o+seg_monitor'.
2015-01-20 15:02:10 +01:00
Zdenek Kabelac
b3a348c03c report: use same info also for lv_attr
Recently the single 'status' code has been used for number of cache
features.

Extend the API a little bit to allow usage also for lv_attr_dup.

As the function itself is used in lvm2api - add a new function:
lv_attr_dup_with_info_and_seg_status() that is able to use
grabbed info & status information.

report_init() is now using directly passed lvdm struct pointer
which holds the infomation whether lv_info() was correctly obtained or
there was some error when trying to read it.

Move 'healt' attribute to status.
TODO convert raid function to use the already known status.
2015-01-20 14:58:41 +01:00
Zdenek Kabelac
2908ab3eed thin: errrorwhenfull support
Support error_if_no_space feature for thin pools.
Report more info about thinpool status:
(out_of_data (D), metadata_read_only (M), failed  (F) also as health
attribute.)
2015-01-14 14:52:05 +01:00
Zdenek Kabelac
9f2961f259 cache: check for internal error
Don't try to duplicate NULL on internal error path.
2014-11-20 16:35:46 +01:00
Alasdair G Kergon
9a5910bdf9 pre-release 2014-11-11 14:13:00 +00:00
Zdenek Kabelac
f5e265a07f cache: use LV_PENDING_DELETE 2014-11-10 22:05:49 +01:00
Zdenek Kabelac
2e0c926d56 cleanup: API get/set fixes 2014-11-10 22:05:48 +01:00
Zdenek Kabelac
8d7340b7a1 report: for cache LV report chunksize
Cache LV reports chunksize via cache-pool.
2014-11-10 22:05:48 +01:00
Zdenek Kabelac
e2c4a3ef67 segtype: add SEG_ONLY_EXCLUSIVE flag
Mark segtypes which do require exclusive activation in cluster.r
2014-11-10 22:05:48 +01:00
Zdenek Kabelac
a3a2c792a8 lv: lv_active_change add needs_exclusive flag
Let's use this function for more activations in the code.

'needs_exlusive' will enforce exlusive type for any given LV.

We may want to activate LV in exlusive mode, even when we know
the LV (as is) supports non-exlusive activation as well.

lvcreate -ay   -> exclusive & local
lvcreate -aay  -> exclusive & local
lvcreate -aly  -> exclusive & local
lvcreate -aey  -> exclusive  (might be on any node).
2014-11-05 15:29:43 +01:00
Zdenek Kabelac
9411c19b31 segments: introduce lvseg_name
Instead of segtype->ops->name()  introduce lvseg_name().

This also allows us to leave name() function 'empty' for default
return of segtype->name.

TODO: add functions for rest of ops->
2014-10-24 16:39:30 +02:00
David Teigland
17ab39f743 cache: include cache mode in vg metadata and display
The cache mode of a new cache pool is always explicitly
included in the vg metadata.  If a cache mode is not
specified on the command line, the cache mode is taken
from lvm.conf allocation/cache_pool_cachemode, which
defaults to "writethrough".

The cache mode can be displayed with lvs -o+cachemode.
2014-10-02 11:17:41 -05:00
Zdenek Kabelac
e2312d28ed cleanup: switch to use CHANGE_AEY
Since for other enums we use 'Y' or 'N' use it with 'AE' as well.
2014-09-19 15:51:31 +02:00
Alasdair G Kergon
979be63f25 mirrors: Fix checks for mirror/raid/pvmove LVs.
Try to enforce consistent macro usage along these lines:

lv_is_mirror - mirror that uses the original dm-raid1 implementation
               (segment type "mirror")
lv_is_mirror_type - also includes internal mirror image and log LVs

lv_is_raid - raid volume that uses the new dm-raid implementation
             (segment type "raid")
lv_is_raid_type - also includes internal raid image / log / metadata LVs

lv_is_mirrored - LV is mirrored using either kernel implementation
                 (excludes non-mirror modes like raid5 etc.)

lv_is_pvmove - internal pvmove volume
2014-09-16 00:13:46 +01:00
Alasdair G Kergon
2360ce3551 cleanup: Use lv_is_ macros.
Use lv_is_* macros throughout the code base, introducing
lv_is_pvmove, lv_is_locked, lv_is_converting and lv_is_merging.

lv_is_mirror_type no longer includes pvmove.
2014-09-15 21:33:53 +01:00
Peter Rajnoha
1cd622d98b 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---
2014-08-15 13:28:43 +02:00
Peter Rajnoha
c52c9a1e31 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.
2014-08-07 16:44:09 +02:00
Zdenek Kabelac
4db5d78cef display: show C only for cache and cachepool
Keep target type (attr6) as the cache data and metadata volume has.
(i.e. when will show 'raid' type if metadata is raid)
2014-07-11 12:50:44 +02:00
Peter Rajnoha
c9ae21798e report: display 'unknown' value for active/active_locally/active_remotely/active_exclusively if info bypassed
Before the patch:

$ lvs -o name,active vg/lvol1 --driverloaded n
  WARNING: Activation disabled. No device-mapper interaction will beattempted.
  LV    Active
  lvol1 active

With this patch applied:
$ lvs -o name,active vg/lvol1 --driverloaded n
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  LV    Active
  lvol1 unknown

The same for active_{locally,remotely,exclusively} fields.
Also, rename headings for these fields (ActLocal/ActRemote/ActExcl).
2014-07-11 11:15:06 +02:00
Peter Rajnoha
a4734354ce refactor: remove static modifier for lv_raid_image_in_sync and lv_raid_healthy fn
...to make use of it in other parts of the code.
2014-07-04 15:40:17 +02:00
Alasdair G Kergon
ac60c876c4 vgsplit: Improve message when LV still active.
Mention parent LV as well as the LV triggering the warning.

Still leaves some confusing cases but its not worth fixing them
at the moment.
(Thin pool inactive but a thin volume active => deactivate thin vol.
Inactive mirror/raid with pvmove in progress => complete pvmove and
active&deactivate mirror/raid.
If new VG already exists it requires some LVs to be inactive
unnecessarily.)
2014-07-04 01:13:51 +01:00
Alasdair G Kergon
137ed3081a report: Add lv_parent field.
Only defined for thin/cache/raid/mirror at this stage as it
relies on get_only_segment_using_this_lv().
2014-07-03 23:49:34 +01:00
Alasdair G Kergon
64ce3a8066 report: Add lv_dm_path and lv_full_name fields. 2014-07-02 17:24:05 +01:00
Alasdair G Kergon
5bfa2ec21d report: Exclude hidden devices from lv_path field. 2014-07-02 14:57:00 +01:00
Zdenek Kabelac
f96a499c8d lv: fix lv_is_raid 2014-06-20 11:37:45 +02:00
Zdenek Kabelac
548269a1dd cleanup: use simplier test
Just like all other tests - use direct LV function test
2014-06-20 11:14:11 +02:00
Jonathan Brassow
c6d82c992b 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.
2014-06-19 10:57:08 -05:00
Peter Rajnoha
cfed0d09e8 report: select: refactor: move percent handling code to libdm for reuse 2014-06-17 16:27:21 +02:00
Zdenek Kabelac
952514611d cleanup: add seg_is_pool macro
Simplify code querying for pool segtype.
2014-05-23 21:36:55 +02:00
Zdenek Kabelac
62e8dd4f6e cleanup: indent 2014-04-30 10:26:30 +02:00
Zdenek Kabelac
62ad6dee18 lv: show X attr when lv_info fails
Print 'X' also when lv_info() fails.
(i.e. compilation with --disable-ioctl)
2014-04-30 10:26:29 +02:00
Zdenek Kabelac
517b002648 display: check for dmeventd support
When quering for dmeventd monitoring status, check first
if lvm2 is configured to monitor to avoid unwanted start
of dmeventd process for answering monitoring status.
2014-04-30 10:26:26 +02:00
Alasdair G Kergon
177ece01a9 reports: Use X for unknown LV attr when no dm.
It's safer not to tell people an LV is inactive when we aren't sure.
2014-04-18 02:23:39 +01:00
Zdenek Kabelac
962af71b76 mirror: look for mirror seg only in mirror LV
Find mirror seg only in MIRROR_IMAGE.
(in-release update)
2014-02-25 09:34:02 +01:00
Alasdair G Kergon
13c3f53f55 allocation: misc fixes for percent/raid rounding
Several fixes for the recent changes that treat allocation percentages
as upper limits.
Improve messages to make it easier to see what is happening.
Fix some cases that failed with errors when they didn't need to.
Fix crashes when first_seg() returns NULL.
Remove a couple of log_errors that were actually debugging messages.
2014-02-22 00:26:01 +00:00
Jonathan Brassow
36f9fadcb4 cache[pool]: Populate existing report fields with cache data
For the report fields that already exist that are relevent to cache
and cache pool LVs (like 'origin', 'metadata_lv', etc), populate
them.
2014-02-05 09:44:37 -06:00
Zdenek Kabelac
ff112eee18 thin: merge display 2013-12-04 14:30:26 +01:00
Zdenek Kabelac
9f6209b878 activation: improve activation
This patch fixes mostly cluster behavior but also updates
non-cluster reaction where calls like   'lvchange -aln'
lead to incorrect errors for some segment types.

Fix the implicit activation rules where some segment types could
be activated only in exclusive mode in cluster.
lvm2 command was not preserver 'local' property and incorrectly
converted local activations in to plain exclusive, so the local
activation could have activate volumes exclusively, but remotely.
2013-11-01 13:03:50 +01:00
Jonathan Brassow
f58b26b633 RAID: Report RAID images split with tracking as out-of-sync ("I").
Split image should have an out-of-sync attr ('I') - always.  Even if
the RAID LV has not been written to since the LV was split off, it is
still not part of the group that makes up the RAID and is therefore
"out-of-sync".
2013-10-14 10:48:44 -05:00
Jonathan Brassow
2691f1d764 RAID: Make RAID single-machine-exclusive capable in a cluster
Creation, deletion, [de]activation, repair, conversion, scrubbing
and changing operations are all now available for RAID LVs in a
cluster - provided that they are activated exclusively.

The code has been changed to ensure that no LV or sub-LV activation
is attempted cluster-wide.  This includes the often overlooked
operations of activating metadata areas for the brief time it takes
to clear them.  Additionally, some 'resume_lv' operations were
replaced with 'activate_lv_excl_local' when sub-LVs were promoted
to top-level LVs for removal, clearing or extraction.  This was
necessary because it forces the appropriate renaming actions the
occur via resume in the single-machine case, but won't happen in
a cluster due to the necessity of acquiring a lock first.

The *raid* tests have been updated to allow testing in a cluster.
For the most part, this meant creating devices with '-aey' if they
were to be converted to RAID.  (RAID requires the converting LV to
be EX because it is a condition of activation for the RAID LV in
a cluster.)
2013-09-10 16:33:22 -05:00
Zdenek Kabelac
915cc5a2fa thin: report 'e' volume type pool metadata spare
Reuse m'e'tadata volume type for spar'e' volume as well.
Essentially they are related and there is no big reason
to introduce new flag.
2013-07-18 18:22:44 +02:00
Peter Rajnoha
283c93a858 lvs: add 's(k)ip activatoin' lv_attr field
A new 10-th bit in lvs lv_attr field to indicate whether an LV
has the ACTIVATION_SKIP flag attached (stored in metadata).
2013-07-12 20:54:17 +02:00
Mike Snitzer
f9e0adcce5 snapshot: Rename snapshot segment returning methods from find_*_cow to find_*_snapshot
find_cow -> find_snapshot, find_merging_cow -> find_merging_snapshot.
Will thin snapshot code to reuse these methods without confusion.
2013-07-02 16:26:03 -04:00
Peter Rajnoha
9f6cfc9de4 report: add vg_profile and lv_profile to report the profile attached to VG/LV
vgs -o vg_profile ...
lvs -o lv_profile ...
2013-07-02 15:22:12 +02:00
Peter Rajnoha
6f0427cc56 lv: add lv_config_profile fn
Returns LV's profile if it exists, VG's profile otherwise
(LV inherits VG's profile).
2013-07-02 15:22:11 +02:00
Zdenek Kabelac
5d73c0c674 cleanup: access pool segs with check
Add some minor checks after first_seg(lv).
Use direct check for thin pool segment.
Drop some unneeded {}
2013-06-16 00:07:33 +02:00
Zdenek Kabelac
01ef97fcbb thin: report 'e' metadata type with higher priority
Giving volume type information about being 'metadata' type of volume
has higher priority then i.e.  'mirror' or 'thin' flag - for those
type we have 'target attr' (7th. field).
2013-06-11 14:03:08 +02:00
Zdenek Kabelac
c0290489c3 thin: report o as volume type for external origin
Reuse 'o' attr for lvs report also for external origin.
2013-06-11 14:02:41 +02:00
Zdenek Kabelac
7151ede767 thin: report t for thin pool and volume
Do not mark internal device _tdata and _tmeta as having target type 't'.
They have the target type on their own (i.e. mirror, raid).
2013-06-11 13:58:16 +02:00