1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

7444 Commits

Author SHA1 Message Date
Zdenek Kabelac
698137ec38 cleanup: add gcc attribute for printf parameter 2013-04-12 11:26:31 +02:00
Zdenek Kabelac
2e39392daf cleanup: remove unused lvl_idx 2013-04-12 11:26:31 +02:00
Zdenek Kabelac
4cce09dbdb lvmcache: keep sp_count unsigned 2013-04-12 11:26:31 +02:00
Jonathan Brassow
719e908bc0 WHATS_NEW: Add WHATS_NEW entry for previous commit. 2013-04-11 16:03:24 -05:00
Jonathan Brassow
faeea37057 RAID: Revert previous commit that allowed identical table loads.
Revert commit 31c24dd9f2.  This commit
was used to force a RAID device-mapper table to be loaded into the
kernel despite the fact that it was identical to the one already
loaded.  The effect allowed a RAID array with a transiently failed
device to refresh and reintegrate the failed device.  This operation
is better done in the kernel on a 'resume'.  Since,
'lvchange --refresh' already performs a suspend/resume cycle, the
above commit is not needed once the kernel change is made.  Reverting
the commit removes an unnecessary (at least for now) change to the
device-mapper interface.
2013-04-11 15:57:14 -05:00
Jonathan Brassow
ff64e3500f RAID: Add scrubbing support for RAID LVs
New options to 'lvchange' allow users to scrub their RAID LVs.
Synopsis:
	lvchange --syncaction {check|repair} vg/raid_lv

RAID scrubbing is the process of reading all the data and parity blocks in
an array and checking to see whether they are coherent.  'lvchange' can
now initaite the two scrubbing operations: "check" and "repair".  "check"
will go over the array and recored the number of discrepancies but not
repair them.  "repair" will correct the discrepancies as it finds them.

'lvchange --syncaction repair vg/raid_lv' is not to be confused with
'lvconvert --repair vg/raid_lv'.  The former initiates a background
synchronization operation on the array, while the latter is designed to
repair/replace failed devices in a mirror or RAID logical volume.

Additional reporting has been added for 'lvs' to support the new
operations.  Two new printable fields (which are not printed by
default) have been added: "syncaction" and "mismatches".  These
can be accessed using the '-o' option to 'lvs', like:
	lvs -o +syncaction,mismatches vg/lv
"syncaction" will print the current synchronization operation that the
RAID volume is performing.  It can be one of the following:
        - idle:   All sync operations complete (doing nothing)
        - resync: Initializing an array or recovering after a machine failure
        - recover: Replacing a device in the array
        - check: Looking for array inconsistencies
        - repair: Looking for and repairing inconsistencies
The "mismatches" field with print the number of descrepancies found during
a check or repair operation.

The 'Cpy%Sync' field already available to 'lvs' will print the progress
of any of the above syncactions, including check and repair.

Finally, the lv_attr field has changed to accomadate the scrubbing operations
as well.  The role of the 'p'artial character in the lv_attr report field
as expanded.  "Partial" is really an indicator for the health of a
logical volume and it makes sense to extend this include other health
indicators as well, specifically:
        'm'ismatches:  Indicates that there are discrepancies in a RAID
                       LV.  This character is shown after a scrubbing
                       operation has detected that portions of the RAID
                       are not coherent.
        'r'efresh   :  Indicates that a device in a RAID array has suffered
                       a failure and the kernel regards it as failed -
                       even though LVM can read the device label and
                       considers the device to be ok.  The LV should be
                       'r'efreshed to notify the kernel that the device is
                       now available, or the device should be 'r'eplaced
                       if it is suspected of failing.
2013-04-11 15:33:59 -05:00
Peter Rajnoha
e7ccad2ef0 config: remove typo in handling devices/write_cache_state config
...which caused the cmd->dump_filter to be always set irrespective
of the actual devices/write_cache_state setting.
2013-04-11 16:32:10 +02:00
Petr Rockai
91c9771fc3 test: Re-instate exec in lvm-wrapper, catching crashes inside not. 2013-04-11 16:22:35 +02:00
Jonathan Brassow
cbcbb67731 mirror: Fix overly-concerning warning on mirror up-convert failure.
Attempting to up-convert an inactive mirror when there is insufficient
space leads to the following message:
  Unable to allocate extents for mirror(s).
  ABORTING: Failed to remove temporary mirror layer inactive_mimagetmp_3.
  Manual cleanup with vgcfgrestore and dmsetup may be required.
This is caused by a failure to execute the 'deactivate_lv' function in
the error condition.  The deactivate returns an error because the LV is
already inactive.  This patch checks if the LV is activate and calls
deactivate_lv only if it is.  This allows the error cleanup code to work
properly in this condition.

