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

1755 Commits

Author SHA1 Message Date
Petr Rockai
f14f2d4378 lvmetad: Fix autoactivation for MDA-less PVs.
Calling pvscan --cache with -aay on a PV without an MDA would spuriously fail
with an internal error, because of an incorrect assumption that a parsed VG
structure was always available. This is not true and the autoactivation handler
needs to call vg_read to obtain metadata in cases where the PV had no MDAs to
parse. Therefore, we pass vgid into the handler instead of the (possibly NULL)
VG coming from the PV's MDA.
2012-12-12 13:19:04 +01:00
Peter Rajnoha
cad22be394 lvconvert: allow lvconvert --stripes/stripesize only with -mirrors/--repair/--thinpool
Also, update lvconvert man page to reflect this and make clear that
the --stripes/stripesize is applied to newly allocated space only.
2012-12-11 15:50:25 +01:00
Zdenek Kabelac
ed65860861 thin: remove detection for thin discard support
Remove no longer needed warning for unsuppoted discards
for non-power-2 lvcreate commands.

(Missed from the patch for the same update in lvchange made
by commit dde5a6c52b)
2012-12-11 11:24:45 +01:00
Peter Rajnoha
f942ae4a7a lvconvert: do not ignore -f in lvconvert --repair -y -f 2012-12-11 09:52:54 +01:00
Jonathan Brassow
3835755259 pvmove/RAID: Disallow pvmove on RAID LVs until properly handled
Attempting pvmove on RAID LVs replaces the kernel RAID target with
a temporary pvmove target, ultimately destroying the RAID LV.  pvmove
must be prevented on RAID LVs for now.

Use 'lvconvert --replace old_pv vg/lv new_pv' if you want to move
an image of the RAID LV.
2012-12-04 17:47:47 -06:00
Zdenek Kabelac
99018b37ee thin: lvconvert supports swapping metadata device
Support swapping of metadata device if the thin pool already
exists. This way it's easy to i.e. resize metadata or their
repair operation.

User may create some empty LV, replace existing metadata
or dump and restore them into bigger LV.
2012-12-02 18:01:27 +01:00
Zdenek Kabelac
ade2f47829 thin: deactivate subvolumes
Do not leave active thin data and metadata volumes
if activation of thin pool fails.
2012-12-02 17:56:44 +01:00
Zdenek Kabelac
dde5a6c52b thin: lvchange may change discards freely 2012-12-02 17:56:44 +01:00
Zdenek Kabelac
f0da2842cf thin: shuffle code
Reorder code lines for next patch.
2012-12-02 17:56:44 +01:00
Zdenek Kabelac
0be8a9126f thin: lvconvert update messages 2012-12-02 17:56:44 +01:00
Peter Rajnoha
fb8cc7c63f udev: do not verify udev operations for --noudevsync
If udev synchronization is disabled by means of --noudevsync
option, we should disable just the synchronization and nothing else.
The udev fallback (verifying udev operations and fixing the
nodes/symlinks if found incorrect) is orthogonal and controlled
by a separate activation/verify_udev_operations configuration option.
2012-11-29 13:59:12 +01:00
Zdenek Kabelac
09b7ceea95 thin: allow restore with --force
Allow restoring metadata with thin pool volumes.
No validation is done for this case within vgcfgrestore tool -
thus incorrect metadata may lead to destruction of pool content.
2012-11-27 14:08:24 +01:00
Zdenek Kabelac
c7a7fd0a12 thin: fix attrs for unloaded driver
If the driver is not loaded, set all 'features' ON
instead of all of them being OFF.
2012-11-27 11:29:47 +01:00
Zdenek Kabelac
1ef9831018 thin: support configurable thin pool defaults
Configurable settings for thin pool create
if they are not specified on command line.

New supported lvm.conf options are:
  allocation/thin_pool_chunk_size
  allocation/thin_pool_discards
  allocation/thin_pool_zero
2012-11-26 12:16:47 +01:00
Zdenek Kabelac
953080e4fc thin: add more unsupporte options for merge
Hmm, we need some smarter way to detect unsupported command
line options for various commands.
2012-11-26 12:15:32 +01:00
Jonathan Brassow
b3e9a09abe RAID: If no stripes argument is given for RAID10 create, default to 2
Similar to the way the 'mirror', 'raid1' and 'raid10' segment types set
the number of mirrors to 2 ('-m 1') if the argument is not specified,
here we set the number of stripes to 2 if not given on the command line
when creating a RAID10 LV.
2012-11-21 18:46:52 -06:00
Zdenek Kabelac
999952c5b9 thin: update recent patchset
Parse pool params only for creation of thin pools.
2012-11-19 16:28:00 +01:00
Zdenek Kabelac
1794f777f4 thin: lvcreate use common functions
Use common functions from toollib and eliminate code from here.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
b21d3e3592 thin: lvconvert update
Use common function from toollib and support allocation
of metadata LV with give thin pool data LV.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
b786096863 thin: add alloc_pool_metadata
Since our api call is not yet powerfull enough,
use this wrapper to preset options.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
f4137640f6 thin: add common pool functions
Move common functions for lvcreate and lvconvert.

