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

2402 Commits

Author SHA1 Message Date
Alasdair Kergon
8a689fd04d Fix allocation policy loop so it doesn't continue beyond cling using later
policies it shouldn't be using when --alloc cling is specified but no tags
are defined.
2012-05-11 22:19:12 +00:00
Alasdair Kergon
01cfbe14f1 Append _TO_LVSEG to names of internal A_CONTIGUOUS and A_CLING flags.
Remove some unnecesary prev_lvseg checks.
2012-05-11 18:59:01 +00:00
Zdenek Kabelac
767ce95a11 Add missing pkg init 2012-05-10 08:54:33 +00:00
Peter Rajnoha
9c17acdfe8 Fix division by zero if PV with zero PE count is used during vgcfgrestore. 2012-05-09 12:30:56 +00:00
Zdenek Kabelac
0a9f894ff0 Initial support for lvconvert for thin pool volumes.
Support has many limitations and lots of FIXMEs inside,
however it makes initial task when user creates a separate LV for
thin pool data and thin metadata already usable, so let's enable
it for testing.

Easiest API:

lvconvert --chunksize XX --thinpool data_lv  metadata_lv

More functionality extensions will follow up.

TODO: Code needs some rework since a lot of same code is getting copied.
2012-05-09 12:17:06 +00:00
Zdenek Kabelac
98f2e3d974 Fix regression in for_each_sub_lv
pool_lv is not a sub lv in terms for this function.
It has caused problem with renaming thin_volume, where it has tried to
rename pool LV as well.
2012-05-09 12:12:21 +00:00
Jonathan Earl Brassow
eb2d70293d Fix up-convert when mirror activation is controled by volume_list and tags.
When mirrors are up-converted, a transient mirror layer is put in so that
only the new devices are sync'ed.  That transient layer must carry the tags
of the original mirror LV, otherwise it will fail to activate when activation
is regulated by lvm.conf:activation/volume_list.  The conversion would then
fail.

The fix is to do exactly the same thing that is being done for linear ->
mirror converting (lib/metadata/mirror.c:_init_mirror_log()).  We copy the
tags temporarily for the new LV and remove them after the activation.
2012-05-05 02:08:46 +00:00
Jonathan Earl Brassow
1e4e9548b1 Disallow snapshots of mirror segment types.
Snapshots of RAID logical volumes are allowed (including "raid1").  However,
snapshots of "mirror" logical volumes has been disallowed due to unsolvable
issues inherent to the design.  The fact that mirroring (dm-raid1.c) must
stop all I/O as the result of a failure and wait for userspace intervention
can lead to a circular dependency if userspace is simultaneously waiting for
snapshots (on mirrors) to make an I/O update before proceeding.

Various snapshot on mirror tests have been removed as a result.
2012-05-01 19:21:24 +00:00
Jonathan Earl Brassow
e5b9338ada Fix bug in cmirror that caused incorrect status info to print on some nodes.
Looking at the code in cmirrord/local.c, we can see the various different
request types handled in different ways.  Some information that is non-changing
does not need to go around the cluster and can be short-circuited.  For
example, once the cluster mirror is in-sync, it is pointless to continue
sending that query around the cluster.  We can save network bandwidth and reply
directly back to the kernel.  When it comes to status information, there are
two types 'TABLE' and 'INFO'.  The 'TABLE' information never changes and
belongs to the group of requests that can be safely short-circuited.  The
'STATUS' information can change - and will change if a device fails.  Thus it
cannot be short-circuited, but this is exactly what was found.  The 'STATUS'
information request was being short-circuited and therefore never reporting the
failure condition to anyone other than the "server" that experienced it
directly.
2012-04-26 17:30:49 +00:00
Alasdair Kergon
34fbbfe34e Remove statement that snapshots cannot be tagged from lvm man page. 2012-04-26 15:24:46 +00:00
Jonathan Earl Brassow
ac6e1e3e8d Disallow changing cluster attribute of VG while RAID LVs are active.
Mirror and snapshot LVs are already checked for when switching the cluster
attribute of a VG.  This patch adds RAID.
2012-04-25 13:38:41 +00:00
Peter Rajnoha
c70037445a WHATS_NEW 2012-04-25 09:32:36 +00:00
Jonathan Earl Brassow
dfd024d3a8 Allow a subset of failed devices to be replaced in RAID LVs.
If two devices in an array failed, it was previously impossible to replace
just one of them.  This patch allows for the replacement of some, but perhaps
not all, failed devices.
2012-04-24 20:05:31 +00:00
Jonathan Earl Brassow
2bfb3e519a Prevent resume from creating error devices that already exist from suspend.
Thanks to agk for providing the patch that prevents resume from attempting
(and then failing) to create error devices which already exist; having been
created by a corresponding suspend operation.
2012-04-24 20:00:03 +00:00
Zdenek Kabelac
8262a3f6ca Update singlenode locking
Support lock conversion
Work also with LCK_READ
TODO: do more validation.
2012-04-24 12:16:40 +00:00
Zdenek Kabelac
a8f352fd56 Update some lvs column names
Fix thin_pool -> pool_lv
Add more fields supported by thin provisioning.
Keep fields alphabetically sorted for easier lookup.
2012-04-24 12:13:29 +00:00
Alasdair Kergon
067184f32d Handle replacement of an active device that goes missing with an error device.
(E.g. lvchange --refresh --partial on striped LV if a PV disappeared.)
2012-04-24 00:51:26 +00:00
Jonathan Earl Brassow
c62f9f0b2f Unlike 'mirror' segtype, 'raid1' should perform flush on suspend.
The 'mirror' segtype and 'raid1' segtype both set the 'MIRRORED' flag.
However, due to differences in the way these device-mapper targets behave
'mirror' must be suspended with the 'noflush' option and 'raid1' does not
have to be.

