Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=83978cdec8aa6f6b…
Commit: 83978cdec8aa6f6b6af2cb8937d64cc16b88cf18
Parent: ed9751d9fa6638e0cae5aa38727f971eeac6516c
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Nov 30 16:47:02 2012 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Nov 30 16:47:02 2012 -0600
man page (lvcreate): Better explain stripes option for RAID 4/5/6.
Do a better job explaining the '--stripes/-i' option to lvcreate
when it comes to RAID 4/5/6. The extra devices needed for parity
are implicitly added to the argument given. So a 5-device RAID6
logical volume is created with '-i 3' - indicating 3 stripes plus
the implicit 2 devices needed for RAID6.
---
man/lvcreate.8.in | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 705ebae..da4c1fe 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -150,7 +150,11 @@ Default is \fIpassdown\fP.
.BR \-i ", " \-\-stripes " " \fIStripes
Gives the number of stripes.
This is equal to the number of physical volumes to scatter
-the logical volume.
+the logical volume. When creating a RAID 4/5/6 logical volume,
+the extra devices which are necessary for parity are
+internally accounted for. Specifying '\-i 3' would use 3 devices
+for striped logical volumes, 4 devices for RAID 4/5, and 5 devices
+for RAID 6.
.TP
.BR \-I ", " \-\-stripesize " " \fIStripeSize
Gives the number of kilobytes for the granularity of the stripes.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4891a735d343db26…
Commit: 4891a735d343db26460f1b6218169c458d59f2a1
Parent: fb8cc7c63f7f5ab9e0d6d2d38f29169346a54087
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Nov 29 14:03:48 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Nov 29 14:03:48 2012 +0100
udev: recognize DM_DISABLE_UDEV environment variable
Setting this environment variable will cause a full fallback
to old direct node and symlink management in libdevmapper and lvm2.
It means:
- disabling udev synchronization
(--noudevsync in dmsetup and --noudevsync + activation/udev_sync=0
lvm2 config)
- disabling dm and any subsystem related udev rules
(--noudevrules in dmsetup and activation/udev_rules=0 lvm2 config)
- management of nodes/symlinks under /dev directly by libdevmapper/lvm2
(--verifyudev in dmsetup and activation/verify_udev_operations=1
lvm2 config)
- not obtaining any device list from udev database
(devices/obtain_device_list_from_udev=0 lvm2 config)
Note: we could set all of these before - there's no functional change!
However the DM_DISABLE_UDEV environment variable is a nice shortcut
to make it easier for libdevmapper users so that one can switch off all
of the udev management off at one go directly on the command line,
without a need to modify any source or add any extra switches.
---
WHATS_NEW | 1 +
WHATS_NEW_DM | 1 +
lib/commands/toolcontext.c | 55 +++++++++++++++++++++++++++++++------------
libdm/libdm-common.c | 34 ++++++++++++++++++++++++---
4 files changed, 71 insertions(+), 20 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 657b3a4..ca1b539 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
Do not verify udev operations if --noudevsync command option is used.
Fix lvm2api and return lvseg discards property as string.
Allow forced vgcfgrestore of lvm2 metadata with thin volumes.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3f8d9c9..3ea0502 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Add DM_DISABLE_UDEV environment variable to manage dev nodes by libdm only.
Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled.
Version 1.02.77 - 15th October 2012
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index aec4df3..57ce1fe 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -237,6 +237,7 @@ static int _process_config(struct cmd_context *cmd)
const struct dm_config_value *cv;
int64_t pv_min_kb;
const char *lvmetad_socket;
+ int udev_disabled = 0;
/* umask */
cmd->default_settings.umask = find_config_tree_int(cmd,
@@ -310,13 +311,25 @@ static int _process_config(struct cmd_context *cmd)
return 0;
}
- cmd->default_settings.udev_rules = find_config_tree_int(cmd,
- "activation/udev_rules",
- DEFAULT_UDEV_RULES);
+ /*
+ * If udev is disabled using DM_DISABLE_UDEV environment
+ * variable, override existing config and hardcode these:
+ * - udev_rules = 0
+ * - udev_sync = 0
+ * - udev_fallback = 1
+ */
+ if (getenv("DM_DISABLE_UDEV")) {
+ log_very_verbose("DM_DISABLE_UDEV environment variable set. "
+ "Overriding configuration to use "
+ "udev_rules=0, udev_sync=0, verify_udev_operations=1.");
+ udev_disabled = 1;
+ }
+
+ cmd->default_settings.udev_rules = udev_disabled ? 0 :
+ find_config_tree_int(cmd, "activation/udev_rules", DEFAULT_UDEV_RULES);
- cmd->default_settings.udev_sync = find_config_tree_int(cmd,
- "activation/udev_sync",
- DEFAULT_UDEV_SYNC);
+ cmd->default_settings.udev_sync = udev_disabled ? 0 :
+ find_config_tree_int(cmd, "activation/udev_sync", DEFAULT_UDEV_SYNC);
init_retry_deactivation(find_config_tree_int(cmd, "activation/retry_deactivation",
DEFAULT_RETRY_DEACTIVATION));
@@ -326,14 +339,12 @@ static int _process_config(struct cmd_context *cmd)
#ifdef UDEV_SYNC_SUPPORT
/*
- * We need udev rules to be applied, otherwise we would end up with no
- * nodes and symlinks! However, we can disable the synchronization itself
- * in runtime and still have only udev to create the nodes and symlinks
- * without any fallback.
+ * Use udev fallback automatically in case udev
+ * is disabled via DM_DISABLE_UDEV environment
+ * variable or udev rules are switched off.
*/
- cmd->default_settings.udev_fallback = cmd->default_settings.udev_rules ?
- find_config_tree_int(cmd, "activation/verify_udev_operations",
- DEFAULT_VERIFY_UDEV_OPERATIONS) : 1;
+ cmd->default_settings.udev_fallback = !cmd->default_settings.udev_rules || udev_disabled ? 1 :
+ find_config_tree_int(cmd, "activation/verify_udev_operations", DEFAULT_VERIFY_UDEV_OPERATIONS);
/* Do not rely fully on udev if the udev support is known to be incomplete. */
if (!cmd->default_settings.udev_fallback && !_dm_driver_has_stable_udev_support()) {
@@ -693,9 +704,21 @@ static int _init_dev_cache(struct cmd_context *cmd)
if (!dev_cache_init(cmd))
return_0;
- device_list_from_udev = udev_is_running() ?
- find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev",
- DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0;
+ /*
+ * Override existing config and hardcode device_list_from_udev = 0 if:
+ * - udev is not running
+ * - udev is disabled using DM_DISABLE_UDEV environment variable
+ */
+ if (getenv("DM_DISABLE_UDEV")) {
+ log_very_verbose("DM_DISABLE_UDEV environment variable set. "
+ "Overriding configuration to use "
+ "device_list_from_udev=0");
+ device_list_from_udev = 0;
+ } else
+ device_list_from_udev = udev_is_running() ?
+ find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev",
+ DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0;
+
init_obtain_device_list_from_udev(device_list_from_udev);
if (!(cn = find_config_tree_node(cmd, "devices/scan"))) {
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index afdac89..2d79efa 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -75,6 +75,7 @@ static struct selabel_handle *_selabel_handle = NULL;
#endif
#ifdef UDEV_SYNC_SUPPORT
+static int _udev_disabled = 0;
static int _semaphore_supported = -1;
static int _udev_running = -1;
static int _sync_with_udev = 1;
@@ -85,6 +86,9 @@ void dm_lib_init(void)
{
const char *env;
+ if ((env = getenv("DM_DISABLE_UDEV")))
+ _udev_disabled = 1;
+
env = getenv(DM_DEFAULT_NAME_MANGLING_MODE_ENV_VAR_NAME);
if (env && *env) {
if (!strcasecmp(env, "none"))
@@ -1814,6 +1818,26 @@ out:
return r;
}
+static void _set_cookie_flags(struct dm_task *dmt, uint16_t flags)
+{
+ if (!dm_cookie_supported())
+ return;
+
+ if (_udev_disabled) {
+ /*
+ * If udev is disabled, hardcode this functionality:
+ * - we want libdm to create the nodes
+ * - we don't want the /dev/mapper and any subsystem
+ * related content to be created by udev if udev
+ * rules are installed
+ */
+ flags &= ~DM_UDEV_DISABLE_LIBRARY_FALLBACK;
+ flags |= DM_UDEV_DISABLE_DM_RULES_FLAG | DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+ }
+
+ dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
+}
+
#ifndef UDEV_SYNC_SUPPORT
void dm_udev_set_sync_support(int sync_with_udev)
{
@@ -1835,8 +1859,8 @@ int dm_udev_get_checking(void)
int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
{
- if (dm_cookie_supported())
- dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
+ _set_cookie_flags(dmt, flags);
+
*cookie = 0;
dmt->cookie_set = 1;
@@ -1920,6 +1944,9 @@ void dm_udev_set_sync_support(int sync_with_udev)
int dm_udev_get_sync_support(void)
{
+ if (_udev_disabled)
+ return 0;
+
_check_udev_sync_requirements_once();
return _semaphore_supported && dm_cookie_supported() &&
@@ -2203,8 +2230,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags)
{
int semid;
- if (dm_cookie_supported())
- dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT;
+ _set_cookie_flags(dmt, flags);
if (!dm_udev_get_sync_support()) {
*cookie = 0;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fb8cc7c63f7f5ab9…
Commit: fb8cc7c63f7f5ab9e0d6d2d38f29169346a54087
Parent: 2be940e54910157da05ffe5d828828e4bcd8b25a
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Nov 29 13:59:12 2012 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Nov 29 13:59:12 2012 +0100
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.
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 98b5f9e..657b3a4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Do not verify udev operations if --noudevsync command option is used.
Fix lvm2api and return lvseg discards property as string.
Allow forced vgcfgrestore of lvm2 metadata with thin volumes.
Recognise STEC skd devices in filter.
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 3720d7f..34d324f 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -901,10 +901,8 @@ static int _get_settings(struct cmd_context *cmd)
} else
init_trust_cache(0);
- if (arg_count(cmd, noudevsync_ARG)) {
+ if (arg_count(cmd, noudevsync_ARG))
cmd->current_settings.udev_sync = 0;
- cmd->current_settings.udev_fallback = 1;
- }
/* Handle synonyms */
if (!_merge_synonym(cmd, resizable_ARG, resizeable_ARG) ||
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2be940e54910157d…
Commit: 2be940e54910157da05ffe5d828828e4bcd8b25a
Parent: 0387e70d7698be559d2d7ca8f9cdb8882be7ad0b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 27 01:01:38 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 27 14:10:46 2012 +0100
tests: update thin testing
---
test/shell/lvconvert-thin.sh | 10 ++++++++--
test/shell/thin-defaults.sh | 35 +++++++++++++++++++++++++++++++++++
test/shell/thin-restore.sh | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index f21453f..4634aa2 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -24,9 +24,15 @@ prepare_lvs()
#
aux have_thin 1 0 0 || skip
-aux prepare_pvs 4 6400000
+aux prepare_pvs 4 64
-vgcreate $vg -s 64K $(cat DEVICES)
+# build one large PV
+vgcreate $vg1 $(cut -d ' ' -f -3 DEVICES)
+lvcreate -s -l 100%FREE -n $lv $vg1 --virtualsize 64T
+aux lvmconf 'devices/filter = [ "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
+
+pvcreate "$DM_DEV_DIR/$vg1/$lv"
+vgcreate $vg -s 64K $(cut -d ' ' -f 4 DEVICES) "$DM_DEV_DIR/$vg1/$lv"
# create mirrored LVs for data and metadata volumes
lvcreate -aey -L10M -m1 --mirrorlog core -n $lv1 $vg
diff --git a/test/shell/thin-defaults.sh b/test/shell/thin-defaults.sh
new file mode 100644
index 0000000..677d2f1
--- /dev/null
+++ b/test/shell/thin-defaults.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# test defaults entered through lvm.conf
+
+. lib/test
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+
+aux prepare_vg 2
+
+lvcreate -T -L8M $vg/pool0
+
+aux lvmconf "allocation/thin_pool_chunk_size = 128" \
+ "allocation/thin_pool_discards = \"ignore\"" \
+ "allocation/thin_pool_zero = 0"
+
+lvcreate -T -L8M $vg/pool1
+
+check lv_field $vg/pool1 chunksize "128.00k"
+check lv_field $vg/pool1 discards "ignore"
+check lv_field $vg/pool1 zero 0
+
+vgremove -f $vg
diff --git a/test/shell/thin-restore.sh b/test/shell/thin-restore.sh
new file mode 100644
index 0000000..7580ae4
--- /dev/null
+++ b/test/shell/thin-restore.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# test restore operation of thin pool metadata
+
+. lib/test
+
+#
+# Main
+#
+aux have_thin 1 0 0 || skip
+
+aux prepare_vg 2
+
+lvcreate -T -L8M $vg/pool -V10M -n $lv1
+
+vgcfgbackup -f backup $vg
+
+# use of --force is mandatory
+not vgcfgrestore -f backup $vg
+
+vgcfgrestore -f backup --force $vg
+
+check lv_field $vg/pool transaction_id 1
+
+vgremove -f $vg