It wasn't that big of a deal anyway, since there was no previous vg_commit
that needed to be reverted.  IOW, no harm was done if the allocation failed.
The message was scary and useless.
2013-04-10 16:47:04 -05:00
Jonathan Brassow
95d28735ea WHATS_NEW: Include entry for RAID status func improvements 2013-04-08 15:17:12 -05:00
Jonathan Brassow
38f8f4a958 RAID: Capture new RAID kernel sync_action status fields
I've updated the dm_status_raid structure and dm_get_status_raid()
function to make it handle the new kernel status fields that will
be coming in dm-raid v1.5.0.  It is backwards compatible with the
old status line - initializing the new fields to '0'.  The new
structure is also more amenable to future changes.  It includes a
'reserved' field that is currently initialized to zero but could
be used to hold flags describing new features.  It also now uses
pointers for the character strings instead of attempting to allocate
their space along with the structure (causing the size of the
structure to be variable).  This allows future fields to be appended.

The new fields that are available are:
 - sync_action : shows what the sync thread in the kernel is doing
                 (idle, frozen, resync, recover, check, repair, or
                 reshape)
 - mismatch_count: shows the number of discrepancies which were
                   found or repaired by a "check" or "repair"
                   process, respectively.
2013-04-08 15:04:08 -05:00
Zdenek Kabelac
c22e925ce4 man: lvceate document external origin snapshot
Document added support for external origin.
2013-04-05 14:15:03 +02:00
Zdenek Kabelac
ddafa0115e man: updates for lvconvert and lvcreate
Cleanup and improvement on man pages.
2013-04-05 14:14:20 +02:00
Zdenek Kabelac
3fd0242a0a libdm: validate params for NULL
Validate passed params and report error
instead of dereferencing NULL passed argument.
2013-04-05 14:13:12 +02:00
Petr Rockai
72921d7922 test: Invalidate .cache after vgimportclone. 2013-04-03 22:08:46 +02:00
Petr Rockai
95372a852b lvmetad: Fix a memory leak introduced in 15fdd5c90d. 2013-04-03 13:46:12 +02:00
Petr Rockai
382fc878d7 lvmetad: Check for reappeared PVs. 2013-04-03 12:48:28 +02:00
Petr Rockai
00ed6759c8 lvmetad: Mark PVs visible to lvmetad but not to us as MISSING. 2013-04-03 11:40:29 +02:00
Zdenek Kabelac
6ac4cba276 tests: lvconvert external origin
Add tests for thin external origin support
2013-04-02 15:17:31 +02:00
Zdenek Kabelac
d24c01a414 thin: lvcreate external origin snapshot support 2013-04-02 15:17:31 +02:00
Zdenek Kabelac
435e0bb608 cleanup: indent line 2013-04-02 15:17:05 +02:00
Zdenek Kabelac
b57b394ebb cmdline: add arg_long_option_name
Add simple function to return long_name string option for given arg.
2013-04-02 15:16:53 +02:00
Zdenek Kabelac
2edf488b38 log: reenable abort
abort_on_internal_error got ignored with the new class logging commit.j
Put this check back in this return path, so the check is not skipped.
2013-04-02 15:16:04 +02:00
Peter Rajnoha
5c93f3997b metadata: use PV's internal UNLABELLED_PV flag more consistently
Set when new PV created, cleared on PV write.
2013-03-25 16:21:59 +01:00
Peter Rajnoha
32ae07cef1 pv_write: clean up non-orphan format1 PV write
...to not pollute the common and format-independent code in the
abstraction layer above.

The format1 pv_write has common code for writing metadata and
PV header by calling the "write_disks" fn and when rewriting
the header itself only (e.g. just for the purpose of changing
the PV UUID) during the pvchange operation, we had to tweak
this functionality for the format1 case and we had to assign
the PV the orphan state temporarily.

This patch removes the need for this format1 tweak and it calls
the write_disks with appropriate flag indicating whether this is
a PV write call or a VG write call, allowing for metatada update
for the latter one.

Also, a side effect of the former tweak was that it effectively
invalidated the cache (even for the non-format1 PVs) as we
assigned it the orphan state temporarily just for the format1
PV write to pass.

Also, that tweak made it difficult to directly detect whether
a PV was part of a VG or not because the state was incorrect.

Also, it's not necessary to backup and restore some PV fields
when doing a PV write:

  orig_pe_size = pv_pe_size(pv);
  orig_pe_start = pv_pe_start(pv);
  orig_pe_count = pv_pe_count(pv);
  ...
  pv_write(pv)
  ...
  pv->pe_size = orig_pe_size;
  pv->pe_start = orig_pe_start;
  pv->pe_count = orig_pe_count;