This patch ensures that when the 'MIRRORED' flag is checked to see if
'noflush' is needed that it does not also set it for 'raid1' by mistake.
2012-04-20 14:17:44 +00:00
Peter Rajnoha
973cfb19b7 Add udev info and context to lvmdump.
--------------------------------------------------------------------
2012-04-18 15:26:02 +00:00
Jonathan Earl Brassow
a7feae8a6e Fix code that performs RAID device replacement while under snapshot.
The code should have been calling [suspend|resume]_lv_origin() rather than
[suspend|resume]_lv.

This addresses bug 807069.
2012-04-12 03:16:37 +00:00
Jonathan Earl Brassow
187486c7bb Fix inability to split RAID1 image while specifying a particular PV.
The logic for resuming the original and newly split LVs was not properly
done to handle situations where anything but the last device in the array
was split.  It did not take into account the possible name collisions that
might occur when the original LV undergoes the shifting and renaming of its
sub-LVs.
2012-04-11 14:20:19 +00:00
Zdenek Kabelac
c63b155d16 Update man pages
Use one style for man pages.
2012-04-11 12:42:10 +00:00
Zdenek Kabelac
5dc27b75eb Fix lvresize for thin pool
When resizing thin pool - we need to use strip info from  _tdata volume.
In future more generic solution will be necessary once we start to support
lvconvert (resize of stacked devices and stay properly aligned).
For now we just allow striped or linear LV so this code will work.
2012-04-11 12:40:03 +00:00
Zdenek Kabelac
6fc1f948c2 Lvresize rounds upward
When given lvresize new size - round upward for stripes - unless we use % and
we are at the border of free extents.

This patch is not a complete fix and few more cases will need special care.
2012-04-11 12:36:37 +00:00
Zdenek Kabelac
c6f3701a71 Support rounding downward for lvcreate and %
If specifying size with % and we are reaching number
of free extents - round downward with stripes.
2012-04-11 12:33:34 +00:00
Peter Rajnoha
30bd294fc6 Change message severity to log_very_verbose for missing dev info in udev db.
Libudev does not provide transactions when querying udev database - once we
get the list of block devices (devices/obtain_device_list_from_udev=1) and
we iterate over the list to get more detailed information about device node
and symlink names used etc., the device could be removed just in between we
get the list and put a query for more info. In this case, libudev returns
NULL value as the device does not exist anymore.

Recently, we've added a warning message to reveal such situations. However,
this could be misleading if the device is not related to the LVM action
we're just processing - the non-related block device could be removed in
parallel and this is not an error but a possible and normal operation.

