master - libdm: add dm_tree_node_set_thin_pool_read_only
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=69132f55eafb6a...
Commit: 69132f55eafb6a797e86b449783f9cd2f518c3dd
Parent: fd1376ebefa3dd66baff5da161de02b869a734a7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 18 15:15:39 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 18 15:15:39 2015 +0200
libdm: add dm_tree_node_set_thin_pool_read_only
Support thin-pool tree node with activation in read-only mode.
(Native kernel API).
---
WHATS_NEW_DM | 1 +
libdm/.exported_symbols.DM_1_02_99 | 1 +
libdm/libdevmapper.h | 3 +++
libdm/libdm-deptree.c | 18 +++++++++++++++++-
4 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index dda2777..d87e2bd 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.99 -
================================
+ New dm_tree_node_set_thin_pool_read_only(DM_1_02_99) for read-only thin pool.
Enhance error message when thin-pool message fails.
Version 1.02.98 - 12th June 2015
diff --git a/libdm/.exported_symbols.DM_1_02_99 b/libdm/.exported_symbols.DM_1_02_99
new file mode 100644
index 0000000..e586a5c
--- /dev/null
+++ b/libdm/.exported_symbols.DM_1_02_99
@@ -0,0 +1 @@
+dm_tree_node_set_thin_pool_read_only
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index c811641..cbd4f3d 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -899,6 +899,9 @@ int dm_tree_node_set_thin_pool_discard(struct dm_tree_node *node,
*/
int dm_tree_node_set_thin_pool_error_if_no_space(struct dm_tree_node *node,
unsigned error_if_no_space);
+/* Start thin pool with metadata in read-only mode */
+int dm_tree_node_set_thin_pool_read_only(struct dm_tree_node *node,
+ unsigned read_only);
/*
* FIXME: Defines bellow are based on kernel's dm-thin.c defines
* MAX_DEV_ID ((1 << 24) - 1)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 1602c62..8428376 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -205,6 +205,7 @@ struct load_segment {
unsigned ignore_discard; /* Thin_pool target vsn 1.1 */
unsigned no_discard_passdown; /* Thin_pool target vsn 1.1 */
unsigned error_if_no_space; /* Thin pool target vsn 1.10 */
+ unsigned read_only; /* Thin pool target vsn 1.3 */
uint32_t device_id; /* Thin */
};
@@ -2421,6 +2422,7 @@ static int _thin_pool_emit_segment_line(struct dm_task *dmt,
int pos = 0;
char pool[DM_FORMAT_DEV_BUFSIZE], metadata[DM_FORMAT_DEV_BUFSIZE];
int features = (seg->error_if_no_space ? 1 : 0) +
+ (seg->read_only ? 1 : 0) +
(seg->ignore_discard ? 1 : 0) +
(seg->no_discard_passdown ? 1 : 0) +
(seg->skip_block_zeroing ? 1 : 0);
@@ -2431,9 +2433,10 @@ static int _thin_pool_emit_segment_line(struct dm_task *dmt,
if (!_build_dev_string(pool, sizeof(pool), seg->pool))
return_0;
- EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %d%s%s%s%s", metadata, pool,
+ EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %d%s%s%s%s%s", metadata, pool,
seg->data_block_size, seg->low_water_mark, features,
seg->error_if_no_space ? " error_if_no_space" : "",
+ seg->read_only ? " read_only" : "",
seg->skip_block_zeroing ? " skip_block_zeroing" : "",
seg->ignore_discard ? " ignore_discard" : "",
seg->no_discard_passdown ? " no_discard_passdown" : ""
@@ -3866,6 +3869,19 @@ int dm_tree_node_set_thin_pool_error_if_no_space(struct dm_tree_node *node,
return 1;
}
+int dm_tree_node_set_thin_pool_read_only(struct dm_tree_node *node,
+ unsigned read_only)
+{
+ struct load_segment *seg;
+
+ if (!(seg = _get_single_load_segment(node, SEG_THIN_POOL)))
+ return_0;
+
+ seg->read_only = read_only;
+
+ return 1;
+}
+
int dm_tree_node_add_thin_target(struct dm_tree_node *node,
uint64_t size,
const char *pool_uuid,
8 years, 10 months
master - libdaemon: move compare_config to lib
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fd1376ebefa3dd...
Commit: fd1376ebefa3dd66baff5da161de02b869a734a7
Parent: 0a203070f5189a53f764e1e6e960ac70acfad5a9
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 17 13:06:37 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 17 13:07:52 2015 -0500
libdaemon: move compare_config to lib
so it can be used elsewhere.
---
daemons/lvmetad/lvmetad-core.c | 57 ----------------------------------------
libdaemon/client/config-util.c | 57 ++++++++++++++++++++++++++++++++++++++++
libdaemon/client/config-util.h | 2 +
3 files changed, 59 insertions(+), 57 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 57a86e4..dc0c92a 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -26,9 +26,6 @@
#include <stdint.h>
#include <unistd.h>
-#include <math.h> /* fabs() */
-#include <float.h> /* DBL_EPSILON */
-
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
typedef struct {
@@ -569,60 +566,6 @@ bad:
return reply_fail("out of memory");
}
-/* Test if the doubles are close enough to be considered equal */
-static int close_enough(double d1, double d2)
-{
- return fabs(d1 - d2) < DBL_EPSILON;
-}
-
-static int compare_value(struct dm_config_value *a, struct dm_config_value *b)
-{
- int r = 0;
-
- if (a->type > b->type)
- return 1;
- if (a->type < b->type)
- return -1;
-
- switch (a->type) {
- case DM_CFG_STRING: r = strcmp(a->v.str, b->v.str); break;
- case DM_CFG_FLOAT: r = close_enough(a->v.f, b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
- case DM_CFG_INT: r = (a->v.i == b->v.i) ? 0 : (a->v.i > b->v.i) ? 1 : -1; break;
- case DM_CFG_EMPTY_ARRAY: return 0;
- }
-
- if (r == 0 && a->next && b->next)
- r = compare_value(a->next, b->next);
- return r;
-}
-
-static int compare_config(struct dm_config_node *a, struct dm_config_node *b)
-{
- int result = 0;
- if (a->v && b->v)
- result = compare_value(a->v, b->v);
- if (a->v && !b->v)
- result = 1;
- if (!a->v && b->v)
- result = -1;
- if (a->child && b->child)
- result = compare_config(a->child, b->child);
-
- if (result) {
- // DEBUGLOG("config inequality at %s / %s", a->key, b->key);
- return result;
- }
-
- if (a->sib && b->sib)
- result = compare_config(a->sib, b->sib);
- if (a->sib && !b->sib)
- result = 1;
- if (!a->sib && b->sib)
- result = -1;
-
- return result;
-}
-
static int vg_remove_if_missing(lvmetad_state *s, const char *vgid, int update_pvids);
enum update_pvid_mode { UPDATE_ONLY, REMOVE_EMPTY, MARK_OUTDATED };
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index 4ebbe1b..067c912 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -20,6 +20,9 @@
#include <string.h>
#include <unistd.h>
+#include <math.h> /* fabs() */
+#include <float.h> /* DBL_EPSILON */
+
int buffer_append_vf(struct buffer *buf, va_list ap)
{
char *append;
@@ -277,6 +280,60 @@ struct dm_config_node *config_make_nodes(struct dm_config_tree *cft,
return res;
}
+/* Test if the doubles are close enough to be considered equal */
+static int close_enough(double d1, double d2)
+{
+ return fabs(d1 - d2) < DBL_EPSILON;
+}
+
+static int compare_value(struct dm_config_value *a, struct dm_config_value *b)
+{
+ int r = 0;
+
+ if (a->type > b->type)
+ return 1;
+ if (a->type < b->type)
+ return -1;
+
+ switch (a->type) {
+ case DM_CFG_STRING: r = strcmp(a->v.str, b->v.str); break;
+ case DM_CFG_FLOAT: r = close_enough(a->v.f, b->v.f) ? 0 : (a->v.f > b->v.f) ? 1 : -1; break;
+ case DM_CFG_INT: r = (a->v.i == b->v.i) ? 0 : (a->v.i > b->v.i) ? 1 : -1; break;
+ case DM_CFG_EMPTY_ARRAY: return 0;
+ }
+
+ if (r == 0 && a->next && b->next)
+ r = compare_value(a->next, b->next);
+ return r;
+}
+
+int compare_config(struct dm_config_node *a, struct dm_config_node *b)
+{
+ int result = 0;
+ if (a->v && b->v)
+ result = compare_value(a->v, b->v);
+ if (a->v && !b->v)
+ result = 1;
+ if (!a->v && b->v)
+ result = -1;
+ if (a->child && b->child)
+ result = compare_config(a->child, b->child);
+
+ if (result) {
+ // DEBUGLOG("config inequality at %s / %s", a->key, b->key);
+ return result;
+ }
+
+ if (a->sib && b->sib)
+ result = compare_config(a->sib, b->sib);
+ if (a->sib && !b->sib)
+ result = 1;
+ if (!a->sib && b->sib)
+ result = -1;
+
+ return result;
+}
+
int buffer_realloc(struct buffer *buf, int needed)
{
char *new;
diff --git a/libdaemon/client/config-util.h b/libdaemon/client/config-util.h
index 58468ef..3e0a23f 100644
--- a/libdaemon/client/config-util.h
+++ b/libdaemon/client/config-util.h
@@ -46,6 +46,8 @@ struct dm_config_node *make_config_node(struct dm_config_tree *cft,
struct dm_config_node *parent,
struct dm_config_node *pre_sib);
+int compare_config(struct dm_config_node *a, struct dm_config_node *b);
+
struct dm_config_node *make_text_node(struct dm_config_tree *cft,
const char *key,
const char *value,
8 years, 10 months
master - cleanup: missing target_type check in device_is_usable filter
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0a203070f5189a...
Commit: 0a203070f5189a53f764e1e6e960ac70acfad5a9
Parent: 5577f2f4f0a5518662b9cedb6a373ccb67a71917
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 17 14:27:48 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 17 14:27:48 2015 +0200
cleanup: missing target_type check in device_is_usable filter
---
lib/activate/dev_manager.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 43e006a..f4b2a4a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -638,7 +638,7 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
* correctly, not just snapshots but any cobimnation possible
* in a stack - use proper dm tree to check this instead.
*/
- if (check.check_suspended &&
+ if (check.check_suspended && target_type &&
(!strcmp(target_type, "snapshot") || !strcmp(target_type, "snapshot-origin")) &&
_ignore_suspended_snapshot_component(dev)) {
log_debug_activation("%s: %s device %s not usable.", dev_name(dev), target_type, name);
8 years, 10 months
master - cleanup: || instead of |
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5577f2f4f0a551...
Commit: 5577f2f4f0a5518662b9cedb6a373ccb67a71917
Parent: 1e6a926e857d8df767415c6ff91d4dd1de74f363
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 17 14:12:18 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 17 14:12:58 2015 +0200
cleanup: || instead of |
More efficient with same result here.
---
lib/activate/dev_manager.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 8a54bec..43e006a 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -502,13 +502,13 @@ static int _ignore_suspended_snapshot_component(struct device *dev)
log_error("Incorrect snapshot table found");
goto_out;
}
- r = r | _device_is_suspended(major1, minor1) | _device_is_suspended(major2, minor2);
+ r = r || _device_is_suspended(major1, minor1) || _device_is_suspended(major2, minor2);
} else if (!strcmp(target_type, "snapshot-origin")) {
if (sscanf(params, "%d:%d", &major1, &minor1) != 2) {
log_error("Incorrect snapshot-origin table found");
goto_out;
}
- r = r | _device_is_suspended(major1, minor1);
+ r = r || _device_is_suspended(major1, minor1);
}
} while (next);
8 years, 10 months
master - filter: filter-usable: consider snapshot and origin LV as unusable if its component is suspended
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1e6a926e857d8d...
Commit: 1e6a926e857d8df767415c6ff91d4dd1de74f363
Parent: a9bc53d5f33afd5c4c3ad36450146f753c568a7c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 17 13:37:53 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 17 13:37:53 2015 +0200
filter: filter-usable: consider snapshot and origin LV as unusable if its component is suspended
Note that this is just a quick fix and it needs more robust fix to
encompass any combination, not just the (old) snapshot one!
This started with this report:
https://bugzilla.redhat.com/show_bug.cgi?id=1219222
If we have devices/ignore_suspended_devices=1 set based on which we
filter out suspended devices as unusable (or if we ignore suspended
devices by force, e.g. during lvconvert called from dmeventd) and
when we have snapshot and snapshot origin devices in the play, we
need to look at their components unerneath (*-real and *-cow) to
check if they're not suspended. If they are, the snapshot/snapshot
origin is not usable as well and hence it needs to be filtered out
by filter-usable.c code which does suspended device filtering.
Not going into much details here, more details are in the bugzilla
mentioned above. However, this is a quick fix since snapshot
and this exact situation is not the only one. So this is
something that needs to be revisited and fixed properly
with full dm tree and checking the whole stack to state
whether the device at the very top is usable or not.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 96 ++++++++++++++++++++++++++++++++++++++++---
2 files changed, 90 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e5a8af7..9e2a3dd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.122 -
=================================
+ Consider snapshot and origin LV as unusable if its component is suspended.
Fix lvmconfig segfault on settings with undefined default value (2.02.120).
Version 2.02.121 - 12th June 2015
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 9624feb..8a54bec 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -445,6 +445,78 @@ out:
return r;
}
+static int _device_is_suspended(int major, int minor)
+{
+ struct dm_task *dmt;
+ struct dm_info info;
+ int r = 0;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
+ return 0;
+
+ if (!dm_task_set_major_minor(dmt, major, minor, 1))
+ goto_out;
+
+ if (activation_checks() && !dm_task_enable_checks(dmt))
+ goto_out;
+
+ if (!dm_task_run(dmt) ||
+ !dm_task_get_info(dmt, &info)) {
+ log_error("Failed to get info for device %d:%d", major, minor);
+ goto out;
+ }
+
+ r = info.exists && info.suspended;
+out:
+ dm_task_destroy(dmt);
+ return r;
+}
+
+static int _ignore_suspended_snapshot_component(struct device *dev)
+{
+ struct dm_task *dmt;
+ void *next = NULL;
+ char *params, *target_type = NULL;
+ uint64_t start, length;
+ int major1, minor1, major2, minor2;
+ int r = 0;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
+ return_0;
+
+ if (!dm_task_set_major_minor(dmt, MAJOR(dev->dev), MINOR(dev->dev), 1))
+ goto_out;
+
+ if (activation_checks() && !dm_task_enable_checks(dmt))
+ goto_out;
+
+ if (!dm_task_run(dmt)) {
+ log_error("Failed to get state of snapshot or snapshot origin device");
+ goto out;
+ }
+
+ do {
+ next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
+ if (!strcmp(target_type, "snapshot")) {
+ if (sscanf(params, "%d:%d %d:%d", &major1, &minor1, &major2, &minor2) != 4) {
+ log_error("Incorrect snapshot table found");
+ goto_out;
+ }
+ r = r | _device_is_suspended(major1, minor1) | _device_is_suspended(major2, minor2);
+ } else if (!strcmp(target_type, "snapshot-origin")) {
+ if (sscanf(params, "%d:%d", &major1, &minor1) != 2) {
+ log_error("Incorrect snapshot-origin table found");
+ goto_out;
+ }
+ r = r | _device_is_suspended(major1, minor1);
+ }
+ } while (next);
+
+out:
+ dm_task_destroy(dmt);
+ return r;
+}
+
/*
* device_is_usable
* @dev
@@ -553,15 +625,25 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check)
* supported anymore and in general using mirrors in a stack
* is disabled by default (with a warning that if enabled,
* it could cause various deadlocks).
- * This is former check used, but it's not correct as it
- * disables snapshot-origins to be used in a stack in
- * general, not just over mirrors!
+ * Similar situation can happen with RAID devices where
+ * a RAID device can be snapshotted.
+ * If one of the RAID legs are down and we're doing
+ * lvconvert --repair, there's a time period in which
+ * snapshot components are (besides other devs) suspended.
+ * See also https://bugzilla.redhat.com/show_bug.cgi?id=1219222
+ * for an example where this causes problems.
+ *
+ * This is a quick check for now, but replace it with more
+ * robust and better check that would check the stack
+ * correctly, not just snapshots but any cobimnation possible
+ * in a stack - use proper dm tree to check this instead.
*/
- /*if (check.check_suspended && target_type && !strcmp(target_type, "snapshot-origin")) {
- log_debug_activation("%s: Snapshot-origin device %s not usable.",
- dev_name(dev), name);
+ if (check.check_suspended &&
+ (!strcmp(target_type, "snapshot") || !strcmp(target_type, "snapshot-origin")) &&
+ _ignore_suspended_snapshot_component(dev)) {
+ log_debug_activation("%s: %s device %s not usable.", dev_name(dev), target_type, name);
goto out;
- }*/
+ }
if (target_type && strcmp(target_type, "error"))
only_error_target = 0;
8 years, 10 months
master - config: fix some settings incorrectly marked as CFG_DEFAULT_COMMENTED instead of CFG_DEFAULT_UNDEFINED and causing segfault
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a9bc53d5f33afd...
Commit: a9bc53d5f33afd5c4c3ad36450146f753c568a7c
Parent: da1f88706060baf03bceb9e4d788c65646b831b7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jun 17 13:26:11 2015 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jun 17 13:34:31 2015 +0200
config: fix some settings incorrectly marked as CFG_DEFAULT_COMMENTED instead of CFG_DEFAULT_UNDEFINED and causing segfault
This patch fixes segfault which was caused by incorrectly marking some
settings CFG_DEFAULT_COMMENTED instead of CFG_DEFAULT_UNDEFINED - the
ones which have NULL default value, hence they're really undefined.
A regression caused by a98ceceb1d101f0b19a6115f406e23f13feab5ae.
For example:
$ lvmconfig log/file
file="/a"
Before this patch:
$ lvmconfig --type diff
Segmentation fault (core dumped)
With this patch applied:
$ lvmconfig --type diff
log {
file="/a"
}
The same applies for these settings:
log/activate_file
global/library_dir
global/system_id_file
<disk_area>/disk_area_id
There were also other settings with NULL default value and marked as
CFG_DEFAULT_COMMENTED instead of CFG_DEFAULT_UNDEFINED, but they were
cfg_array config settings where the NULL value was not causing segfault
(NULL == empty array).
---
WHATS_NEW | 1 +
lib/config/config_settings.h | 52 +++++++++++++++++++++---------------------
2 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 007ee0a..e5a8af7 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.122 -
=================================
+ Fix lvmconfig segfault on settings with undefined default value (2.02.120).
Version 2.02.121 - 12th June 2015
=================================
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 885a2fa..5c7b132 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -96,12 +96,12 @@
*
* Difference between CFG_DEFAULT_COMMENTED and CFG_DEFAULT_UNDEFINED:
*
- * UNDEFINED is only used if the value depends on other
- * system/kernel values outside of lvm. The most common
- * case is when dm-thin or dm-cache have built-in default
- * settings in the kernel, and lvm will use those built-in
- * default values unless the corresponding lvm config setting
- * is set.
+ * UNDEFINED is used if default value is NULL or the value
+ * depends on other system/kernel values outside of lvm.
+ * The most common case is when dm-thin or dm-cache have
+ * built-in default settings in the kernel, and lvm will use
+ * those built-in default values unless the corresponding lvm
+ * config setting is set.
*
* COMMENTED is used to comment out the default setting in
* lvm.conf. The effect is that if the LVM version is
@@ -202,7 +202,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi
"udev - Reuse existing udev database records. Applicable\n"
"only if LVM is compiled with udev support.\n")
-cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED , CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL, 0, NULL,
+cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED , CFG_TYPE_STRING, "#S", vsn(1, 2, 19), NULL, 0, NULL,
"Select which path name to display for a block device.\n"
"If multiple path names exist for a block device,\n"
"and LVM needs to display a name for the device,\n"
@@ -219,7 +219,7 @@ cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, C
"Example:\n"
"preferred_names = [ \"^/dev/mpath/\", \"^/dev/mapper/mpath\", \"^/dev/[hs]d\" ]\n")
-cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"Limit the block devices that are used by LVM commands.\n"
"This is a list of regular expressions used to accept or\n"
"reject block device path names. Each regex is delimited\n"
@@ -254,7 +254,7 @@ cfg_array(devices_filter_CFG, "filter", devices_CFG_SECTION, CFG_DEFAULT_COMMENT
"Use anchors to be very specific.\n"
"filter = [ \"a|^/dev/hda8$|\", \"r|.*/|\" ]\n")
-cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL, 0, NULL,
+cfg_array(devices_global_filter_CFG, "global_filter", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 98), NULL, 0, NULL,
"Limit the block devices that are used by LVM system components.\n"
"Because devices/filter may be overridden from the command line,\n"
"it is not suitable for system-wide device filtering, e.g. udev\n"
@@ -281,7 +281,7 @@ cfg(devices_cache_file_prefix_CFG, "cache_file_prefix", devices_CFG_SECTION, CFG
cfg(devices_write_cache_state_CFG, "write_cache_state", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(1, 0, 0), NULL, 0, NULL,
"Enable/disable writing the cache file. See devices/cache_dir.\n")
-cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, CFG_DEFAULT_COMMENTED| CFG_ADVANCED, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg_array(devices_types_CFG, "types", devices_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_ADVANCED, CFG_TYPE_INT | CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"List of additional acceptable block device types.\n"
"These are of device type names from /proc/devices,\n"
"followed by the maximum number of partitions.\n"
@@ -398,7 +398,7 @@ cfg(devices_issue_discards_CFG, "issue_discards", devices_CFG_SECTION, 0, CFG_TY
"and thinly provisioned LUNs generally do. If enabled, discards\n"
"will only be issued if both the storage and kernel provide support.\n")
-cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL, 0, NULL,
+cfg_array(allocation_cling_tag_list_CFG, "cling_tag_list", allocation_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 77), NULL, 0, NULL,
"Advise LVM which PVs to use when searching for new space.\n"
"When searching for free space to extend an LV, the 'cling'\n"
"allocation policy will choose space on the same PVs as the last\n"
@@ -532,7 +532,7 @@ cfg(log_silent_CFG, "silent", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SILENT,
cfg(log_syslog_CFG, "syslog", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_SYSLOG, vsn(1, 0, 0), NULL, 0, NULL,
"Send log messages through syslog.\n")
-cfg(log_file_CFG, "file", log_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg(log_file_CFG, "file", log_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"Write error and debug log messages to a file specified here.\n")
cfg(log_overwrite_CFG, "overwrite", log_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_OVERWRITE, vsn(1, 0, 0), NULL, 0, NULL,
@@ -560,7 +560,7 @@ cfg(log_activation_CFG, "activation", log_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(
"Log messages during activation.\n"
"Don't use this in low memory situations (can deadlock).\n")
-cfg(log_activate_file_CFG, "activate_file", log_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
+cfg(log_activate_file_CFG, "activate_file", log_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_UNSUPPORTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
cfg_array(log_debug_classes_CFG, "debug_classes", log_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, "#Smemory#Sdevices#Sactivation#Sallocation#Slvmetad#Smetadata#Scache#Slocking#Slvmpolld", vsn(2, 2, 99), NULL, 0, NULL,
"Select log messages by class.\n"
@@ -640,12 +640,12 @@ cfg(global_format_CFG, "format", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_
"\"lvm1\" or \"lvm2\".\n"
"The command line override is -M1 or -M2.\n")
-cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg_array(global_format_libraries_CFG, "format_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"Shared libraries that process different metadata formats.\n"
"If support for LVM1 metadata was compiled as a shared library use\n"
"format_libraries = \"liblvm2format1.so\"\n")
-cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL, NULL)
+cfg_array(global_segment_libraries_CFG, "segment_libraries", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL, NULL)
cfg(global_proc_CFG, "proc", global_CFG_SECTION, CFG_ADVANCED, CFG_TYPE_STRING, DEFAULT_PROC_DIR, vsn(1, 0, 0), NULL, 0, NULL,
"Location of proc filesystem.\n")
@@ -710,7 +710,7 @@ cfg(global_prioritise_write_locks_CFG, "prioritise_write_locks", global_CFG_SECT
"This option only affects locking_type 1 viz.\n"
"local file-based locking.\n")
-cfg(global_library_dir_CFG, "library_dir", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg(global_library_dir_CFG, "library_dir", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"Search this directory first for shared libraries.\n")
cfg(global_locking_library_CFG, "locking_library", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_LOCKING_LIB, vsn(1, 0, 0), NULL, 0, NULL,
@@ -865,7 +865,7 @@ cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTIO
cfg_array(global_thin_repair_options_CFG, "thin_repair_options", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "#S" DEFAULT_THIN_REPAIR_OPTIONS, vsn(2, 2, 100), NULL, 0, NULL,
"List of options passed to the thin_repair command.\n")
-cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL, 0, NULL,
+cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "#S", vsn(2, 2, 99), NULL, 0, NULL,
"Features to not use in the thin driver.\n"
"This can be helpful for testing, or to avoid\n"
"using a feature that is causing problems.\n"
@@ -925,7 +925,7 @@ cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, 0, CFG_
"file - Use the contents of another file (system_id_file) to set\n"
"the system ID.\n")
-cfg(global_system_id_file_CFG, "system_id_file", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL, 0, NULL,
+cfg(global_system_id_file_CFG, "system_id_file", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL, 0, NULL,
"The full path to the file containing a system ID.\n"
"This is used when system_id_source is set to 'file'.\n"
"Comments starting with the character # are ignored.\n")
@@ -1007,7 +1007,7 @@ cfg(activation_process_priority_CFG, "process_priority", activation_CFG_SECTION,
"Use a high priority so that LVs are suspended\n"
"for the shortest possible time.\n")
-cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL,
+cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL,
"Only LVs selected by this list are activated.\n"
"If this list is defined, an LV is only activated\n"
"if it matches an entry in this list.\n"
@@ -1024,7 +1024,7 @@ cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG
"Example:\n"
"volume_list = [ \"vg1\", \"vg2/lvol1\", \"@tag1\", \"@*\" ]\n")
-cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL, 0, NULL,
+cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL, 0, NULL,
"Only LVs selected by this list are auto-activated.\n"
"This list works like volume_list, but it is used\n"
"only by auto-activation commands. It does not apply\n"
@@ -1054,7 +1054,7 @@ cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_li
"Possible options are: vgname, vgname/lvname, @tag, @*\n"
"See volume_list for how these options are matched to LVs.\n")
-cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL, 0, NULL,
+cfg_array(activation_read_only_volume_list_CFG, "read_only_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 89), NULL, 0, NULL,
"LVs in this list are activated in read-only mode.\n"
"If this list is defined, each LV that is to be activated\n"
"is checked against this list, and if it matches, it is\n"
@@ -1191,7 +1191,7 @@ cfg(activation_thin_pool_autoextend_percent_CFG, "thin_pool_autoextend_percent",
"The amount of additional space added to a thin pool is this\n"
"percent of its current size.\n")
-cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, CFG_DEFAULT_COMMENTED | CFG_ADVANCED, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL, 0, NULL,
+cfg_array(activation_mlock_filter_CFG, "mlock_filter", activation_CFG_SECTION, CFG_DEFAULT_UNDEFINED | CFG_ADVANCED, CFG_TYPE_STRING, NULL, vsn(2, 2, 62), NULL, 0, NULL,
"Do not mlock these memory areas.\n"
"While activating devices, I/O to devices being\n"
"(re)configured is suspended. As a precaution against\n"
@@ -1293,7 +1293,7 @@ cfg(metadata_pvmetadataignore_CFG, "pvmetadataignore", metadata_CFG_SECTION, CFG
cfg(metadata_stripesize_CFG, "stripesize", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_STRIPESIZE, vsn(1, 0, 0), NULL, 0, NULL, NULL)
-cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
+cfg_array(metadata_dirs_CFG, "dirs", metadata_CFG_SECTION, CFG_ADVANCED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL,
"Directories holding live copies of text format metadata.\n"
"These directories must not be on logical volumes!\n"
"It's possible to use LVM with a couple of directories here,\n"
@@ -1312,7 +1312,7 @@ cfg_section(metadata_disk_areas_CFG_SUBSECTION, "disk_areas", metadata_CFG_SECTI
cfg_section(disk_area_CFG_SUBSECTION, "disk_area", metadata_disk_areas_CFG_SUBSECTION, CFG_NAME_VARIABLE | CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, vsn(1, 0, 0), 0, NULL, NULL)
cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL, 0, NULL, NULL)
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL, 0, NULL, NULL)
-cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
+cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL, 0, NULL, NULL)
cfg(report_compact_output_CFG, "compact_output", report_CFG_SECTION, CFG_PROFILABLE | CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_REP_COMPACT_OUTPUT, vsn(2, 2, 115), NULL, 0, NULL,
"Do not print empty report fields.\n"
@@ -1474,7 +1474,7 @@ cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE | CFG
"bar is given to the hosts named machine1 and machine2.\n"
"tags { foo { } bar { host_list = [ \"machine1\", \"machine2\" ] } }\n")
-cfg_array(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL,
+cfg_array(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL, 0, NULL,
"A list of machine names.\n"
"These machine names are compared to the nodename\n"
"returned by uname(2). If the local machine name\n"
@@ -1496,7 +1496,7 @@ cfg(local_system_id_CFG, "system_id", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_D
"Set the system_id to the string 'host1'.\n"
"system_id = \"host1\"\n")
-cfg_array(local_extra_system_ids_CFG, "extra_system_ids", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL, 0, NULL,
+cfg_array(local_extra_system_ids_CFG, "extra_system_ids", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, "#S", vsn(2, 2, 117), NULL, 0, NULL,
"A list of extra VG system IDs the local host can access.\n"
"VGs with the system IDs listed here (in addition\n"
"to the host's own system ID) can be fully accessed\n"
8 years, 10 months
master - Add a global get_cmd_name()
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=da1f88706060ba...
Commit: da1f88706060baf03bceb9e4d788c65646b831b7
Parent: e043e03cd853f9dbeb653ecdd63957d39c7136cc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 16 15:13:10 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 16 15:13:10 2015 -0500
Add a global get_cmd_name()
Which returns the string set by set_cmd_name().
---
lib/misc/lvm-globals.c | 5 +++++
lib/misc/lvm-globals.h | 1 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 6455788..4fa0779 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -193,6 +193,11 @@ void set_cmd_name(const char *cmd)
_cmd_name[sizeof(_cmd_name) - 1] = '\0';
}
+const char *get_cmd_name(void)
+{
+ return _cmd_name;
+}
+
void set_sysfs_dir_path(const char *path)
{
strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path) - 1);
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
index b25f4ae..8628a89 100644
--- a/lib/misc/lvm-globals.h
+++ b/lib/misc/lvm-globals.h
@@ -51,6 +51,7 @@ void init_detect_internal_vg_cache_corruption(int detect);
void init_retry_deactivation(int retry);
void set_cmd_name(const char *cmd_name);
+const char *get_cmd_name(void);
void set_sysfs_dir_path(const char *path);
int test_mode(void);
8 years, 10 months
master - lv_refresh: move the bulk of the function into lib
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e043e03cd853f9...
Commit: e043e03cd853f9dbeb653ecdd63957d39c7136cc
Parent: 3d9957e3dd82666a360481b3a18baa9f23c75300
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 16 13:38:40 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 16 13:38:40 2015 -0500
lv_refresh: move the bulk of the function into lib
So that it can be used from other lib code.
---
lib/metadata/lv_manip.c | 22 ++++++++++++++++++++++
lib/metadata/metadata-exported.h | 2 ++
tools/toollib.c | 18 ++----------------
3 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1251a5d..9983793 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1395,6 +1395,28 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
return 1;
}
+int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv)
+{
+ if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
+ log_error("Refusing refresh of partial LV %s."
+ " Use '--activationmode partial' to override.",
+ display_lvname(lv));
+ return 0;
+ }
+
+ if (!suspend_lv(cmd, lv)) {
+ log_error("Failed to suspend %s.", display_lvname(lv));
+ return 0;
+ }
+
+ if (!resume_lv(cmd, lv)) {
+ log_error("Failed to reactivate %s.", display_lvname(lv));
+ return 0;
+ }
+
+ return 1;
+}
+
/*
* Remove given number of extents from LV.
*/
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index b673af3..ff10a98 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -738,6 +738,8 @@ int lv_empty(struct logical_volume *lv);
/* Empty an LV and add error segment */
int replace_lv_with_error_segment(struct logical_volume *lv);
+int lv_refresh_suspend_resume(struct cmd_context *cmd, struct logical_volume *lv);
+
/* Entry point for all LV extent allocations */
int lv_extend(struct logical_volume *lv,
const struct segment_type *segtype,
diff --git a/tools/toollib.c b/tools/toollib.c
index ca198dc..bfd3789 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -850,22 +850,8 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
{
- if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
- log_error("Refusing refresh of partial LV %s."
- " Use '--activationmode partial' to override.",
- lv->name);
- return 0;
- }
-
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to suspend %s.", lv->name);
- return 0;
- }
-
- if (!resume_lv(cmd, lv)) {
- log_error("Failed to reactivate %s.", lv->name);
- return 0;
- }
+ if (!lv_refresh_suspend_resume(cmd, lv))
+ return_0;
/*
* check if snapshot merge should be polled
8 years, 10 months
master - man vgchange lvchange: mention activation option s
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d9957e3dd8266...
Commit: 3d9957e3dd82666a360481b3a18baa9f23c75300
Parent: 857296c8236f12d93029d6382c8d472598666e6e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 16 13:28:07 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 16 13:28:07 2015 -0500
man vgchange lvchange: mention activation option s
and improve the existing text about existing
activation options.
---
man/lvchange.8.in | 39 ++++++++++++++++++++++++++++++++-------
man/vgchange.8.in | 47 ++++++++++++++++++++++++++++++++++++-----------
2 files changed, 68 insertions(+), 18 deletions(-)
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 6b41c81..9199b49 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -8,7 +8,7 @@ lvchange \(em change attributes of a logical volume
.RB [ \-A | \-\-autobackup
.RI { y | n }]
.RB [ \-a | \-\-activate
-.RI [ a | e | l ]{ y | n }]
+.RI [ a | e | s | l ]{ y | n }]
.RB [ \-\-activationmode
.RI { complete | degraded | partial }]
.RB [ \-k | \-\-setactivationskip
@@ -81,7 +81,7 @@ including making them known to the kernel ready for use.
.SH OPTIONS
See \fBlvm\fP(8) for common options.
.TP
-.BR \-a ", " \-\-activate " [" \fIa | \fIe | \fIl ]{ \fIy | \fIn }
+.BR \-a ", " \-\-activate " [" \fIa | \fIe | \fIs | \fIl ]{ \fIy | \fIn }
Controls the availability of the logical volumes for use.
Communicates with the kernel device-mapper driver via
libdevmapper to activate (\-ay) or deactivate (\-an) the
@@ -104,11 +104,36 @@ activation. The \-aay option should be also used during system
boot so it's possible to select which volumes to activate using
the activation/auto_activation_volume_list setting.
.IP
-If clustered locking is enabled, -aey will activate exclusively
-on one node and -aly will activate only on the local node.
-To deactivate only on the local node use -aln.
-Logical volumes with single-host snapshots are always activated
-exclusively because they can only be used on one node at once.
+In a clustered VG, clvmd is used for activation, and the
+following options are possible:
+
+With \-aey, clvmd activates the LV in exclusive mode
+(with an exclusive lock), allowing a single node to activate the LV.
+
+With \-asy, clvmd activates the LV in shared mode
+(with a shared lock), allowing multiple nodes to activate the LV concurrently.
+If the LV type prohibits shared access, such as an LV with a snapshot,
+the 's' option is ignored and an exclusive lock is used.
+
+With \-ay (no mode specified), clvmd activates the LV in shared mode
+if the LV type allows concurrent access, such as a linear LV.
+Otherwise, clvmd activates the LV in exclusive mode.
+
+With \-aey, \-asy, and \-ay, clvmd attempts to activate the LV
+on all nodes. If exclusive mode is used, then only one of the
+nodes will be successful.
+
+With \-an, clvmd attempts to deactivate the LV on all nodes.
+
+With \-aly, clvmd activates the LV only on the local node, and \-aln
+deactivates only on the local node. If the LV type allows concurrent
+access, then shared mode is used, otherwise exclusive.
+
+LVs with snapshots are always activated exclusively because they can only
+be used on one node at once.
+
+For local VGs, \-ay, \-aey, and \-asy are all equivalent.
+
.TP
.BR \-\-activationmode " {" \fIcomplete | \fIdegraded | \fIpartial }
The activation mode determines whether logical volumes are allowed to
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index e6e850a..8225eb5 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -10,7 +10,7 @@ vgchange \(em change attributes of a volume group
.RB [ \-A | \-\-autobackup
.RI { y | n }]
.RB [ \-a | \-\-activate
-.RI [ a | e | l ]
+.RI [ a | e | s | l ]
.RI { y | n }]
.RB [ \-\-activationmode
.IR { complete | degraded | partial } ]
@@ -77,7 +77,7 @@ Controls automatic backup of metadata after the change. See
.BR vgcfgbackup (8).
Default is yes.
.TP
-.BR \-a ", " \-\-activate " [" \fIa | \fIe | \fIl ]{ \fIy | \fIn }
+.BR \-a ", " \-\-activate " [" \fIa | \fIe | \fIs | \fIl ]{ \fIy | \fIn }
Controls the availability of the logical volumes in the volume
group for input/output.
In other words, makes the logical volumes known/unknown to the kernel.
@@ -98,24 +98,49 @@ The location and name of the underlying device node may depend on
the distribution and configuration (e.g. udev) and might change
from release to release.
.IP
-If clustered locking is enabled, add 'e' to activate/deactivate
-exclusively on one node or 'l' to activate/deactivate only
-on the local node.
-Logical volumes with single-host snapshots are always activated
-exclusively because they can only be used on one node at once.
+In a clustered VG, clvmd is used for activation, and the
+following options are possible:
+
+With \-aey, clvmd activates the LV in exclusive mode
+(with an exclusive lock), allowing a single node to activate the LV.
+
+With \-asy, clvmd activates the LV in shared mode
+(with a shared lock), allowing multiple nodes to activate the LV concurrently.
+If the LV type prohibits shared access, such as an LV with a snapshot,
+the 's' option is ignored and an exclusive lock is used.
+
+With \-ay (no mode specified), clvmd activates the LV in shared mode
+if the LV type allows concurrent access, such as a linear LV.
+Otherwise, clvmd activates the LV in exclusive mode.
+
+With \-aey, \-asy, and \-ay, clvmd attempts to activate the LV
+on all nodes. If exclusive mode is used, then only one of the
+nodes will be successful.
+
+With \-an, clvmd attempts to deactivate the LV on all nodes.
+
+With \-aly, clvmd activates the LV only on the local node, and \-aln
+deactivates only on the local node. If the LV type allows concurrent
+access, then shared mode is used, otherwise exclusive.
+
+LVs with snapshots are always activated exclusively because they can only
+be used on one node at once.
+
+For local VGs, \-ay, \-aey, and \-asy are all equivalent.
+
.TP
.BR \-\-activationmode " {" \fIcomplete | \fIdegraded | \fIpartial }
The activation mode determines whether logical volumes are allowed to
activate when there are physical volumes missing (e.g. due to a device
-failure). \fIcomplete is the most restrictive; allowing only those
+failure). \fIcomplete\fP is the most restrictive; allowing only those
logical volumes to be activated that are not affected by the missing
-PVs. \fIdegraded allows RAID logical volumes to be activated even if
+PVs. \fIdegraded\fP allows RAID logical volumes to be activated even if
they have PVs missing. (Note that the "mirror" segment type is not
considered a RAID logical volume. The "raid1" segment type should
-be used instead.) Finally, \fIpartial allows any logical volume to
+be used instead.) Finally, \fIpartial\fP allows any logical volume to
be activated even if portions are missing due to a missing or failed
PV. This last option should only be used when performing recovery or
-repair operations. \fIdegraded is the default mode. To change it, modify
+repair operations. \fIdegraded\fP is the default mode. To change it, modify
.B activation_mode
in
.BR lvm.conf (5).
8 years, 10 months
master - man lvm: mention hyphens in option names
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=857296c8236f12...
Commit: 857296c8236f12d93029d6382c8d472598666e6e
Parent: d5adec105626c39ffd6295c832dfda9189a1d85d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 16 10:33:01 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 16 10:33:01 2015 -0500
man lvm: mention hyphens in option names
---
man/lvm.8.in | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 89b7efe..b8b4854 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -163,6 +163,10 @@ The following commands are not implemented in LVM2 but might be in the future: l
The following options are available for many of the commands.
They are implemented generically and documented here rather
than repeated on individual manual pages.
+
+Additional hyphens within option names are ignored. For example,
+\-\-readonly and \-\-read\-only are both accepted.
+
.TP
.BR \-h ", " \-? ", " \-\-help
Display the help text.
8 years, 10 months