...this is already done by the layer below itself (the _format1_pv_write fn).

So let's have this cleaned up so we don't need to be bothered
about any 'format1 special case for pv_write' anymore.
2013-03-25 15:08:26 +01:00
Peter Rajnoha
784867d5bd WHATS_NEW: vgextend and PV with 0 MDAs 2013-03-19 15:41:34 +01:00
Peter Rajnoha
ea36d0501e cleanup: remove unused 'pv_by_path' fn
The pv_by_path might be also dangerous to use as it does not
count with any other metadata areas but the ones found on the PV
itself. If metadata was not found on the PV referenced by the path,
it returned no PV though it might have been referenced by metadata
elsewhere (on other PVs...).
2013-03-19 14:57:36 +01:00
Peter Rajnoha
7e5e2dd4ee vgextend: do not allow PV with 0 MDAs to be added while already in a VG
If extending a VG and including a PV with 0 MDAs that was already
a part of a VG, the vgextend allowed that PV to be added and we
ended up *with one PV in two VGs*!

The vgextend code used the 'pv_by_path' fn that returned a PV for
a given path. However, when the PV did not have any metadata areas,
the fn just returned a PV without any reference to existing VG.
Consequently, any checks for the existing VG failed.

[0] raw/~ # pvcreate --metadatacopies 0 /dev/sda
  Physical volume "/dev/sda" successfully created

[0] raw/~ # pvcreate --metadatacopies 1 /dev/sdb
  Physical volume "/dev/sdb" successfully created

[0] raw/~ # vgcreate vg1 /dev/sda /dev/sdb
  Volume group "vg1" successfully created

[0] raw/~ # pvcreate --metadatacopies 1 /dev/sdc
  Physical volume "/dev/sdc" successfully created

[0] raw/~ # vgcreate vg2 /dev/sdc
  Volume group "vg2" successfully created

Before this patch (incorrect):
[0] raw/~ # vgextend vg2 /dev/sda
  Volume group "vg2" successfully extended

With this patch (correct):
[0] raw/~ # vgextend vg2 /dev/sda
  Physical volume '/dev/sda' is already in volume group 'vg1'
  Unable to add physical volume '/dev/sda' to volume group 'vg2'.
2013-03-19 14:57:36 +01:00
Peter Rajnoha
59878d0129 metadata: add 'allow_orphan' arg to find_pv_by_name fn
Before, the find_pv_by_name call always failed if the PV found was orphan.
However, we might use this function even for a PV that is not part of any VG.
This patch adds 'allow_orphan' arg to find_pv_by_name fn that allows that.
2013-03-19 14:57:31 +01:00
Peter Rajnoha
5b6bab2e30 cleanup: remove superfluous wrappers
_find_pv_by_name -> find_pv_by_name
_find_pv_in_vg -> find_pv_in_vg
_find_pv_in_vg_by_uuid -> find_pv_in_vg_by_uuid

The only callers of the underscored variants were their wrappers
without the underscore. No other part of the code referenced the
underscored variants.
2013-03-19 13:58:02 +01:00
Zdenek Kabelac
562ad293fd thin: rework lvconvert
Usage of layer was not the best plan here - for proper devices stack
we have to keep correct reference in volume_group structure and
make the new thin pool LV appear as a new volume.
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
9cf00666b3 thin: cannot use snapshot merge with thinpool 2013-03-13 15:13:54 +01:00
Zdenek Kabelac
0191d99906 thin: assign through structure
Just simplify code.
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
f572bf987e thin: read paramaters in front
Fill paramaters into lvconvert_params -
so we could use it independently on args()
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
82eee72019 thin: lvconvert read params sooner
Move code for reading stripesize and readahead to the
_read_params function.
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
b36a776a7f thin: move update_pool_params
Now we may recongnize preset arguments, move
the code for updating thin pool related values
into /lib portion of the code.
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
f06dd8725a thin: mark passed args
Keep the flag whether given thin pool argument has been given on command
line or it's been 'estimated'

Call of update_pool_params() must not change cmdline given args and
needs to know this info.

Since there is a need to move this update function into /lib, we cannot
use arg_count().

FIXME: we need some generic mechanism here.
2013-03-13 15:13:54 +01:00
Zdenek Kabelac
b9fe52e811 cleanup: move comment 2013-03-13 15:13:50 +01:00
Zdenek Kabelac
293a06c39a cleanup: indent 2013-03-13 15:13:42 +01:00
Peter Rajnoha
521a0a3323 dmsetup: fix 'splitname -o' to not fail if used without '-c'
This was a regression introduced with e33fd978a8
(libdm v1.02.68/lvm2 v2.02.89) with the introduction of new output
fields blkdevname and blkdevs_used for ls and deps dmsetup commands.