get_pool_params() - read thin pool args.
update_pool_params() - updates/validates some thin args.

It is getting complicated and even few more things will be
implemented, so to avoid reimplementing things differently
in lvcreate and lvconvert  code has been splitted
into 2 common functions that allow some future extension.
2012-11-19 14:38:17 +01:00
Zdenek Kabelac
cf5242a670 lvconvert: store target attributes
Target tells us its version, and we may allow different set of options
to be supported with different version of driver.

Idea is to provide individual feature flags and later be
able to query for them.
2012-11-19 14:17:10 +01:00
Zdenek Kabelac
2c3bbf0a6c cleanup: move setting of parameter zero
Since we may need to use different default value,
move read of zero_ARG prior processing of parameters.
2012-11-19 14:15:43 +01:00
Jonathan Brassow
54c73b7723 mirror: Mirrored log should be fixed before mirror when double fault occurs
This patch is intended to fix bug 825323 - FS turns read-only during a double
fault of a mirror leg and mirrored log's leg at the same time.  It only
affects a 2-way mirror with a mirrored log.  3+-way mirrors and mirrors
without a mirrored log are not affected.

The problem resulted from the fact that the top level mirror was not
using 'noflush' when suspending before its "down-convert".  When a
mirror image fails, the bios are queue until a suspend is recieved.  If
it is a 'noflush' suspend, the bios can be safely requeued in the DM
core.  If 'noflush' is not used, the bios must be pushed through the
target and if a device is failed for a mirror, that means issuing an
error.  When an error is received by a file system, it results in it
turning read-only (depending on the FS).

Part of the problem was is due to the nature of the stacking involved in
using a mirror as a mirror's log.  When an image in each fail, the top
level mirror stalls because it is waiting for a log flush.  The other
stalls waiting for corrective action.  When the repair command is issued,
the entire stacked arrangement is collapsed to a linear LV.  The log
flush then fails (somewhat uncleanly) and the top-level mirror is suspended
without 'noflush' because it is a linear device.

This patch allows the log to be repaired first, which in turn allows the
top-level mirror's log flush to complete cleanly.  The top-level mirror
is then secondarily reduced to a linear device - at which time this mirror
is suspended properly with 'noflush'.
2012-11-14 14:58:47 -06:00
Peter Rajnoha
fc2644ae71 pvscan: exit --cache immediately if locking_type=3 || use_lvmetad=0 2012-11-09 15:56:57 +01:00
Zdenek Kabelac
5f5a5d1f53 lvchange: support --yes option for --persistent
Support using command: lvchange --yes --persistent
to skip y|n prompt.
2012-10-19 15:33:46 +02:00
Zdenek Kabelac
bc7d3b74f1 cleanup: fix typo in error message
yes -> yet
2012-10-19 15:32:27 +02:00
Zdenek Kabelac
c7c53ad41d pvcreate: fix leak on error path
Missing vg release on error path.
Add tests for few more error cases.
2012-10-19 15:32:21 +02:00
Zdenek Kabelac
f260f99d57 cleanup: switch log_error to log_warn
Use log_warn to print non-fatal warning messages.

Use of log_error would confuse checker for testing
whether proper error has been reported for some real error.
2012-10-17 15:41:35 +02:00
Zdenek Kabelac
b89963a7c3 cleanup: swap return values
Use lvm standard return code for success/fail  1/0.
2012-10-17 15:37:26 +02:00
Alasdair G Kergon
ea6a8078b4 release: prepare for release 2012-10-15 15:19:32 +01:00
Zdenek Kabelac
4573877186 lvchange: resync returns error on usupported volumes 2012-10-15 14:09:37 +02:00
Zdenek Kabelac
b3899056d9 thin: disable conversion of thin-pool to read-only
This change is not yet supported.
2012-10-15 14:09:11 +02:00
Zdenek Kabelac
2fc1fc3a93 thin: allow to create read-only thin-volumes
Useful for i.e. read-only thin snapshots.
2012-10-15 14:07:03 +02:00
Zdenek Kabelac
9bb210192d cleanup: readable test to check for 32bit overflow
also swap return value 0 - fail, 1 - success.
2012-10-14 23:19:27 +02:00
Zdenek Kabelac
16060b101b thin: lvextend will fail is autoextend is 0%
Since extending by 0% will not increase the size of pool,
return failure.
2012-10-14 23:17:30 +02:00
Zdenek Kabelac
31d8c3ee85 debug: do not play with fds with valgring
When valgrind usage is desired by user (--enable-valgrind-pool)
skip playing/closing/reopenning with descriptors - it makes
valgridng useless.

