master - memlock: skip more entries
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32ad8ab5a4a6cd...
Commit: 32ad8ab5a4a6cd00f15beb947568a7a5b702f545
Parent: 59ed4d3bf6b1aaf7c3db837251c60ff9004f0879
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 20 11:10:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:13:41 2014 +0200
memlock: skip more entries
Add more entries for memlock skipping - since those are never
used by lvm code in critical section (suspend state).
---
lib/mm/memlock.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 84b93db..7d9a8f3 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -100,8 +100,10 @@ static const char * const _blacklist_maps[] = {
"/libselinux.so.", /* not using selinux during mlock */
"/libsepol.so.", /* not using sepol during mlock */
"/libtinfo.so.", /* not using tinfo during mlock */
- "/libuuid.so.", /* not using uuid during mlock (blkid) */
+ "/libudev.so.", /* not using udev during mlock */
+ "/libuuid.so.", /* not using uuid during mlock (blkid) */
"/libdl-", /* not using dlopen,dlsym during mlock */
+ "/etc/selinux", /* not using selinux during mlock */
/* "/libdevmapper-event.so" */
};
9 years, 10 months
master - dmsetup: no need to check for "help" field name after report init
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=59ed4d3bf6b1aa...
Commit: 59ed4d3bf6b1aaf7c3db837251c60ff9004f0879
Parent: c6d82c992b4a4271287233dbedc3a075fa03ca43
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 18:20:30 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 18:22:51 2014 +0200
dmsetup: no need to check for "help" field name after report init
The "help" field (as well as "?") is implicit now - libdevmapper
takes care of it completely.
---
tools/dmsetup.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 454141e..c679c52 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -2948,9 +2948,6 @@ static int _report_init(const struct command *cmd)
r = 1;
out:
- if (!strcasecmp(options, "help") || !strcmp(options, "?"))
- r = 1;
-
if (len)
dm_free(options);
9 years, 10 months
master - pvmove: Fix code that looks up the "move pv" for display
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c6d82c992b4a42...
Commit: c6d82c992b4a4271287233dbedc3a075fa03ca43
Parent: 3964a1a89f52584878c09cf93bc971b96c0d3de1
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Jun 19 10:57:08 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Jun 19 10:57:08 2014 -0500
pvmove: Fix code that looks up the "move pv" for display
'lvs' would segfault if trying to display the "move pv" if the
pvmove was run with '--atomic'. The structure of an atomic pvmove
is different and requires us to descend another level in the
LV tree to retrieve the PV information.
---
lib/metadata/lv.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 733e9f6..a1211a8 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -316,11 +316,26 @@ char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
char *lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
+ struct logical_volume *mimage0_lv;
struct lv_segment *seg;
-
- dm_list_iterate_items(seg, &lv->segments)
- if (seg->status & PVMOVE)
- return dm_pool_strdup(mem, dev_name(seg_dev(seg, 0)));
+ const struct device *dev;
+
+ dm_list_iterate_items(seg, &lv->segments) {
+ if (seg->status & PVMOVE) {
+ if (seg_type(seg, 0) == AREA_LV) { /* atomic pvmove */
+ mimage0_lv = seg_lv(seg, 0);
+ if (!lv_is_mirror_type(mimage0_lv)) {
+ log_error(INTERNAL_ERROR
+ "Bad pvmove structure");
+ return NULL;
+ }
+ dev = seg_dev(first_seg(mimage0_lv), 0);
+ } else /* Segment pvmove */
+ dev = seg_dev(seg, 0);
+
+ return dm_pool_strdup(mem, dev_name(dev));
+ }
+ }
return NULL;
}
9 years, 10 months
master - pvmove: Clean-up iterator.
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3964a1a89f5258...
Commit: 3964a1a89f52584878c09cf93bc971b96c0d3de1
Parent: f16da6ef23c75b966f94a27b45ca57bacaa13d20
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Thu Jun 19 10:52:09 2014 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Thu Jun 19 10:52:09 2014 -0500
pvmove: Clean-up iterator.
In 'find_pvmove_lv', separate the code that searches the atomic
pvmove LVs from the code that searches the normal pvmove LVs. This
cleans up the segment iterator code a bit.
---
lib/metadata/mirror.c | 23 +++++++++++++++++++----
1 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index ca0c2a1..484b1f1 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1559,14 +1559,29 @@ struct logical_volume *find_pvmove_lv(struct volume_group *vg,
if (!(lv->status & lv_type))
continue;
- /* Check segment origins point to pvname */
+ /*
+ * If this is an atomic pvmove, the first
+ * segment will be a mirror containing
+ * mimages (i.e. AREA_LVs)
+ */
+ if (seg_type(first_seg(lv), 0) == AREA_LV) {
+ seg = first_seg(lv); /* the mirror segment */
+ seg = first_seg(seg_lv(seg, 0)); /* mimage_0 segment0 */
+ if (seg_dev(seg, 0) != dev)
+ continue;
+ return lv;
+ }
+
+ /*
+ * If this is a normal pvmove, check all the segments'
+ * first areas for the requested device
+ */
dm_list_iterate_items(seg, &lv->segments) {
- if (seg_type(seg, 0) == AREA_LV) /* Atomic pvmove */
- seg = first_seg(seg_lv(seg, 0));
- if (seg_type(seg, 0) != AREA_PV) /* Segment pvmove */
+ if (seg_type(seg, 0) != AREA_PV)
continue;
if (seg_dev(seg, 0) != dev)
continue;
+
return lv;
}
}
9 years, 10 months
master - report: display explicit fields first, then implicit fields in field help
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f16da6ef23c75b...
Commit: f16da6ef23c75b966f94a27b45ca57bacaa13d20
Parent: a40bc36b2e360ad357820e6de2f5ec9fa64a6772
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:54:22 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 16:14:53 2014 +0200
report: display explicit fields first, then implicit fields in field help
It's better to have implicit fields at the very end of the output
so users can see them without scrolling back if the list of fields
is long (the "help" is also an implicit field now so it should be
easily visible).
---
libdm/libdm-report.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 012dca4..fd03052 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -653,11 +653,12 @@ static void _display_fields(struct dm_report *rh, int display_all_fields_item,
if ((tmp = _get_longest_field_id_len(rh->fields)) > id_len)
id_len = tmp;
- _display_fields_more(rh, _implicit_report_fields, id_len,
- display_all_fields_item, display_field_types);
- log_warn(" ");
_display_fields_more(rh, rh->fields, id_len, display_all_fields_item,
display_field_types);
+ log_warn(" ");
+ _display_fields_more(rh, _implicit_report_fields, id_len,
+ display_all_fields_item, display_field_types);
+
}
/*
9 years, 10 months
master - libdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a40bc36b2e360a...
Commit: a40bc36b2e360ad357820e6de2f5ec9fa64a6772
Parent: cd7325f18d6869452447b7e1d08d8ada7703e0de
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:47:24 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 16:09:32 2014 +0200
libdevmapper: revoke commit 7c86131233011c9fb81190bcb40d5d4ac54a533d
We have "help" and "?" defined as implicit fields now. As such, we
don't need to export these names in libdevmapper (as it was introduced
by commit 7c86131233011c9fb81190bcb40d5d4ac54a533d within this release).
If anyone uses these field names by mistake, the libdevmapper code can
error out correctly if it detects that the set of explicit field names
(the ones supplied by "fields" arg in dm_report_init/dm_report_init_with_selection)
contains any of the implicit field names (the ones defined internally
by libdevmapper itself).
---
WHATS_NEW_DM | 1 -
libdm/libdevmapper.h | 4 ----
libdm/libdm-report.c | 8 ++++----
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 3d1eee1..119016a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -19,7 +19,6 @@ Version 1.02.88 -
Document env var 'DM_DEFAULT_NAME_MANGLING_MODE' in dmsetup man page.
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
Also recognize 'help'/'?' as reserved sort key name to show help.
- Export recognized DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} to show help.
Add dm_units_to_factor for size unit parsing.
Increase bitset size for minors for thin dmeventd plugin.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index fab1071..90e0b51 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1642,10 +1642,6 @@ struct dm_report_field;
#define DM_REPORT_FIELD_TYPE_ID_LEN 32
#define DM_REPORT_FIELD_TYPE_HEADING_LEN 32
-/* Reserved field names for special purposes. */
-#define DM_REPORT_FIELD_RESERVED_NAME_HELP "help" /* shows help */
-#define DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT "?" /* shows help */
-
struct dm_report;
struct dm_report_field_type {
uint32_t type; /* object type id */
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 8e46f78..012dca4 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -194,8 +194,8 @@ struct row {
*/
#define COMMON_REPORT_TYPE 0x80000000
#define COMMON_FIELD_SELECTED_ID "selected"
-#define COMMON_FIELD_HELP_ID DM_REPORT_FIELD_RESERVED_NAME_HELP
-#define COMMON_FIELD_HELP_ALT_ID DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT
+#define COMMON_FIELD_HELP_ID "help"
+#define COMMON_FIELD_HELP_ALT_ID "?"
static void *_null_returning_fn(void *obj __attribute__((unused)))
{
@@ -2663,8 +2663,8 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
}
rh->reserved_values = reserved_values;
- if (!strcasecmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP) ||
- !strcmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT)) {
+ if (!strcasecmp(selection, COMMON_FIELD_HELP_ID) ||
+ !strcmp(selection, COMMON_FIELD_HELP_ALT_ID)) {
_display_fields(rh, 0, 1);
log_warn(" ");
_display_selection_help(rh);
9 years, 10 months
master - report: make "help" and "?" field implicit
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cd7325f18d6869...
Commit: cd7325f18d6869452447b7e1d08d8ada7703e0de
Parent: 012dab7aa3373201e59a77fa1e11823bd95c771c
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:33:16 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 16:09:31 2014 +0200
report: make "help" and "?" field implicit
Making "help" and "?" implicit also simplifies code since the
dm_report_init caller (lvm/dmsetup) doesn't need to check on
dm_report_init return whether "help" or "?" was hit while parsing
fields/sort keys in libdevmapper.
The libdevmapper now sets internal "RH_ALREADY_REPORTED" flag
after it reports the "help" or "?" implicit field. Then libdevmapper
itself checks for this flag in dm_report_object and if found,
the actual reporting is skipped (because the "help" implicit field
was reported instead of the actual report).
---
WHATS_NEW_DM | 1 +
libdm/libdm-report.c | 84 +++++++++++++++++++++++++++++++++----------------
tools/reporter.c | 11 +------
3 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 9e6f92e..3d1eee1 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.88 -
=================================
+ Make "help" and "?" reporting fields implicit.
Recognize implicit "selected" field if using dm_report_init_with_selection.
Add support for implicit reporting fields which are predefined in libdm.
Add DM_REPORT_FIELD_TYPE_PERCENT: separate number and percent fields.
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 00b99c8..8e46f78 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -24,6 +24,7 @@
*/
#define RH_SORT_REQUIRED 0x00000100
#define RH_HEADINGS_PRINTED 0x00000200
+#define RH_ALREADY_REPORTED 0x00000400
struct dm_report {
struct dm_pool *mem;
@@ -191,29 +192,24 @@ struct row {
/*
* Implicit report types and fields.
*/
-static const struct dm_report_object_type _implicit_void_report_types[] = {
- { 0, "", "", NULL }
-};
-
-static const struct dm_report_field_type _implicit_void_report_fields[] = {
- { 0, 0, 0, 0, "", "", 0, 0}
-};
-
-static const struct dm_report_object_type *_implicit_report_types = _implicit_void_report_types;
-static const struct dm_report_field_type *_implicit_report_fields = _implicit_void_report_fields;
-
#define COMMON_REPORT_TYPE 0x80000000
#define COMMON_FIELD_SELECTED_ID "selected"
+#define COMMON_FIELD_HELP_ID DM_REPORT_FIELD_RESERVED_NAME_HELP
+#define COMMON_FIELD_HELP_ALT_ID DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT
-static void *_null_returning_fn(void *obj)
+static void *_null_returning_fn(void *obj __attribute__((unused)))
{
return NULL;
}
-static const struct dm_report_object_type _implicit_common_report_types[] = {
- { COMMON_REPORT_TYPE, "Common", "common_", _null_returning_fn },
- { 0, "", "", NULL }
-};
+static int _no_report_fn(struct dm_report *rh __attribute__((unused)),
+ struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field __attribute__((unused)),
+ const void *data __attribute__((unused)),
+ void *private __attribute__((unused)))
+{
+ return 1;
+}
static int _selected_disp(struct dm_report *rh,
struct dm_pool *mem __attribute__((unused)),
@@ -225,11 +221,27 @@ static int _selected_disp(struct dm_report *rh,
return dm_report_field_int(rh, field, &row->selected);
}
+static const struct dm_report_object_type _implicit_common_report_types[] = {
+ { COMMON_REPORT_TYPE, "Common", "common_", _null_returning_fn },
+ { 0, "", "", NULL }
+};
+
static const struct dm_report_field_type _implicit_common_report_fields[] = {
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
+ { 0, 0, 0, 0, "", "", 0, 0}
+};
+
+static const struct dm_report_field_type _implicit_common_report_fields_with_selection[] = {
{ COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_SELECTED_ID, "Selected", _selected_disp, "Item passes selection criteria." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
{ 0, 0, 0, 0, "", "", 0, 0}
};
+static const struct dm_report_object_type *_implicit_report_types = _implicit_common_report_types;
+static const struct dm_report_field_type *_implicit_report_fields = _implicit_common_report_fields;
+
static const struct dm_report_object_type *_find_type(struct dm_report *rh,
uint32_t report_type)
{
@@ -940,10 +952,7 @@ static int _parse_fields(struct dm_report *rh, const char *format,
if (!_field_match(rh, ws, (size_t) (we - ws), report_type_only)) {
_display_fields(rh, 1, 0);
log_warn(" ");
- if (strcasecmp(ws, DM_REPORT_FIELD_RESERVED_NAME_HELP) &&
- strcmp(ws, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT))
- log_error("Unrecognised field: %.*s",
- (int) (we - ws), ws);
+ log_error("Unrecognised field: %.*s", (int) (we - ws), ws);
return 0;
}
}
@@ -970,10 +979,7 @@ static int _parse_keys(struct dm_report *rh, const char *keys,
if (!_key_match(rh, ws, (size_t) (we - ws), report_type_only)) {
_display_fields(rh, 1, 0);
log_warn(" ");
- if (strcasecmp(ws, DM_REPORT_FIELD_RESERVED_NAME_HELP) &&
- strcmp(ws, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT))
- log_error("dm_report: Unrecognised field: %.*s",
- (int) (we - ws), ws);
+ log_error("dm_report: Unrecognised field: %.*s", (int) (we - ws), ws);
return 0;
}
}
@@ -1015,6 +1021,20 @@ static void _dm_report_init_update_types(struct dm_report *rh, uint32_t *report_
*report_types &= ~type->id;
}
+static int _help_requested(struct dm_report *rh)
+{
+ struct field_properties *fp;
+
+ dm_list_iterate_items(fp, &rh->field_props) {
+ if (fp->implicit &&
+ (!strcmp(_implicit_report_fields[fp->field_num].id, COMMON_FIELD_HELP_ID) ||
+ !strcmp(_implicit_report_fields[fp->field_num].id, COMMON_FIELD_HELP_ALT_ID)))
+ return 1;
+ }
+
+ return 0;
+}
+
struct dm_report *dm_report_init(uint32_t *report_types,
const struct dm_report_object_type *types,
const struct dm_report_field_type *fields,
@@ -1098,6 +1118,12 @@ struct dm_report *dm_report_init(uint32_t *report_types,
*/
_dm_report_init_update_types(rh, report_types);
+ if (_help_requested(rh)) {
+ _display_fields(rh, 1, 0);
+ log_warn(" ");
+ rh->flags |= RH_ALREADY_REPORTED;
+ }
+
return rh;
}
@@ -1406,6 +1432,9 @@ int dm_report_object(struct dm_report *rh, void *object)
goto out;
}
+ if (rh->flags & RH_ALREADY_REPORTED)
+ return 1;
+
if (!(row = dm_pool_zalloc(rh->mem, sizeof(*row)))) {
log_error("dm_report_object: struct row allocation failed");
goto out;
@@ -2615,8 +2644,7 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
struct selection_node *root = NULL;
const char *fin, *next;
- _implicit_report_types = _implicit_common_report_types;
- _implicit_report_fields = _implicit_common_report_fields;
+ _implicit_report_fields = _implicit_common_report_fields_with_selection;
if (!(rh = dm_report_init(report_types, types, fields, output_fields,
output_separator, output_flags, sort_keys, private_data)))
@@ -2640,8 +2668,8 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
_display_fields(rh, 0, 1);
log_warn(" ");
_display_selection_help(rh);
- dm_report_free(rh);
- return NULL;
+ rh->flags |= RH_ALREADY_REPORTED;
+ return rh;
}
if (!(root = _alloc_selection_node(rh->mem, SEL_OR)))
diff --git a/tools/reporter.c b/tools/reporter.c
index 1e91f8f..b08d97b 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -354,17 +354,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
if (!(report_handle = report_init(cmd, options, keys, &report_type,
separator, aligned, buffered,
headings, field_prefixes, quoted,
- columns_as_rows, selection))) {
- if ( (!strcasecmp(options, DM_REPORT_FIELD_RESERVED_NAME_HELP) ||
- !strcmp(options, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT)) ||
- (!strcasecmp(keys, DM_REPORT_FIELD_RESERVED_NAME_HELP) ||
- !strcmp(keys, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT)) ||
- (selection &&
- (!strcasecmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP) ||
- !strcmp(selection, DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT))) )
- return r;
+ columns_as_rows, selection)))
return_ECMD_FAILED;
- }
/* Ensure options selected are compatible */
if (report_type & SEGS)
9 years, 10 months
master - select: add list of allowed types for each selection operator mentioned in help
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=012dab7aa33732...
Commit: 012dab7aa3373201e59a77fa1e11823bd95c771c
Parent: b33091cb115ccc11741344716756e522ebad8e48
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jun 19 15:19:54 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jun 19 15:19:54 2014 +0200
select: add list of allowed types for each selection operator mentioned in help
---
libdm/libdm-report.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 867bf44..00b99c8 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -103,14 +103,14 @@ struct op_def {
* (e.g. =~ comes before =)
*/
static struct op_def _op_cmp[] = {
- { "=~", FLD_CMP_REGEX, "Matching regular expression." },
- { "!~", FLD_CMP_REGEX|FLD_CMP_NOT, "Not matching regular expression." },
- { "=", FLD_CMP_EQUAL, "Equal to." },
- { "!=", FLD_CMP_NOT|FLD_CMP_EQUAL, "Not equal to." },
- { ">=", FLD_CMP_NUMBER|FLD_CMP_GT|FLD_CMP_EQUAL, "Greater than or equal to." },
- { ">", FLD_CMP_NUMBER|FLD_CMP_GT, "Greater than" },
- { "<=", FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL, "Less than or equal to." },
- { "<", FLD_CMP_NUMBER|FLD_CMP_LT, "Less than." },
+ { "=~", FLD_CMP_REGEX, "Matching regular expression. [regex]" },
+ { "!~", FLD_CMP_REGEX|FLD_CMP_NOT, "Not matching regular expression. [regex]" },
+ { "=", FLD_CMP_EQUAL, "Equal to. [number, size, percent, string, string list]" },
+ { "!=", FLD_CMP_NOT|FLD_CMP_EQUAL, "Not equal to. [number, size, percent, string, string_list]" },
+ { ">=", FLD_CMP_NUMBER|FLD_CMP_GT|FLD_CMP_EQUAL, "Greater than or equal to. [number, size, percent]" },
+ { ">", FLD_CMP_NUMBER|FLD_CMP_GT, "Greater than. [number, size, percent]" },
+ { "<=", FLD_CMP_NUMBER|FLD_CMP_LT|FLD_CMP_EQUAL, "Less than or equal to. [number, size, percent]" },
+ { "<", FLD_CMP_NUMBER|FLD_CMP_LT, "Less than. [number, size, percent]" },
{ NULL, 0, NULL }
};
9 years, 10 months
master - pvmove: tidy
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b33091cb115ccc...
Commit: b33091cb115ccc11741344716756e522ebad8e48
Parent: bc0a1ca83d6d89dd86d0d8e43239b97505e82e84
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Jun 19 13:40:47 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Jun 19 13:40:47 2014 +0100
pvmove: tidy
---
WHATS_NEW | 2 +-
lib/metadata/metadata-exported.h | 6 ++----
tools/args.h | 2 +-
tools/commands.h | 4 ++--
tools/pvmove.c | 23 ++++++++++-------------
5 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f7d2b96..44cef74 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -6,7 +6,7 @@ Version 2.02.107 -
Add -S/--select to pvs,vgs,lvs and {pv,vg,lv}display -C for report selection.
Use dm_report_init_with_selection now, implicit "selected" field appears.
Make use of libdm's DM_REPORT_FIELD_TYPE{SIZE,PERCENT,STRING_LIST} for fields.
- Add support for all-or-nothing (atomic) pvmove.
+ Support all-or-nothing pvmove --atomic.
Automatically add snapshot metadata size for -l %ORIGIN calculation.
When converting RAID origin to cache LV, properly rename sub-LVs.
Use RemoveOnStop for lvm2-lvmetad.socket systemd unit.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 90fd6d8..a7d30b3 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -133,10 +133,8 @@
/* Mirror conversion type flags */
#define MIRROR_BY_SEG 0x00000001U /* segment-by-segment mirror */
#define MIRROR_BY_LV 0x00000002U /* mirror using whole mimage LVs */
-#define MIRROR_BY_SEGMENTED_LV 0x00000004U /* mirror using whole mimage
- * LVs, but preserve the
- * segment layout templated by
- * the primary mimage */
+#define MIRROR_BY_SEGMENTED_LV 0x00000004U /* mirror using whole mimage LVs that
+ * preserve the segment structure */
#define MIRROR_SKIP_INIT_SYNC 0x00000010U /* skip initial sync */
/* vg_read and vg_read_for_update flags */
diff --git a/tools/args.h b/tools/args.h
index 8dc8b5f..54e225f 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -17,7 +17,6 @@
* Put all long args that don't have a corresponding short option first.
*/
/* *INDENT-OFF* */
-arg(atomic_ARG, '\0', "atomic", NULL, 0)
arg(version_ARG, '\0', "version", NULL, 0)
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0)
@@ -108,6 +107,7 @@ arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0)
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0)
arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0)
arg(readonly_ARG, '\0', "readonly", NULL, 0)
+arg(atomic_ARG, '\0', "atomic", NULL, 0)
/* Allow some variations */
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
diff --git a/tools/commands.h b/tools/commands.h
index 0644c54..1484aef 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -764,9 +764,9 @@ xx(pvmove,
0,
"pvmove " "\n"
"\t[--abort]\n"
+ "\t[--alloc AllocationPolicy]\n"
"\t[--atomic]\n"
"\t[-A|--autobackup {y|n}]\n"
- "\t[--alloc AllocationPolicy]\n"
"\t[-b|--background]\n"
"\t[--commandprofile ProfileName]\n"
"\t[-d|--debug]\n "
@@ -781,7 +781,7 @@ xx(pvmove,
"\tSourcePhysicalVolume[:PhysicalExtent[-PhysicalExtent]...]}\n"
"\t[DestinationPhysicalVolume[:PhysicalExtent[-PhysicalExtent]...]...]\n",
- abort_ARG, atomic_ARG, alloc_ARG, autobackup_ARG, background_ARG,
+ abort_ARG, alloc_ARG, atomic_ARG, autobackup_ARG, background_ARG,
interval_ARG, name_ARG, noudevsync_ARG, test_ARG)
xx(pvremove,
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 24410d1..c4c590b 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -520,30 +520,28 @@ static int _activate_lv(struct cmd_context *cmd, struct logical_volume *lv_mirr,
static int _is_pvmove_image_removable(struct logical_volume *mimage_lv,
void *baton)
{
- uint32_t s = *((uint32_t *)baton);
+ uint32_t mimage_to_remove = *((uint32_t *)baton);
struct lv_segment *mirror_seg;
if (!(mirror_seg = get_only_segment_using_this_lv(mimage_lv))) {
- log_error(INTERNAL_ERROR
- "%s is not a proper mirror image",
+ log_error(INTERNAL_ERROR "%s is not a proper mirror image",
mimage_lv->name);
return 0;
}
if (seg_type(mirror_seg, 0) != AREA_LV) {
- log_error(INTERNAL_ERROR
- "%s is not a pvmove mirror of LV-type",
+ log_error(INTERNAL_ERROR "%s is not a pvmove mirror of LV-type",
mirror_seg->lv->name);
return 0;
}
- if (s > mirror_seg->area_count) {
- log_error(INTERNAL_ERROR
- "Invalid segment number");
+ if (mimage_to_remove > mirror_seg->area_count) {
+ log_error(INTERNAL_ERROR "Mirror image %" PRIu32 " not found in segment",
+ mimage_to_remove);
return 0;
}
- if (seg_lv(mirror_seg, s) == mimage_lv)
+ if (seg_lv(mirror_seg, mimage_to_remove) == mimage_lv)
return 1;
return 0;
@@ -552,7 +550,7 @@ static int _is_pvmove_image_removable(struct logical_volume *mimage_lv,
static int _detach_pvmove_mirror(struct cmd_context *cmd,
struct logical_volume *lv_mirr)
{
- uint32_t s = 0;
+ uint32_t mimage_to_remove = 0;
struct dm_list lvs_completed;
struct lv_list *lvl;
@@ -561,10 +559,9 @@ static int _detach_pvmove_mirror(struct cmd_context *cmd,
if (arg_is_set(cmd, abort_ARG) &&
(seg_type(first_seg(lv_mirr), 0) == AREA_LV))
- s = 1; /* remove the second mirror leg */
+ mimage_to_remove = 1; /* remove the second mirror leg */
- if (!lv_remove_mirrors(cmd, lv_mirr, 1, 0,
- _is_pvmove_image_removable, &s, PVMOVE) ||
+ if (!lv_remove_mirrors(cmd, lv_mirr, 1, 0, _is_pvmove_image_removable, &mimage_to_remove, PVMOVE) ||
!remove_layers_for_segments_all(cmd, lv_mirr, PVMOVE,
&lvs_completed)) {
return 0;
9 years, 10 months
master - tests: remove dmeventd usage
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc0a1ca83d6d89...
Commit: bc0a1ca83d6d89dd86d0d8e43239b97505e82e84
Parent: b193a3b09ffd28b7a170acc74095a05fa8fe2f8e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 19 12:48:21 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Jun 19 12:48:21 2014 +0200
tests: remove dmeventd usage
This test is testing --use-policies on cmdline.
So monitoring must not be used.
---
test/shell/lvextend-snapshot-policy.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/lvextend-snapshot-policy.sh b/test/shell/lvextend-snapshot-policy.sh
index 210e2fb..b0a611e 100644
--- a/test/shell/lvextend-snapshot-policy.sh
+++ b/test/shell/lvextend-snapshot-policy.sh
@@ -27,7 +27,7 @@ percent() {
get lv_field $vg/snap snap_percent | cut -d. -f1
}
-aux prepare_dmeventd
+# no dmeventd running in this test, testing --use-policies
aux prepare_vg 2
lvcreate -aey -L24 -n base $vg
9 years, 10 months