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

6471 Commits

Author SHA1 Message Date
Peter Rajnoha
386220ada2 typo 2012-02-15 15:10:31 +00:00
Peter Rajnoha
9a0cf1ad84 Add watch rule to 13-dm-disk.rules.
We don't have anything better yet...

The problems the watch rule caused when removing devices should be covered
now with the "retry remove" logic. It's also better to have this maintained
by us, rather than having this rule anywhere else without proper control.
2012-02-15 14:50:33 +00:00
Zdenek Kabelac
ea7b3d8fd7 Simplify with dm_strdup 2012-02-15 14:27:53 +00:00
Petr Rockai
1ea2c6a2f6 Run tests with lvmetad if we have it. 2012-02-15 14:24:31 +00:00
Peter Rajnoha
da3a375f7a Fix segfault in dmsetup when using table specification with --table.
Segfault introduced with the patch that added dm_free(_table) at the
end of dmsetup (in this release).
2012-02-15 14:20:59 +00:00
Petr Rockai
12dba91d9d (lvmetad) Remove unused variable. 2012-02-15 14:15:50 +00:00
Petr Rockai
23ce26fe22 In lvmetad, also nuke VGs when all their PVs are stolen by another VG (vgmerge
& vgsplit do this).
2012-02-15 14:06:48 +00:00
Zdenek Kabelac
80202ecd98 Detect failing fifo
If the fifo died because of dmeventd restart - do not wait for 20s
in select  - it will not get better and return error immediately.
2012-02-15 13:56:47 +00:00
Zdenek Kabelac
5b29e2ac60 Deal with slower test processing
If the merge was faster then query - deal with it and pass the test.
2012-02-15 13:51:17 +00:00
Zdenek Kabelac
1fa8ddaf51 Initialize monitoring support only for thin pools 2012-02-15 13:49:51 +00:00
Zdenek Kabelac
a7a66f4b6d Update cut&paste error message 2012-02-15 13:46:54 +00:00
Petr Rockai
616c6208aa Turn a warning to an error in vgreduce --removemissing, since we exit with a
failure status there.
2012-02-15 12:30:46 +00:00
Peter Rajnoha
3b4be8a99d Add dmsetup manpage entries for mangle command and --manglename option. 2012-02-15 12:25:23 +00:00
Peter Rajnoha
05bfdefdf8 Add DM_DEFAULT_NAME_MANGLING_MODE env. variable to override configured value.
Just in case of emergency when name mangling code causes any problems so
we can override the default value and switch off the mangling globally.
2012-02-15 12:23:15 +00:00
Peter Rajnoha
3eb23ab3d2 Replace any '\' char with '\\' in table specification on input.
Device-mapper in kernel uses '\' as escape character so it's better
to double it to avoid any confusion when using existing device names
with '\' in the table specification.

For example:

dmsetup create x --table "0 8 linear /dev/mapper/a\x20b 0"

should pass just fine now without a need to explicitly escape the '\' char
like this:

dmsetup create x --table "0 8 linear /dev/mapper/a\\x20b 0"
2012-02-15 12:17:34 +00:00
Peter Rajnoha
4491acea0b Add mangle command to dmsetup to provide renaming to correct mangled form. 2012-02-15 12:08:57 +00:00
Peter Rajnoha
d4aa0496fb Add 'mangled_name' and 'unmangled_name' fields to dmsetup info -c -o. 2012-02-15 12:06:17 +00:00
Peter Rajnoha
0f49ede3b1 Add --manglename option to dmsetup to select the name mangling mode. 2012-02-15 12:02:58 +00:00
Peter Rajnoha
573e57f83f Unamngle dm device name list automatically on ioctl return.
If dm_task_get_name or dm_task_get_names gets called, these will return
unmangled form of the names so the name mangling stays totally transparent
to any libdevmapper user (unless DM_STRING_MANGLING_NONE is used in which
case the name is not touched and it is is returned as it is in kernel).

For example:

dmsetup create "a b" - will create a\x20b device in kernel and so udev will
create /dev/mapper/a\x20b

dm_task_get_name/names will still return "a b"

In AUTO mode, the libdevmapper user can still query the device by using
the mangled ("a\x20b") or unmangled form of the name when calling dm_task_set_name.
If mangled name is provided, it's detected and the name is kept as it is.
If unmangled name is provided, it will be mangled. IOW in AUTO mode it's
totally transparent and it should not require any changes in the code
using libdevmapper.