(N.B. This "missing info" should not happen when devices are related to
the LVM action we're just processing since all such processing should be
synchronized with udev and the udev db must always be in consistent state
after the sync point. But we can't filter this situation out from others,
non-related devices, so we have to lower the message verbosity here for a
general solution.)
2012-04-11 09:12:02 +00:00
Jonathan Earl Brassow
c0b5886f18 RAID LVs could not handle a down-convert if a device other than the last one
in the array was specified for removal.  This change addresses that (bz806111).
2012-04-11 01:23:29 +00:00
Jonathan Earl Brassow
bad8b5848f Commit ID 46a75dedb4 consolidated code from the
various dmeventd plug-ins into a new function called 'dmeventd_lvm2_command',
but the new function did not strip off the "_mlog" extentions that the
mirror plug-in had been doing.  This created bug 794904 - failure to replace
devices in a redundant log.

The test suite did catch this scenario because it performs repair tests (mainly)
through the CLI and not dmeventd.  It's also not easy to test because the test
itself will hang if the bug is encountered.
2012-04-10 23:34:41 +00:00
Zdenek Kabelac
6e826bb6a4 Fix unlocking in error path of vgreduce
When vg_read fails, it internally unlocks VG if it's been locked,
so in error path we should skip unlock_vg for this case.
(user would see ugly internal warning)
2012-03-30 14:59:35 +00:00
Peter Rajnoha
ebd9225245 WHATS_NEW 2012-03-30 11:39:52 +00:00
Peter Rajnoha
543eaed88c Detect VG name being part of the LV name in lvconvert --splitmirrors -n.
Before:
devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one
  Internal error: LV name vg/splitted_one has invalid form.
  Intermediate VG metadata write failed.

After:
devel/~ # lvconvert --splitmirrors 1 -n vg/splitted_one vg/mirrored_one
  Logical volume mirrored_one converted.