A new common '_process_options' fn was added with that commit, but the
fn was called prematurely which then broke processing of
'dmsetup splitname -o' which should implicitly use '-c' option
and this was failing after the commit:

  alatyr/~ $ dmsetup splitname -o lv_name /dev/mapper/vg_data-test
  Option not recognised: lv_name
  Couldn't process command line.

The '-c' had to be used for correct operation:

  alatyr/~ $ dmsetup splitname -c -o lv_name /dev/mapper/vg_data-test
  LV
  test

Now fixed to work as it did before:

  alatyr/~ $ dmsetup splitname -o lv_name /dev/mapper/vg_data-test
  LV
  test
2013-03-12 13:01:57 +01:00
Alasdair G Kergon
cbfb5a98b5 filters: power2 devs get precedence if PVIDs match
Give precedence to EMC "power2" devices with duplicate PVIDs like
we already do with "emcpower" devices.
2013-03-11 20:10:49 +00:00
Jonathan Brassow
69ae454d4d test: Fix the way in_sync calculates the sync field location
'in_sync' was using the last field in the RAID status output as
the location for the sync ratio field.  The sync ratio may not always
be the last field, but it will always be the 7th field.  So we switch
to using the absolute value rather than computing the last field
index number.
2013-03-06 11:12:09 -06:00
Jonathan Brassow
31c24dd9f2 RAID: Code changes missing from previous commit (bbc6378)
Previous commit included changes to WHATSNEW, but the code changes
were missing.  Here is the description from the previous commit:
commit bbc6378b73
Author: Jonathan Brassow <jbrassow@redhat.com>
Date:   Thu Feb 21 11:31:36 2013 -0600

    RAID:  Make 'lvchange --refresh' restore transiently failed RAID PVs

    A new function (dm_tree_node_force_identical_table_reload) was added to
    avoid the suppression of identical table reloads.  This allows RAID LVs
    to reload the on-disk superblock information that contains which devices
    have failed and the bitmaps.  If the failed device has returned, this has
    the effect of restoring the device and initiating recovery.  Without this
    patch, the user had to completely deactivate their RAID LV and re-activate
    it in order to restore the failed device.  Now they simply need to
    suspend and resume (which is done by 'lvchange --refresh').

    The identical table suppression is only avoided if the LV is not PARTAIL
    (i.e. all of it's devices can be seen and read by LVM) and the kernel
    status of the array contains failed devices.  In other words, the function
    will only be called in the case where we may have success in restoring
    a failed device in the array.
2013-03-06 10:17:11 -06:00
Jonathan Brassow
ed6f3945fd clean-up: Typo 's/should had/should have/' 2013-03-06 08:42:03 -06:00
Peter Rajnoha
6b777ccbb5 cleanup: get rid of compiler's warning about possible unitialized variable 2013-03-06 12:53:27 +01:00
Peter Rajnoha
f88690221b config: make DEFAULT_MAX_HISTORY unconditional 2013-03-06 12:47:23 +01:00
Peter Rajnoha
03b5c51730 WHATS_NEW: add lines for config validation support 2013-03-06 11:00:30 +01:00
Peter Rajnoha
7d6991e900 dumpconfig: add --ignoreadvanced and --ignoreunsupported switch
lvm dumpconfig [--ignoreadvanced] [--ignoreunsupported]

--ignoreadvanced causes the advanced configuration options to be left
out on dumpconfig output

--ignoreunsupported causes the options that are not officially supported
to be lef out on dumpconfig output
2013-03-06 10:46:36 +01:00
Peter Rajnoha
7fd04bd93a config: add comment note about advanced and unsupported config nodes
This shows up in the output as a short commentary:

  $ lvm dumpconfig --type default --withcomments metadata/disk_areas
  # Configuration option metadata/disk_areas.
  # This configuration option is advanced.
  # This configuration option is not officially supported.
  disk_areas=""
2013-03-06 10:46:36 +01:00
Peter Rajnoha
088d88cfe2 dumpconfig: add --withcomments and --withversions switch
lvm dumpconfig [--withcomments] [--withversions]

The --withcomments causes the comments to appear on output before each
config node (if they were defined in config_settings.h).

The --withversions causes a one line extra comment to appear on output
before each config node with the version information in which the
configuration setting first appeared.
2013-03-06 10:46:36 +01:00