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

7233 Commits

Author SHA1 Message Date
Zdenek Kabelac
0387e70d76 thin: fix property discard for lvm2api
Discards property is string and may have these values:
  ignore, nopassdown, passdown
2012-11-27 14:09:49 +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
Alasdair G Kergon
8c49aa79e7 filters: Add STEC skd and Violin vtms devices 2012-11-26 14:55:17 +00: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
Zdenek Kabelac
683b1f0625 thin: detect discards for non-power-2
Check if target supports discards for chunk sizes,
that are not power of 2 (just multiple of 64K),
and enable it in case it's supported by thin kernel target.
2012-11-26 12:14:47 +01:00
Zdenek Kabelac
668b669d5b lvm2api: fix typo
oops, typo didn't cause compile error
2012-11-26 11:33:24 +01:00
Petr Rockai
60668f823e Automatically restore MISSING PVs with no MDAs. 2012-11-25 20:41:56 +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
Jonathan Brassow
fb0cee9a66 RAID: Do not allow --splitmirrors on RAID10 logical volumes.
RAID10 does not have the ability to split off images for independent
use.  So, 'lvconvert --splitmirrors' will not work and must be
disallowed.
2012-11-21 18:39:26 -06:00
Zdenek Kabelac
400f644286 lv_manip: fix regresion from bf2741376d
Commit bf2741376d started to use
lv_is_active() instead of call for lv_info & info.exists so
we cover also cluster activated devices.
For snapshost the conversion was not correct and introduced
regression by blocking creation of snapshot of inactive LV.