Make sleep delay for clvmd start longer.
2012-10-12 17:02:30 +02:00
Zdenek Kabelac
3058f662cf thin: prohibit lvcreate --thinpool with mirrors
Disable --thinpool to be used with mirror on lvcreate.
2012-10-12 12:21:45 +02:00
Petr Rockai
28776b9526 lvmetad: Make --sysinit suppress connection failure warnings. 2012-10-12 10:58:04 +02:00
Zdenek Kabelac
ca09c9ab4c thin: support non power of 2 chunk size
Support thin chunk size with multiple of 64KiB if user has
thin-pool target version at least 1.2.
2012-10-10 21:21:00 +02:00
Jonathan Brassow
3501f17fd0 [lv|vg]change: Allow limited metadata changes when PVs are missing
A while back, the behavior of LVM changed from allowing metadata changes
when PVs were missing to not allowing changes.  Until recently, this
change was tolerated by HA-LVM by forcing a 'vgreduce --removemissing'
before trying (again) to add tags to an LV and then activate it.  LVM
mirroring requires that failed devices are removed anyway, so this was
largely harmless.  However, RAID LVs do not require devices to be removed
from the array in order to be activated.  In fact, in an HA-LVM
environment this would be very undesirable.  Device failures in such an
environment can often be transient and it would be much better to restore
the device to the array than synchronize an entirely new device.

There are two methods that can be used to setup an HA-LVM environment:
"clvm" or "tagging".  For RAID LVs, "clvm" is out of the question because
RAID LVs are not supported in clustered VGs - not even in an exclusively
activated manner.  That leaves "tagging".  HA-LVM uses tagging - coupled
with 'volume_list' - to ensure that only one machine can have an LV active
at a time.  If updates are not allowed when a PV is missing, it is
impossible to add or remove tags to allow for activation.  This removes
one of the most basic functionalities of HA-LVM - site redundancy.  If
mirroring or RAID is used to replicate the storage in two data centers
and one of them goes down, a server and a storage device are lost.  When
the service fails-over to the alternate site, the VG will be "partial".
Unable to add a tag to the VG/LV, the RAID device will be unable to
activate.

The solution is to allow vgchange and lvchange to alter the LVM metadata
for a limited set of options - --[add|del]tag included.  The set of
allowable options are ones that do not cause changes to the DM kernel
target (like --resync would) or could alter the structure of the LV
(like allocation or conversion).
2012-10-10 11:33:10 -05:00
Peter Rajnoha
470d1a2f54 dmsetup: also apply 'mangle' command for UUIDs
Compared to names, UUIDs can't be renamed once they are created
for a device. The 'mangle' command will just issue an error message
about a need for manual intervention in this case - reactivating the
device (remove + create) does the job as the defualt mangling mode
used is "auto" and that will assign a correct mangled form the UUID.
2012-10-10 17:16:15 +02:00
Peter Rajnoha
788b7a6a2b dmsetup: add mangled/unmangled_uuid to for info -c
Following the same logic already used for name mangling.
2012-10-10 17:16:15 +02:00
Zdenek Kabelac
cdb7502e54 lvchange: do not start dmevent for resyn
If monitoring is disabled in lvm.conf, avoid its starting and preserve
DMEVENTD_MONITOR_IGNORE settings internally.
2012-10-09 12:22:26 +02:00
Zdenek Kabelac
5b07bd3f91 lvconvert: disable convertion of thin to mirrors
For now this convertions is not supported, thus disabled.
The only supported conversion for now is to create mirrored thin pools
from mirrored devices.
2012-10-08 12:16:53 +02:00
Zdenek Kabelac
a27650cc98 thin: lvconvert
Update code for lvconvert.
Change the lvconvert user interface a bit - now we require 2 specifiers
--thinpool   takes LV name for data device (and makes the name)
--poolmetadata  takes LV name for metadata device.

Fix type in thin help text -z -> -Z.

Supported is also new flag --discards for thinpools.
2012-10-03 15:13:33 +02:00
Zdenek Kabelac
e9f83147d5 thin: lvchange allows to change perms of thin snap
Thin snapshots are individual thin volumes so they can have its own
control for rw permissions.
2012-10-03 15:13:32 +02:00
Zdenek Kabelac
4648d33d07 cleanup: add proper cast for force_t 2012-10-03 15:06:17 +02:00
Zdenek Kabelac
739092e64a liblvm2cmd: ensure standard descriptors are ready
Check if FDs 0,1,2 are available, and in case they are missing,
use /dev/null for them.
2012-10-03 15:02:26 +02:00
Zdenek Kabelac
1f30e048bd liblvm2cmd: add return code for _close_stray_fds
Close fds via /proc/self/fd parsing
Return error code if _close_stray_fds fails and quit application
if system is in some nonstandard state.
2012-10-03 15:01:23 +02:00