However, any libdevmapper user must be aware of the fact that the mangled form
of the name appears in /dev/mapper (udev just can't deal with those blacklisted
characters).
2012-02-15 12:01:28 +00:00
Petr Rockai
69a82801ef lvmetad server-side update:
- rename the hashes to be explicit about the mapping
- add VG/PV listing calls to the protocol
- cache slightly more of the per-PV state
- filter cached metadata
- compare the metadata upon metadata_update
2012-02-15 11:43:06 +00:00
Peter Rajnoha
bd364a70b5 Add dm_task_get_name_mangled/unmangled to libdevmapper.
dm_task_get_name_mangled will always return mangled form of the name while
the dm_task_get_name_unmangled will always return unmangled form of the name
irrespective of the global setting (dm_set/get_name_mangling_mode).

This is handy in situations where we need to detect whether the name is already
mangled or not. Also display functions make use of it.
2012-02-15 11:39:38 +00:00
Peter Rajnoha
2e8c7f2975 Add DEV_NAME macro.
Use the DEV_NAME macro to use the mangled form of the name if present,
use normal name otherwise (we store both forms - mangled and unmangled in
struct dm_task). Mangled form should be always preferred over unmangled
with the exception of the situations where we divide one task into several
others (like "create and load") - we need to avoid mangling the name twice
(because of multiple dm_task_set_name calls)!
2012-02-15 11:33:53 +00:00
Peter Rajnoha
55761e14af Mangle device name on dm_task_set_name/newname call if necessary.
If dm_task_set_name/newname is called, the name provided will be
automatically translated to correct encoded form with the hex enconding
so any character not on udev whitelist will be mangled with \xNN
format where NN is hex value of the character used.

By default, the name mangling mode used is the one set during
configure with the '--with-default-name-mangling' option.
2012-02-15 11:27:01 +00:00
Peter Rajnoha
c64d7cd381 autoreconf 2012-02-15 11:20:12 +00:00
Peter Rajnoha
53f3ebce92 Add configure --with-default-name-mangling.
This option configures the default name mangling mode used, one of:
AUTO, NONE and HEX.