Fix it by assigning lv_is_active() directly.
Note: we still have minor issue to fix - to make
lv_is_???? function able to return error states since
lv_info() may fail.
2012-11-21 12:15:09 +01:00
Zdenek Kabelac
d5697b29ee mm: skip mlocking [vectors]
Somehow forgotten:
https://www.redhat.com/archives/linux-lvm/2012-June/msg00019.html
Need for arm architecture support.
2012-11-20 10:02:51 +01:00
Alasdair G Kergon
5ef6ca00b9 docs: host tags has a default volume_list
Document that lvm.conf activation/volume_list defaults to @* when
there's a host tag.
2012-11-19 22:29:23 +00: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
Petr Rockai
c907ee0351 Document use_lvmetad and global_filter in lvm.conf.5. 2012-11-19 16:20:54 +01:00
Zdenek Kabelac
a7893ae858 test: testing lvconvert 2012-11-19 14:38:17 +01:00
Zdenek Kabelac
bf1cf1459f thin: man page updates
Cover latest extensions of lvconvert functionality.
Update also lvcreate page.
2012-11-19 14:38:17 +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
2e96ea4a89 liblvm: internal API change
Return LV/NULL instead of 1/0 which saves lookup for created LV.
2012-11-19 14:37:30 +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
Tony Asleson
7a34db0cfd python-lvm: Initial check-in of python-lvm unit test case.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-11-14 13:18:37 -06:00
Tony Asleson
fefb2f03c3 test: set LD_LIBRARY_PATH to all dirs with *.so
Instead of manually editing entries, add all the
directories which contain shared objects.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-11-14 13:05:55 -06:00
Peter Rajnoha
fc2644ae71 pvscan: exit --cache immediately if locking_type=3 || use_lvmetad=0 2012-11-09 15:56:57 +01:00
Peter Rajnoha
7c7672b3c0 systemd: remove quotes in lvm2-monitor.service ExecStop 2012-11-02 20:32:28 +01:00
Peter Rajnoha
aa07de5a50 systemd: do not remove lvm2-activation.service
Fix previous commit 360c569ce8.
Remove only fedora-storage-init/fedora-storage-init-late.service, but
not lvm2-activation.service.
fedora-storage-init.service fedora-storage-init-late.service
2012-11-01 13:33:49 +01:00
Peter Rajnoha
360c569ce8 systemd: various updates and fixes
Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
 - a systemd design issue while processing dependencies
   with socket-based activation that ends up with a hang
 - https://bugzilla.redhat.com/show_bug.cgi?id=843587
   (also tracker bug https://bugzilla.redhat.com/show_bug.cgi?id=871527)
 - not using lvmetad in this case is just a workaround, once the bug
   above is resolved, we should enable the lvmetad in that specific case

Remove dependency on fedora-storage-init.service in lvm2 systemd units.
 - fedora-storage-init.service and fedora-storage-init-late.service is
   going to be separated into respective units that belong to each block
   device subsystem:
     - mpath + mdraid activated via udev solely
     - dmraid with its own dmraid-activation.service unit
     - lvm2 with the lvm2-activation-generator to generate the
       activation units runtime if lvmetad disabled
       (global/use_lvmetad=0 set in lvm.conf) and activation done
       via udev+lvmetad if lvmetad enabled (global/use_lvmetad=1 set
       in lvm.conf)

Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.
 - as lvm2-monitor uses lvmetad if lvmetad is enabled
2012-10-30 20:55:50 +01:00
Petr Rockai
09d77d0c94 test: Check that overriding use_lvmetad with --config works. 2012-10-30 09:16:15 +01:00
Petr Rockai
983f0b46f2 lvmetad: Init lazily, to avoid socket access on config overrides. 2012-10-30 09:15:47 +01:00
Peter Rajnoha
7c59199d49 lvmetad: warn only if use_lvmetad=1 and locking_type=3 2012-10-29 16:20:35 +01:00
Tony Asleson
bbff143d54 python-lvm: Memory leaks & seg. fault fixes
Issues found (thus far) in unit test developemnt for python bindings.

Added Py_DECREF(ptr) in liblvm_lvm_vg_open & liblvm_lvm_vg_create
in error paths so that we correctly clean up memory.

Added a call to lvm_vg_close when we remove a vg.  The code was
clearing out the vg pointer which prevented us from actually
calling lvm_vg_close in the close path.

liblvm_lvm_vg_create_lv_linear was not initializing
lvobj->parent_vgobj and if lvm_vg_create_lv_linear failed
we went through liblvm_lv_dealloc on clean up and tried to
Py_DECREF an invalid pointer.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-10-25 18:09:10 -05:00
Peter Rajnoha
291909ecaf WHATS_NEW: latest changes under libdm 1.02.78 2012-10-25 16:29:35 +02:00
Peter Rajnoha
10492b238d lvmetad: whats_new + more explanation for previous commit 2012-10-25 14:47:45 +02:00
Petr Rockai
2fdd0840d5 lvmetad: Disable and warn when locking_type is 3. 2012-10-25 14:31:08 +02:00
Jonathan Brassow
b248ba0a39 mirror: Avoid reading mirrors with failed devices in mirrored log
Commit 9fd7ac7d03 did not handle mirrors
that contained mirrored logs.  This is because the status line of the
mirror does not give an indication of the health of the mirrored log,
as you can see here:
        [root@bp-01 lvm2]# dmsetup status vg-lv vg-lv_mlog
        vg-lv: 0 409600 mirror 2 253:6 253:7 400/400 1 AA 3 disk 253:5 A
        vg-lv_mlog: 0 8192 mirror 2 253:3 253:4 7/8 1 AD 1 core
Thus, the possibility for LVM commands to hang still persists when mirror
have mirrored logs.  I discovered this while performing some testing that
does polling with 'pvs' while doing I/O and killing devices.  The 'pvs'
managed to get between the mirrored log device failure and the attempt
by dmeventd to repair it.  The result was a very nasty block in LVM
commands that is very difficult to remove - even for someone who knows
what is going on.  Thus, it is absolutely essential that the log of a
mirror be recursively checked for mirror devices which may be failed
as well.

Despite what the code comment says in the aforementioned commit...
+ * _mirrored_transient_status().  FIXME: It is unable to handle mirrors
+ * with mirrored logs because it does not have a way to get the status of
+ * the mirror that forms the log, which could be blocked.
... it is possible to get the status of the log because the log device
major/minor is given to us by the status output of the top-level mirror.
We can use that to query the log device for any DM status and see if it
is a mirror that needs to be bypassed.  This patch does just that and is
now able to avoid reading from mirrors that have failed devices in a
mirrored log.
2012-10-25 00:42:45 -05:00
Jonathan Brassow
9fd7ac7d03 mirror: Avoid reading from mirrors that have failed devices
Addresses: rhbz855398 (Allow VGs to be built on cluster mirrors),
           and other issues.

The LVM code attempts to avoid reading labels from devices that are
suspended to try to avoid situations that may cause the commands to
block indefinitely.  When scanning devices, 'ignore_suspended_devices'
can be set so the code (lib/activate/dev_manager.c:device_is_usable())
checks any DM devices it finds and avoids them if they are suspended.

The mirror target has an additional mechanism that can cause I/O to
be blocked.  If a device in a mirror fails, all I/O will be blocked
by the kernel until a new table (a linear target or a mirror with
replacement devices) is loaded.  The mirror indicates that this condition
has happened by marking a 'D' for the faulty device in its status
output.  This condition must also be checked by 'device_is_usable()' to
avoid the possibility of blocking LVM commands indefinitely due to an
attempt to read the blocked mirror for labels.

Until now, mirrors were avoided if the 'ignore_suspended_devices'
condition was set.  This check seemed to suggest, "if we are concerned
about suspended devices, then let's ignore mirrors altogether just
in case".  This is insufficient and doesn't solve any problems.  All
devices that are suspended are already avoided if
'ignore_suspended_devices' is set; and if a mirror is blocking because
of an error condition, it will block the LVM command regardless of the
setting of that variable.

Rather than avoiding mirrors whenever 'ignore_suspended_devices' is
set, this patch causes mirrors to be avoided whenever they are blocking
due to an error.  (As mentioned above, the case where a DM device is
suspended is already covered.)  This solves a number of issues that weren't
handled before.  For example, pvcreate (or any command that does a
pv_read or vg_read, which eventually call device_is_usable()) will be
protected from blocked mirrors regardless of how
'ignore_suspended_devices' is set.  Additionally, a mirror that is
neither suspended nor blocking is /allowed/ to be read regardless
of how 'ignore_suspended_devices' is set.  (The latter point being the
source of the fix for rhbz855398.)
2012-10-23 23:10:33 -05:00
Jonathan Brassow
b873fc54ba WHATS_NEW: Entry for commit e191780947
WHATS_NEW commit for 'lvs' output change to add RAID 4/5/6 sync %age
to s/Copy%/Cpy%Sync/ output.
2012-10-23 21:38:37 -05:00
Jonathan Brassow
e191780947 RAID: Make RAID 4/5/6 display sync status under heading s/Copy%/Cpy%Sync
The heading 'Copy%' is specific to PVMOVE volumes, but can be generalized
to apply to LVM mirrors also.  It is a bit awkward to use 'Copy%' for
RAID 4/5/6, however - 'Sync%' would be more appropriate.  This is why
RAID 4/5/6 have not displayed their sync status by any means available to
'lvs' yet.

Example (old):
[root@hayes-02 lvm2]# lvs vg
  LV      VG   Attr      LSize  Pool Origin Data%  Move Log Cpy%Sy Convert
  lv    vg   -wi-a----  1.00g
  raid1 vg   rwi-a-r--  1.00g                             100.00
  raid4 vg   rwi-a-r--  1.01g
  raid5 vg   rwi-a-r--  1.01g
  raid6 vg   rwi-a-r--  1.01g

This patch changes the heading to 'Cpy%Sync' and allows RAID 4/5/6 to print
their sync percent in this field.

Example (new):
[root@hayes-02 lvm2]# lvs vg
  LV    VG   Attr      LSize Pool Origin Data%  Move Log Cpy%Sync Convert
  lv    vg   -wi-a---- 1.00g
  raid1 vg   rwi-a-r-- 1.00g                               100.00
  raid4 vg   rwi-a-r-- 1.01g                               100.00
  raid5 vg   rwi-a-r-- 1.01g                               100.00
  raid6 vg   rwi-a-r-- 1.01g                               100.00
2012-10-23 21:19:27 -05:00
Jonathan Brassow
6db461e3b0 mirror/raid: Move 'copy_percent' to common code (mirror.c -> lv_manip.c)
The 'copy_percent' function takes the 'extents_copied' field from each
segment in an LV to create the numerator for the ratio that is to
become the copy_percent.  (Otherwise known as the 'sync' percent for
non-pvmove uses, like mirror LVs and RAID LVs.)  This function safely
works on RAID - not just mirrors - so it is better to have it in
lv_manip.c rather than mirror.c.

There's a lot of different functions that do a lot of different things
in lv_manip.c, so I placed the function near a function in lv_manip.c
that it was close to in metadata-exported.h.  Different placement in the
file or a different name for the function may be useful.
2012-10-23 20:33:54 -05:00
Tony Asleson
8073ce1690 python-lvm: seg. fault in liblvm_lvm_percent_to_float
The first parameter needs to be present even if it isn't being
used, otherwise the one any only parameter we get is null
which causes PyArg_ParseTuple to seg. fault.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2012-10-23 14:54:06 -05:00
Peter Rajnoha
a820a68619 udev_sync: cookie_set=1 on each dm_task_set_cookie call
cookie_set variable found in the struct dm_task should be always
set to 1 after dm_task_set_cookie_call, even if udev_sync is disabled
as the cookie itself carries synchronization informations *as well as*
extra flags to control other aspects of udev support.

For example, one could disable the synchronization itself, but still
direct the libdm code to disable library fallback via
DM_UDEV_DISABLE_LIBRARY_FALLBACK flag. These extra flags still need
to be carried out!

A concrete example:
  $ dmsetup create test --table "0 1 zero" --noudevsync

This disables synchronization with udev. As the --verifyudev option is
not used, we don't want to do any corrections. In other words, we
need DM_UDEV_DISABLE_LIBRARY_FALLBACK flag to be used. However,
with --noudevsync this was not the case - the flag was ignored!

This patch fixes the case when noudevsync is used but there are still
some extra flags passed within the cookie flag part. The synchronization
part of the cookie stays zero (which is ok as dm_udev_wait call on such a
cookie is simply a NOOP).
2012-10-23 13:23:35 +02:00
Marian Csontos
fc849a9eeb version: update 2012-10-22 14:16:06 +02:00
Zdenek Kabelac
13fe333b54 clvmd: fix parsing of -d argument
clvmd -d option parsing was not working properly.

clvmd -d 2   (with space) has been ignored because of
'::' used in getopt string, and as failsafe it's been used '1'.

Later this debug_arg has been ignored and debug_opt was used
instead which happend to have value '1'.

Submitted-by: Robert Milasan <rmilasan at suse.com>
Reported-by: Robert Milasan  <rmilasan at suse.com>
2012-10-19 15:35:56 +02: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