devel/~ # lvconvert --splitmirrors 1 -n abc/splitted_one vg/mirrored_one
  Please use a single volume group name ("vg" or "abc")
  Run `lvconvert --help' for more information.
2012-03-30 08:58:02 +00:00
Milan Broz
46e9aac160 Fix exclusive lvmchange -aey to fail if volume is active on different node.
Activation on remote node should be tried only if it is masked by tags
locally (like when hosttags enabled, IOW activate_lv_excl_local()
doesn't return error.)

Introduced change caused that lvchange -aey succeeded even if volume was
activated exclusively remotely.
2012-03-27 15:53:45 +00:00
Peter Rajnoha
3be9089cd3 Add 'vgscan --cache' functionality for consistency with 'pvscan --cache'.
Calling vgscan alone should reuse information from the lvmetad (if running).
The --cache option should initiate direct device scan and update lvmetad
appropriately (if running).

This is mainly for vgscan to behave consistently compared to pvscan.
2012-03-27 11:04:46 +00:00
Milan Broz
ddb31b62e5 Keep exclusive activation in pvmove if LV is already active.
Pvmove should never try to downgrade exclusive lock
for LVs.

This allows pvmove to work again for exclusive activated LVs.
2012-03-26 20:33:40 +00:00
Milan Broz
dcd90bc501 Do not allow pvmove if some affected LVs are activated
locally or on more nodes while others are activated exclusively.

Current pvmove code can either use local mirror (for exclusive
activation) or cmirror (for clustered LVs).

Because the whole intenal pvmove LV is just segmented LV containing
segments of several top-level LVs, code cannot properly handle
situation if some segment need to be activated exclusively.

Previously, it wrongly activated exclusive LV on all nodes
(locing code allowed it) but now this is no lnger possible.

If there is exclusively activated LV, pvmove is only
possible if all affected LVs are aslo activated exclusively.

(Note that in non-exclusive mode pvmove still activates LVs
on other nodes during move.)

# lvchange -aly vg_test/lv1
# lvchange -aey vg_test/lv2
# pvmove -i 1 /dev/sdc
   Error locking on node bar-01: Device or resource busy
   Error locking on node bar-03: Volume is busy on another node
...
   Failed to activate lv2
2012-03-26 20:32:58 +00:00
Milan Broz
62a40438ab Remove unused and wrongly set cluster VG flag from clvmd lock query command. 2012-03-26 20:29:45 +00:00
Milan Broz
7076d1439b Fix pvmove if LV is activated exclusively but cmirror is not running.
In this case we should allow to use local mirror, check for cmirror
should apply only for lvconvert/lvcreate.

Introduced in 2.02.86 by removing !(lv->status & ACTIVATE_EXCL).

(Partially workaround, it is minimalistic patch for now.)
2012-03-23 16:28:40 +00:00
Zdenek Kabelac
0fc9a3dce3 Always free hash table
also in error path
2012-03-23 10:33:26 +00:00
Zdenek Kabelac
2caa558e7c Update and fix monitoring of thin pool devices
Code adds better support for monitoring of thin pool devices.
update_pool_lv uses DMEVENTD_MONITOR_IGNORE to not manipulate with monitoring.
vgchange & lvchange are checking real thin pool device for existance
as we are using   _tpool  real device and visible LV pool device might not
be even active (_tpool is activated implicitely for any thin volume).
monitor_dev_for_events is another _lv_postorder like code it might be worth
to think about reusing it here - for now update the code to properly
monitory thin volume deps.
For unmonitoring add extra code to check the usage of thin pool - in case it's in use
unmonitoring of thin volume is skipped.
2012-03-23 09:58:04 +00:00
Zdenek Kabelac
5da4d94adc Return mem fail if hash insert fails 2012-03-23 09:48:17 +00:00
Zdenek Kabelac
fbd89d3a1a Fix typo in config option check 2012-03-23 09:42:36 +00:00
Zdenek Kabelac
1d6a2c7326 Update lcov target 2012-03-23 09:39:03 +00:00
Zdenek Kabelac
0b17a75f13 Fix regression in thin monitoring
Patch https://www.redhat.com/archives/lvm-devel/2012-February/msg00118.html
removed initilization of thin volume monitoring, leaving it only for
thin pool - but missed the code move part for monitoring of thin pools.
Effectively making thin pools not monitorable.
2012-03-20 17:42:19 +00:00
Zdenek Kabelac
37672e676d Support improperly formated device numbers
There are kernel drivers (smblk) which set '-1' as their device major number.
This number is listed in /proc/devices then - but the kernel itself is using
just 12 bits - thus device is accessible via 4095 - there is posted patch
for 3.4 to fix this behavior (0 for auto allocation was mean to be used).

However to still allow using such devices with older kernels add some code
to use same behavior - so cut 12 bits from the major number from /proc/devices.

For now use log_warn() - maybe the severity of the message could be lowered
to just verbose level.
2012-03-20 10:47:02 +00:00
Zdenek Kabelac
a9382908ae Fix string parsing
Fix propagation of -e option - pass it via internal shell variable.
Fix parsing of /proc/mounts files (don't check for substrings).
 as reported by O.Mangold with suggested patch:
 https://www.redhat.com/archives/linux-lvm/2012-February/msg00030.html
Properly pass arguments with spaces ("$@")
Add validation for YES and EXTOFF variable content.
2012-03-16 12:53:05 +00:00
Petr Rockai
f1d117f9f9 It's new. 2012-03-16 10:46:25 +00:00
Jonathan Earl Brassow
dc7b1640ed Fix name conflicts that prevent down-converting RAID1 when specifying a device
When down-converting a RAID1 device, it is the last device that is extracted
and removed when the user does not specify a particular device.  However,
when a device is specified (and it is not the last), the device is removed and
the remaining sub-LVs are "shifted down" to fill the hole.  This cause problems
when resuming the LV because if the shifted devices were resumed (and thus
renamed) before the sub-LV being extracted, there would be a name conflict.
The solution is to resume the extracted sub-LVs first so that they can be
properly renamed preventing a possible conflict.

This addresses bug 801967.
2012-03-15 20:00:54 +00:00
Zdenek Kabelac
e866931169 Improve thin_check option passing
Update a way we handle option passing - so we now support path and options
with space inside.
Fix dm name usage for thin pools with '-' in name.
Use new lvm.conf option thin_check_options to pass in options as string array.
2012-03-14 17:12:05 +00:00
Zdenek Kabelac
f61cacad16 Add --with-thin-check configure option
If specified - use given path without test (Path could be empty)
If autodetection is in use - check for command in available PATH.
2012-03-14 17:09:00 +00:00
Peter Rajnoha
88bba90e6e WHATS_NEW 2012-03-14 12:12:21 +00:00