The name mangling is primarily used to support udev character whitelist
(0-9, A-Z, a-z, #*-.:=@_) so any character that is not on udev whitelist
will get translated into an encoded form \xNN where NN is the hex value
of the character.
2012-02-15 11:17:57 +00:00
Petr Rockai
351aefc8a0 Do not forget to initialise the error value in daemon_reply. 2012-02-15 09:14:54 +00:00
Petr Rockai
e22fddbff6 Fix pool names of the format1/format_pool orphan VGs. 2012-02-15 01:44:58 +00:00
Petr Rockai
a635143d62 In the test harness, do the back-substitution (@TESTDIR@, @PREFIX@) also on the
live VERBOSE output, not just the post-mortem dumps.
2012-02-15 01:31:10 +00:00
Jonathan Earl Brassow
ad48a46fc9 Make conversion from a synced 'mirror' to 'raid1' not cause a full resync.
It was not possible to pass down the DM_[FORCE|NO]SYNC flags to
'dm_tree_node_add_raid_target'.  This meant that converting to 'raid1' from
'mirror' would cause a full resync.  (It also meant that '--nosync' was
ineffective when creating a 'raid1' LV.)

I've taken the 'reserved' parameter in 'dm_tree_node_add_raid_target' and
used it for the "flags" parameter.  Now it is possible to pass the sync
flags and any other flags that may come up.
2012-02-13 20:13:39 +00:00
Jonathan Earl Brassow
96f82296ae Change confusing message that is printed when a RAID device fails.
s/Issue/Use/, otherwise it is easy to misread "Issue" as "Issuing" - causing
the user confusion as to whether the action was performed automatically or
whether they need to issue the command.
2012-02-13 18:38:36 +00:00
Jonathan Earl Brassow
1456c3b298 Fix possible NULL pointer dereferences when updating mirror log.
'_lv_update_log_type' takes a lvconvert_params argument so that it can pass
down the user's preference of 'region_size' and allocation_policy.  When
'mirror_remove_missing' was introduced (commit ID
95986e42a1) it didn't make sense to pass down
user preferences - so NULL was given instead.  While it may never happen in
practice, static analysis reveals that this argument could be dereferenced.
So, if the user preferences were not passed in, glean the necessary fields
from what is already set in the LV.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>

(Not updating WHATSNEW for this simple clean-up.)
2012-02-13 18:36:55 +00:00
Jonathan Earl Brassow
a30832cedd Fix bug that caused RAID devices to be unable to activate if sub-LV was missing.
Commit 02f6f4902f introduced a bug that caused
RAID devices to fail to activate if the device for a single sub-LV failed.
The special case of LVM mirror was handled, but not LVM RAID.
EXAMPLE:
[root@bp-01 ~]# devices vg
  LV            Copy%  Devices
  lv            100.00 lv_rimage_0(0),lv_rimage_1(0)
  [lv_rimage_0]        /dev/sde1(1)
  [lv_rimage_1]        /dev/sdh1(1)
  [lv_rmeta_0]         /dev/sde1(0)
  [lv_rmeta_1]         /dev/sdh1(0)
[root@bp-01 ~]# vgchange -an vg
  0 logical volume(s) in volume group "vg" now active
[root@bp-01 ~]# off.sh sdh
Turning off sdh
[root@bp-01 ~]# vgchange -ay vg --partial
  Partial mode. Incomplete logical volumes will be processed.
  Couldn't find device with uuid fbI0YO-GX7x-firU-Vy5o-vzwx-vAKZ-feRxfF.
  Cannot activate vg/lv_rimage_1: all segments missing.
  0 logical volume(s) in volume group "vg" now active

AFTER this patch:
[root@bp-01 ~]# vgchange -ay vg --partial
  Partial mode. Incomplete logical volumes will be processed.
  Couldn't find device with uuid fbI0YO-GX7x-firU-Vy5o-vzwx-vAKZ-feRxfF.
  1 logical volume(s) in volume group "vg" now active
[root@bp-01 ~]# devices vg
  Couldn't find device with uuid fbI0YO-GX7x-firU-Vy5o-vzwx-vAKZ-feRxfF.
  LV            Copy%  Devices
  lv            100.00 lv_rimage_0(0),lv_rimage_1(0)
  [lv_rimage_0]        /dev/sde1(1)
  [lv_rimage_1]        unknown device(1)
  [lv_rmeta_0]         /dev/sde1(0)
  [lv_rmeta_1]         unknown device(0)
[root@bp-01 ~]# dmsetup table vg-lv; dmsetup status vg-lv
0 1024000 raid raid1 3 0 region_size 1024 2 253:2 253:3 - -
0 1024000 raid raid1 2 AD 1024000/1024000

No WHATSNEW update necessary because this is an intrarelease fix.

 brassow
2012-02-13 17:59:21 +00:00
Peter Rajnoha
a693b8d2cb Superfluous '/' in systemd_dir path. 2012-02-13 17:31:14 +00:00
Zdenek Kabelac
c71b47b9e6 Fix missing temp_buf init for error path
In previous commit this was missing, also deallocate in reversed order.
2012-02-13 14:39:24 +00:00
Zdenek Kabelac
382a1a6bea Add internal error to guard vgname2 NULL dereference 2012-02-13 14:26:15 +00:00
Zdenek Kabelac
99e2a2e156 Add some FIXME around allocation code
Remove also unreachable break..
2012-02-13 14:25:14 +00:00
Zdenek Kabelac
172c87f7ca Never try to test character past given buffer
In case units[0] would be already '\0', do not check units[1].
2012-02-13 14:23:40 +00:00
Zdenek Kabelac
5e4f234918 Make sure dereferenced words[0] and words[1] are defined 2012-02-13 14:17:04 +00:00
Peter Rajnoha
e587cb6ac5 Add configure --with-systemdsystemunitdir. 2012-02-13 13:02:47 +00:00
Zdenek Kabelac
424f6dc4ad Handle all succefull values from open() 2012-02-13 12:07:51 +00:00
Zdenek Kabelac
e66b3e8e3b Ensure allocated device does not leak on error path
For unimplementd canonicalize_file_name set to NULL
2012-02-13 12:06:39 +00:00
Zdenek Kabelac
73e62cdc11 Add internal error for unsupported code paths
Patch mainly helps static analyzers to better work with code paths
lvm code should never trigger.
2012-02-13 11:25:56 +00:00
Zdenek Kabelac
74b5744b4b Check for missing reply_uuid 2012-02-13 11:24:09 +00:00
Zdenek Kabelac
65d01ed981 Check for allocation failure 2012-02-13 11:18:45 +00:00
Zdenek Kabelac
3e74542b5d Add check for allocation failure 2012-02-13 11:16:42 +00:00
Zdenek Kabelac
daaea2ef94 Add few missing allocation failures tests 2012-02-13 11:13:44 +00:00
Zdenek Kabelac
cbe6bcd593 Add check for rimage name allocation failure 2012-02-13 11:10:37 +00:00
Zdenek Kabelac
bed744c15d Add check for mda_copy failure 2012-02-13 11:09:25 +00:00
Zdenek Kabelac
fde44d055b Add check for failure 2012-02-13 11:07:55 +00:00
Zdenek Kabelac
52f2f3eae4 Add free_orphan_vg
Move commod code to destroy orphan VG into free_orphan_vg() function.
Use orphan vgmem for creation of PV lists.
Remove some free_pv_fid() calls (FIXME: check all of them)
FIXME: Check whether we could merge release_vg back again for all VGs.
2012-02-13 11:03:59 +00:00