master - dmsetup: Detect invalid sector supplied to message.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=68f841fcda29ee...
Commit: 68f841fcda29ee0af177b0299b52842afcf1bae2
Parent: 6e912d949b5f68dbf522c4ddb48b93461bdacfdd
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 18 01:24:19 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 18 01:24:19 2013 +0100
dmsetup: Detect invalid sector supplied to message.
atoll doesn't check for errors, so invalid sector numbers were silently
accepted in the "dmsetup message" command.
(Mikulas)
---
WHATS_NEW_DM | 1 +
tools/dmsetup.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 252f105..51c771c 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.80 -
==================================
+ Detect invalid sector supplied to 'dmsetup message'.
Free any previously-set string if a dm_task_set_* function is called again.
Do not allow passing empty new name for dmsetup rename.
Display any output returned by 'dmsetup message'.
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 01f49c3..517e8aa 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -771,6 +771,8 @@ static int _message(CMD_ARGS)
struct dm_task *dmt;
char *str;
const char *response;
+ uint64_t sector;
+ char *endptr;
if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
return 0;
@@ -785,7 +787,12 @@ static int _message(CMD_ARGS)
argv++;
}
- if (!dm_task_set_sector(dmt, (uint64_t) atoll(argv[1])))
+ sector = strtoull(argv[1], &endptr, 10);
+ if (*endptr || endptr == argv[1]) {
+ err("invalid sector");
+ goto out;
+ }
+ if (!dm_task_set_sector(dmt, sector))
goto out;
argc -= 2;
10 years, 7 months
master - tools: Avoid overflow in _get_int_arg.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e912d949b5f68...
Commit: 6e912d949b5f68dbf522c4ddb48b93461bdacfdd
Parent: a0ca2c11ee69b51a99644955cb4daa8ca50c8034
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 18 01:16:48 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 18 01:16:48 2013 +0100
tools: Avoid overflow in _get_int_arg.
Use strtoull instead of strtol so that argument size is not cut
to 31 bytes on machines with 32-bit long.
(Mikulas)
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index df893ae..0b53a9e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Use strtoull instead of strtol in _get_int_arg.
Add devtypes report command to display built-in recognised block device types.
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
Recognise bcache block devices in filter (experimental).
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 116e963..e004f61 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -241,7 +241,7 @@ int metadatatype_arg(struct cmd_context *cmd, struct arg_values *av)
static int _get_int_arg(struct arg_values *av, char **ptr)
{
char *val;
- long v;
+ unsigned long long v;
av->percent = PERCENT_NONE;
@@ -262,9 +262,10 @@ static int _get_int_arg(struct arg_values *av, char **ptr)
if (!isdigit(*val))
return 0;
- v = strtol(val, ptr, 10);
+ errno = 0;
+ v = strtoull(val, ptr, 10);
- if (*ptr == val)
+ if (*ptr == val || errno)
return 0;
av->i_value = (int32_t) v;
10 years, 7 months
master - libdm: avoid leak if dm_task_set_* fn called again
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a0ca2c11ee69b5...
Commit: a0ca2c11ee69b51a99644955cb4daa8ca50c8034
Parent: a3a5f58c21edba308dd8ced15860e52b5b902890
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 18 01:13:06 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 18 01:13:06 2013 +0100
libdm: avoid leak if dm_task_set_* fn called again
(Mikulas)
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 3 +++
libdm/libdm-common.c | 1 +
3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f5d7dc2..252f105 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.80 -
==================================
+ Free any previously-set string if a dm_task_set_* function is called again.
Do not allow passing empty new name for dmsetup rename.
Display any output returned by 'dmsetup message'.
Add dm_task_get_message_response to libdevmapper.
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index b0a2228..c530bb7 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -785,6 +785,7 @@ int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid)
newuuid = mangled_uuid;
}
+ dm_free(dmt->newname);
if (!(dmt->newname = dm_strdup(newuuid))) {
log_error("dm_task_set_newuuid: strdup(%s) failed", newuuid);
return 0;
@@ -796,6 +797,7 @@ int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid)
int dm_task_set_message(struct dm_task *dmt, const char *message)
{
+ dm_free(dmt->message);
if (!(dmt->message = dm_strdup(message))) {
log_error("dm_task_set_message: strdup failed");
return 0;
@@ -814,6 +816,7 @@ int dm_task_set_sector(struct dm_task *dmt, uint64_t sector)
int dm_task_set_geometry(struct dm_task *dmt, const char *cylinders, const char *heads,
const char *sectors, const char *start)
{
+ dm_free(dmt->geometry);
if (dm_asprintf(&(dmt->geometry), "%s %s %s %s",
cylinders, heads, sectors, start) < 0) {
log_error("dm_task_set_geometry: sprintf failed");
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index c0669cb..b66911c 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -720,6 +720,7 @@ int dm_task_set_newname(struct dm_task *dmt, const char *newname)
newname = mangled_name;
}
+ dm_free(dmt->newname);
if (!(dmt->newname = dm_strdup(newname))) {
log_error("dm_task_set_newname: strdup(%s) failed", newname);
return 0;
10 years, 7 months
master - reporting: Add devtypes command.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a3a5f58c21edba...
Commit: a3a5f58c21edba308dd8ced15860e52b5b902890
Parent: d1bcb21e02a33a03795c2e35bd4d16ea67107c5d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Sep 18 01:09:15 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Sep 18 01:09:15 2013 +0100
reporting: Add devtypes command.
Add internal devtypes reporting command to display built-in recognised
block device types. (The output does not include any additional
types added by a configuration file.)
> lvm devtypes -o help
Device Types Fields
-------------------
devtype_all - All fields in this section.
devtype_name - Name of Device Type exactly as it appears in /proc/devices.
devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.)
devtype_description - Description of Device Type.
> lvm devtypes
DevType MaxParts Description
aoe 16 ATA over Ethernet
ataraid 16 ATA Raid
bcache 1 bcache block device cache
blkext 1 Extended device partitions
...
---
WHATS_NEW | 1 +
include/.symlinks.in | 1 +
lib/config/config_settings.h | 3 ++
lib/config/defaults.h | 3 ++
lib/report/columns-devtypes.h | 32 ++++++++++++++++++++++++
lib/report/properties.c | 1 -
lib/report/report.c | 54 ++++++++++++++++++++++++++++++++++++++++-
lib/report/report.h | 14 ++++++----
man/lvm.8.in | 2 +
tools/commands.h | 24 ++++++++++++++++++
tools/reporter.c | 26 +++++++++++++++++++
11 files changed, 153 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 29fb822..df893ae 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Add devtypes report command to display built-in recognised block device types.
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
Recognise bcache block devices in filter (experimental).
Run lvm2-activation-net after lvm2-activation service to prevent parallel run.
diff --git a/include/.symlinks.in b/include/.symlinks.in
index 6de35b8..44076c8 100644
--- a/include/.symlinks.in
+++ b/include/.symlinks.in
@@ -16,6 +16,7 @@
@top_srcdir(a)/lib/device/dev-cache.h
@top_srcdir(a)/lib/device/dev-type.h
@top_srcdir(a)/lib/device/device.h
+@top_srcdir(a)/lib/device/device-types.h
@top_srcdir(a)/lib/display/display.h
@top_srcdir(a)/lib/filters/filter.h
@top_srcdir(a)/lib/format1/format1.h
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 3992764..3549b6d 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -209,6 +209,9 @@ cfg(report_separator_CFG, "separator", report_CFG_SECTION, 0, CFG_TYPE_STRING, D
cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
+cfg(report_devtypes_sort_CFG, "devtypes_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_SORT, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_CFG, "devtypes_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_verbose_CFG, "devtypes_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS_VERB, vsn(2, 2, 101), NULL)
cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 5a456cf..d200331 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -165,18 +165,21 @@
#define DEFAULT_PVS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
#define DEFAULT_SEGS_COLS "lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
#define DEFAULT_PVSEGS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
+#define DEFAULT_DEVTYPES_COLS "devtype_name,devtype_max_partitions,devtype_description"
#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
#define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
#define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
#define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
+#define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description"
#define DEFAULT_LVS_SORT "vg_name,lv_name"
#define DEFAULT_VGS_SORT "vg_name"
#define DEFAULT_PVS_SORT "pv_name"
#define DEFAULT_SEGS_SORT "vg_name,lv_name,seg_start"
#define DEFAULT_PVSEGS_SORT "pv_name,pvseg_start"
+#define DEFAULT_DEVTYPES_SORT "devtype_name"
#define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
diff --git a/lib/report/columns-devtypes.h b/lib/report/columns-devtypes.h
new file mode 100644
index 0000000..5f61890
--- /dev/null
+++ b/lib/report/columns-devtypes.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * 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 Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+/*
+ * This file defines the fields (columns) for the devtypes reporting command.
+ *
+ * The preferred order of the field descriptions in the help text
+ * determines the order the entries appear in this file.
+ *
+ * When adding new entries take care to use the existing style.
+ * Displayed fields names normally have a type prefix and use underscores.
+ * Field-specific internal functions names normally match the displayed
+ * field names but without underscores.
+ * Help text ends with a full stop.
+ */
+
+/* *INDENT-OFF* */
+FIELD(DEVTYPES, devtype, STR, "DevType", name, 7, chars, devtype_name, "Name of Device Type exactly as it appears in /proc/devices.", 0)
+FIELD(DEVTYPES, devtype, NUM, "MaxParts", max_partitions, 8, int8, devtype_max_partitions, "Maximum number of partitions. (How many device minor numbers get reserved for each device.)", 0)
+FIELD(DEVTYPES, devtype, STR, "Description", desc, 11, string, devtype_description, "Description of Device Type.", 0)
+/* *INDENT-ON* */
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 3eeb78a..62a1a35 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -331,7 +331,6 @@ GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe)
GET_PVSEG_NUM_PROPERTY_FN(pvseg_size, (SECTOR_SIZE * pvseg->len))
#define _pvseg_size_set prop_not_implemented_set
-
struct lvm_property_type _properties[] = {
#include "columns.h"
{ 0, "", 0, 0, 0, { .integer = 0 }, prop_not_implemented_get, prop_not_implemented_set },
diff --git a/lib/report/report.c b/lib/report/report.c
index 77332a2..347b830 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -22,6 +22,7 @@
#include "activate.h"
#include "segtype.h"
#include "lvmcache.h"
+#include "device-types.h"
#include <stddef.h> /* offsetof() */
@@ -47,6 +48,13 @@ static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
return dm_report_field_string(rh, field, (const char * const *) data);
}
+static int _chars_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ return dm_report_field_string(rh, field, (const char * const *) &data);
+}
+
static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
@@ -456,6 +464,15 @@ static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
return dm_report_field_uint32(rh, field, data);
}
+static int _int8_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ const int32_t val = *(const int8_t *)data;
+
+ return dm_report_field_int32(rh, field, &val);
+}
+
static int _int32_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
@@ -1270,6 +1287,11 @@ static void *_obj_get_pvseg(void *obj)
return ((struct lvm_report_object *)obj)->pvseg;
}
+static void *_obj_get_devtypes(void *obj)
+{
+ return obj;
+}
+
static const struct dm_report_object_type _report_types[] = {
{ VGS, "Volume Group", "vg_", _obj_get_vg },
{ LVS, "Logical Volume", "lv_", _obj_get_lv },
@@ -1280,6 +1302,11 @@ static const struct dm_report_object_type _report_types[] = {
{ 0, "", "", NULL },
};
+static const struct dm_report_object_type _devtypes_report_types[] = {
+ { DEVTYPES, "Device Types", "devtype_", _obj_get_devtypes },
+ { 0, "", "", NULL },
+};
+
/*
* Import column definitions
*/
@@ -1296,11 +1323,18 @@ typedef struct volume_group type_vg;
typedef struct lv_segment type_seg;
typedef struct pv_segment type_pvseg;
+typedef dev_known_type_t type_devtype;
+
static const struct dm_report_field_type _fields[] = {
#include "columns.h"
{0, 0, 0, 0, "", "", NULL, NULL},
};
+static const struct dm_report_field_type _devtypes_fields[] = {
+#include "columns-devtypes.h"
+{0, 0, 0, 0, "", "", NULL, NULL},
+};
+
#undef STR
#undef NUM
#undef FIELD
@@ -1311,6 +1345,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
int quoted, int columns_as_rows)
{
uint32_t report_flags = 0;
+ int devtypes_report = *report_type & DEVTYPES ? 1 : 0;
void *rh;
if (aligned)
@@ -1331,7 +1366,8 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
if (columns_as_rows)
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
- rh = dm_report_init(report_type, _report_types, _fields, format,
+ rh = dm_report_init(report_type, devtypes_report ? _devtypes_report_types : _report_types,
+ devtypes_report ? _devtypes_fields : _fields, format,
separator, report_flags, keys, cmd);
if (rh && field_prefixes)
@@ -1361,3 +1397,19 @@ int report_object(void *handle, struct volume_group *vg,
return dm_report_object(handle, &obj);
}
+
+static int _report_devtype_single(void *handle, const dev_known_type_t *devtype)
+{
+ return dm_report_object(handle, (void *)devtype);
+}
+
+int report_devtypes(void *handle)
+{
+ int devtypeind = 0;
+
+ while (_dev_known_types[devtypeind].name[0])
+ if (!_report_devtype_single(handle, &_dev_known_types[devtypeind++]))
+ return 0;
+
+ return 1;
+}
diff --git a/lib/report/report.h b/lib/report/report.h
index 26cc2f7..bda8553 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -19,12 +19,13 @@
#include "metadata-exported.h"
typedef enum {
- LVS = 1,
- PVS = 2,
- VGS = 4,
- SEGS = 8,
- PVSEGS = 16,
- LABEL = 32
+ LVS = 1,
+ PVS = 2,
+ VGS = 4,
+ SEGS = 8,
+ PVSEGS = 16,
+ LABEL = 32,
+ DEVTYPES = 64
} report_type_t;
struct field;
@@ -41,6 +42,7 @@ void report_free(void *handle);
int report_object(void *handle, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv,
struct lv_segment *seg, struct pv_segment *pvseg);
+int report_devtypes(void *handle);
int report_output(void *handle);
#endif
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 61fd74a..da471ab 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -46,6 +46,8 @@ being created in the filesystem for them.
\fBdumpconfig\fP \(em Display the configuration information after
loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
+\fBdevtypes\fP \(dm Display the recognised built-in block device types.
+.TP
\fBformats\fP \(em Display recognised metadata formats.
.TP
\fBhelp\fP \(em Display the help text.
diff --git a/tools/commands.h b/tools/commands.h
index a8623bf..a0cd5d7 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -28,6 +28,30 @@ xx(e2fsadm,
extents_ARG, size_ARG, nofsck_ARG, test_ARG)
*********/
+xx(devtypes,
+ "Display recognised built-in block device types",
+ PERMITTED_READ_ONLY,
+ "devtypes" "\n"
+ "\t[--aligned]\n"
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+]Field[,Field]]\n"
+ "\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+ "\t[--rows]\n"
+ "\t[--separator Separator]\n"
+ "\t[--unbuffered]\n"
+ "\t[--unquoted]\n"
+ "\t[-v|--verbose]\n"
+ "\t[--version]" "\n",
+
+ aligned_ARG, nameprefixes_ARG,
+ noheadings_ARG, nosuffix_ARG, options_ARG,
+ rows_ARG, separator_ARG, sort_ARG,
+ unbuffered_ARG, unquoted_ARG)
+
xx(dumpconfig,
"Dump configuration",
PERMITTED_READ_ONLY,
diff --git a/tools/reporter.c b/tools/reporter.c
index a6941e3..44a9aa8 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -16,6 +16,17 @@
#include "tools.h"
#include "report.h"
+static int _process_each_devtype(struct cmd_context *cmd, int argc, void *handle)
+{
+ if (argc)
+ log_warn("WARNING: devtypes currently ignores command line arguments.");
+
+ if (!report_devtypes(handle))
+ return_ECMD_FAILED;
+
+ return ECMD_PROCESSED;
+}
+
static int _vgs_single(struct cmd_context *cmd __attribute__((unused)),
const char *vg_name, struct volume_group *vg,
void *handle)
@@ -235,6 +246,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type == PVSEGS) ? 1 : 0;
switch (report_type) {
+ case DEVTYPES:
+ keys = find_config_tree_str(cmd, report_devtypes_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ options = find_config_tree_str(cmd, report_devtypes_cols_CFG, NULL);
+ else
+ options = find_config_tree_str(cmd, report_devtypes_cols_verbose_CFG, NULL);
+ break;
case LVS:
keys = find_config_tree_str(cmd, report_lvs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
@@ -350,6 +368,9 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type = LVS;
switch (report_type) {
+ case DEVTYPES:
+ r = _process_each_devtype(cmd, argc, report_handle);
+ break;
case LVS:
r = process_each_lv(cmd, argc, argv, 0, report_handle,
&_lvs_single);
@@ -418,3 +439,8 @@ int pvs(struct cmd_context *cmd, int argc, char **argv)
return _report(cmd, argc, argv, type);
}
+
+int devtypes(struct cmd_context *cmd, int argc, char **argv)
+{
+ return _report(cmd, argc, argv, DEVTYPES);
+}
10 years, 7 months
master - reporting: Add devtypes command.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aa98f4b97e4d8e...
Commit: aa98f4b97e4d8e5e41b77d43c9f594a0cc2e1d4e
Parent: d1bcb21e02a33a03795c2e35bd4d16ea67107c5d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Sep 17 23:55:44 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Sep 17 23:55:44 2013 +0100
reporting: Add devtypes command.
Add internal devtypes reporting command to display built-in recognised
block device types. (The output does not include any additional
types added by a configuration file.)
Device Types Fields
-------------------
devtype_all - All fields in this section.
devtype_name - Name of Device Type exactly as it appears in /proc/devices.
devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.)
devtype_description - Description of Device Type.
DevType MaxParts Description
aoe 16 ATA over Ethernet
ataraid 16 ATA Raid
bcache 1 bcache block device cache
blkext 1 Extended device partitions
...
---
WHATS_NEW | 1 +
include/.symlinks.in | 1 +
lib/config/config_settings.h | 3 ++
lib/config/defaults.h | 3 ++
lib/report/properties.c | 1 -
lib/report/report.c | 54 +++++++++++++++++++++++++++++++++++++++++-
lib/report/report.h | 14 ++++++----
man/lvm.8.in | 2 +
tools/commands.h | 24 ++++++++++++++++++
tools/reporter.c | 26 ++++++++++++++++++++
10 files changed, 121 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 29fb822..df893ae 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Add devtypes report command to display built-in recognised block device types.
Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
Recognise bcache block devices in filter (experimental).
Run lvm2-activation-net after lvm2-activation service to prevent parallel run.
diff --git a/include/.symlinks.in b/include/.symlinks.in
index 6de35b8..44076c8 100644
--- a/include/.symlinks.in
+++ b/include/.symlinks.in
@@ -16,6 +16,7 @@
@top_srcdir(a)/lib/device/dev-cache.h
@top_srcdir(a)/lib/device/dev-type.h
@top_srcdir(a)/lib/device/device.h
+@top_srcdir(a)/lib/device/device-types.h
@top_srcdir(a)/lib/display/display.h
@top_srcdir(a)/lib/filters/filter.h
@top_srcdir(a)/lib/format1/format1.h
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 3992764..3549b6d 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -209,6 +209,9 @@ cfg(report_separator_CFG, "separator", report_CFG_SECTION, 0, CFG_TYPE_STRING, D
cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
+cfg(report_devtypes_sort_CFG, "devtypes_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_SORT, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_CFG, "devtypes_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_verbose_CFG, "devtypes_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS_VERB, vsn(2, 2, 101), NULL)
cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 5a456cf..d200331 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -165,18 +165,21 @@
#define DEFAULT_PVS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
#define DEFAULT_SEGS_COLS "lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
#define DEFAULT_PVSEGS_COLS "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
+#define DEFAULT_DEVTYPES_COLS "devtype_name,devtype_max_partitions,devtype_description"
#define DEFAULT_LVS_COLS_VERB "lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
#define DEFAULT_VGS_COLS_VERB "vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
#define DEFAULT_PVS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
#define DEFAULT_SEGS_COLS_VERB "lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
#define DEFAULT_PVSEGS_COLS_VERB "pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
+#define DEFAULT_DEVTYPES_COLS_VERB "devtype_name,devtype_max_partitions,devtype_description"
#define DEFAULT_LVS_SORT "vg_name,lv_name"
#define DEFAULT_VGS_SORT "vg_name"
#define DEFAULT_PVS_SORT "pv_name"
#define DEFAULT_SEGS_SORT "vg_name,lv_name,seg_start"
#define DEFAULT_PVSEGS_SORT "pv_name,pvseg_start"
+#define DEFAULT_DEVTYPES_SORT "devtype_name"
#define DEFAULT_MIRROR_DEVICE_FAULT_POLICY "remove"
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 3eeb78a..62a1a35 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -331,7 +331,6 @@ GET_PVSEG_NUM_PROPERTY_FN(pvseg_start, pvseg->pe)
GET_PVSEG_NUM_PROPERTY_FN(pvseg_size, (SECTOR_SIZE * pvseg->len))
#define _pvseg_size_set prop_not_implemented_set
-
struct lvm_property_type _properties[] = {
#include "columns.h"
{ 0, "", 0, 0, 0, { .integer = 0 }, prop_not_implemented_get, prop_not_implemented_set },
diff --git a/lib/report/report.c b/lib/report/report.c
index 77332a2..347b830 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -22,6 +22,7 @@
#include "activate.h"
#include "segtype.h"
#include "lvmcache.h"
+#include "device-types.h"
#include <stddef.h> /* offsetof() */
@@ -47,6 +48,13 @@ static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
return dm_report_field_string(rh, field, (const char * const *) data);
}
+static int _chars_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ return dm_report_field_string(rh, field, (const char * const *) &data);
+}
+
static int _dev_name_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
@@ -456,6 +464,15 @@ static int _uint32_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
return dm_report_field_uint32(rh, field, data);
}
+static int _int8_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
+ struct dm_report_field *field,
+ const void *data, void *private __attribute__((unused)))
+{
+ const int32_t val = *(const int8_t *)data;
+
+ return dm_report_field_int32(rh, field, &val);
+}
+
static int _int32_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
@@ -1270,6 +1287,11 @@ static void *_obj_get_pvseg(void *obj)
return ((struct lvm_report_object *)obj)->pvseg;
}
+static void *_obj_get_devtypes(void *obj)
+{
+ return obj;
+}
+
static const struct dm_report_object_type _report_types[] = {
{ VGS, "Volume Group", "vg_", _obj_get_vg },
{ LVS, "Logical Volume", "lv_", _obj_get_lv },
@@ -1280,6 +1302,11 @@ static const struct dm_report_object_type _report_types[] = {
{ 0, "", "", NULL },
};
+static const struct dm_report_object_type _devtypes_report_types[] = {
+ { DEVTYPES, "Device Types", "devtype_", _obj_get_devtypes },
+ { 0, "", "", NULL },
+};
+
/*
* Import column definitions
*/
@@ -1296,11 +1323,18 @@ typedef struct volume_group type_vg;
typedef struct lv_segment type_seg;
typedef struct pv_segment type_pvseg;
+typedef dev_known_type_t type_devtype;
+
static const struct dm_report_field_type _fields[] = {
#include "columns.h"
{0, 0, 0, 0, "", "", NULL, NULL},
};
+static const struct dm_report_field_type _devtypes_fields[] = {
+#include "columns-devtypes.h"
+{0, 0, 0, 0, "", "", NULL, NULL},
+};
+
#undef STR
#undef NUM
#undef FIELD
@@ -1311,6 +1345,7 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
int quoted, int columns_as_rows)
{
uint32_t report_flags = 0;
+ int devtypes_report = *report_type & DEVTYPES ? 1 : 0;
void *rh;
if (aligned)
@@ -1331,7 +1366,8 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
if (columns_as_rows)
report_flags |= DM_REPORT_OUTPUT_COLUMNS_AS_ROWS;
- rh = dm_report_init(report_type, _report_types, _fields, format,
+ rh = dm_report_init(report_type, devtypes_report ? _devtypes_report_types : _report_types,
+ devtypes_report ? _devtypes_fields : _fields, format,
separator, report_flags, keys, cmd);
if (rh && field_prefixes)
@@ -1361,3 +1397,19 @@ int report_object(void *handle, struct volume_group *vg,
return dm_report_object(handle, &obj);
}
+
+static int _report_devtype_single(void *handle, const dev_known_type_t *devtype)
+{
+ return dm_report_object(handle, (void *)devtype);
+}
+
+int report_devtypes(void *handle)
+{
+ int devtypeind = 0;
+
+ while (_dev_known_types[devtypeind].name[0])
+ if (!_report_devtype_single(handle, &_dev_known_types[devtypeind++]))
+ return 0;
+
+ return 1;
+}
diff --git a/lib/report/report.h b/lib/report/report.h
index 26cc2f7..bda8553 100644
--- a/lib/report/report.h
+++ b/lib/report/report.h
@@ -19,12 +19,13 @@
#include "metadata-exported.h"
typedef enum {
- LVS = 1,
- PVS = 2,
- VGS = 4,
- SEGS = 8,
- PVSEGS = 16,
- LABEL = 32
+ LVS = 1,
+ PVS = 2,
+ VGS = 4,
+ SEGS = 8,
+ PVSEGS = 16,
+ LABEL = 32,
+ DEVTYPES = 64
} report_type_t;
struct field;
@@ -41,6 +42,7 @@ void report_free(void *handle);
int report_object(void *handle, struct volume_group *vg,
struct logical_volume *lv, struct physical_volume *pv,
struct lv_segment *seg, struct pv_segment *pvseg);
+int report_devtypes(void *handle);
int report_output(void *handle);
#endif
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 61fd74a..da471ab 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -46,6 +46,8 @@ being created in the filesystem for them.
\fBdumpconfig\fP \(em Display the configuration information after
loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
+\fBdevtypes\fP \(dm Display the recognised built-in block device types.
+.TP
\fBformats\fP \(em Display recognised metadata formats.
.TP
\fBhelp\fP \(em Display the help text.
diff --git a/tools/commands.h b/tools/commands.h
index a8623bf..a0cd5d7 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -28,6 +28,30 @@ xx(e2fsadm,
extents_ARG, size_ARG, nofsck_ARG, test_ARG)
*********/
+xx(devtypes,
+ "Display recognised built-in block device types",
+ PERMITTED_READ_ONLY,
+ "devtypes" "\n"
+ "\t[--aligned]\n"
+ "\t[-d|--debug]\n"
+ "\t[-h|--help]\n"
+ "\t[--nameprefixes]\n"
+ "\t[--noheadings]\n"
+ "\t[--nosuffix]\n"
+ "\t[-o|--options [+]Field[,Field]]\n"
+ "\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
+ "\t[--rows]\n"
+ "\t[--separator Separator]\n"
+ "\t[--unbuffered]\n"
+ "\t[--unquoted]\n"
+ "\t[-v|--verbose]\n"
+ "\t[--version]" "\n",
+
+ aligned_ARG, nameprefixes_ARG,
+ noheadings_ARG, nosuffix_ARG, options_ARG,
+ rows_ARG, separator_ARG, sort_ARG,
+ unbuffered_ARG, unquoted_ARG)
+
xx(dumpconfig,
"Dump configuration",
PERMITTED_READ_ONLY,
diff --git a/tools/reporter.c b/tools/reporter.c
index a6941e3..44a9aa8 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -16,6 +16,17 @@
#include "tools.h"
#include "report.h"
+static int _process_each_devtype(struct cmd_context *cmd, int argc, void *handle)
+{
+ if (argc)
+ log_warn("WARNING: devtypes currently ignores command line arguments.");
+
+ if (!report_devtypes(handle))
+ return_ECMD_FAILED;
+
+ return ECMD_PROCESSED;
+}
+
static int _vgs_single(struct cmd_context *cmd __attribute__((unused)),
const char *vg_name, struct volume_group *vg,
void *handle)
@@ -235,6 +246,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type == PVSEGS) ? 1 : 0;
switch (report_type) {
+ case DEVTYPES:
+ keys = find_config_tree_str(cmd, report_devtypes_sort_CFG, NULL);
+ if (!arg_count(cmd, verbose_ARG))
+ options = find_config_tree_str(cmd, report_devtypes_cols_CFG, NULL);
+ else
+ options = find_config_tree_str(cmd, report_devtypes_cols_verbose_CFG, NULL);
+ break;
case LVS:
keys = find_config_tree_str(cmd, report_lvs_sort_CFG, NULL);
if (!arg_count(cmd, verbose_ARG))
@@ -350,6 +368,9 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
report_type = LVS;
switch (report_type) {
+ case DEVTYPES:
+ r = _process_each_devtype(cmd, argc, report_handle);
+ break;
case LVS:
r = process_each_lv(cmd, argc, argv, 0, report_handle,
&_lvs_single);
@@ -418,3 +439,8 @@ int pvs(struct cmd_context *cmd, int argc, char **argv)
return _report(cmd, argc, argv, type);
}
+
+int devtypes(struct cmd_context *cmd, int argc, char **argv)
+{
+ return _report(cmd, argc, argv, DEVTYPES);
+}
10 years, 7 months
master - WHATS_NEW: Better description for commit 82228ac
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d1bcb21e02a33a...
Commit: d1bcb21e02a33a03795c2e35bd4d16ea67107c5d
Parent: ce9a5cc25712907f05aa780d53d727b16f5dfd7c
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Sep 16 15:37:48 2013 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Sep 16 15:37:48 2013 -0500
WHATS_NEW: Better description for commit 82228ac
More correct description of changes made to disallow thin+mirror.
---
WHATS_NEW | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 45e0050..29fb822 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -6,7 +6,8 @@ Version 2.02.101 -
Add man page entries for lvmdump's -u and -l options.
Fix lvm2app segfault while using lvm_list_pvs_free fn if there are no PVs.
Improve of clvmd singlenode locking simulation.
- Disallow thinpools on mirror logical volumes.
+ lvconvert no longer converts LVs of "mirror" segment type to thinpool.
+ lvconvert no longer converts thinpool sub-LVs to "mirror" segment type.
Direct udev to use 3min timeout for LVM devices. Recent udev has default 30s.
Do not scan multipath or RAID components and avoid incorrect autoactivation.
Fix MD/loop udev handling to fire autoactivation after setup or coldplug only.
10 years, 7 months
master - debug: Use // for commented out debug #defines
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ce9a5cc2571290...
Commit: ce9a5cc25712907f05aa780d53d727b16f5dfd7c
Parent: 36c5bb40a27c7faac2a167df8c5cbd7c98c5168d
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Sep 16 20:20:26 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Sep 16 20:20:26 2013 +0100
debug: Use // for commented out debug #defines
The traditional style used for optional editable definitions
/* #define X /* */
produces a bogus warning from gcc -Wall.
Rather than suppressing this with -Wno-comment, switch over to
the // comment style.
---
tools/toollib.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index bccebb6..83789df 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -66,7 +66,7 @@ int become_daemon(struct cmd_context *cmd, int skip_lvm)
strerror(errno));
/* Set this to avoid discarding output from background process */
-/* #define DEBUG_CHILD */
+// #define DEBUG_CHILD
#ifndef DEBUG_CHILD
if ((null_fd = open(devnull, O_RDWR)) == -1) {
10 years, 7 months
master - Makefiles: Fix CC variable override.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=36c5bb40a27c7f...
Commit: 36c5bb40a27c7faac2a167df8c5cbd7c98c5168d
Parent: 97ba18f4cbedbdf7933d30d719cf997bb06e7214
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Sep 16 19:57:14 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Sep 16 19:57:14 2013 +0100
Makefiles: Fix CC variable override.
The CC override in commit f42b2d4bbf16345e5b5457f4298e751d5c134776
caused the built-in value to be used instead of the configured value
when it wasn't being overridden.
The behaviour is explained here:
http://stackoverflow.com/questions/18007326/how-to-change-default-values-...
---
WHATS_NEW | 1 +
make.tmpl.in | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d51f08c..45e0050 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Fix CC Makefile override which had reverted to using built-in value. (2.02.75)
Recognise bcache block devices in filter (experimental).
Run lvm2-activation-net after lvm2-activation service to prevent parallel run.
Add man page entries for lvmdump's -u and -l options.
diff --git a/make.tmpl.in b/make.tmpl.in
index 6992255..3218758 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -17,7 +17,18 @@ SHELL = /bin/sh
@SET_MAKE@
+# Allow environment to override any built-in default value for CC.
+# If there is a built-in default, CC is NOT set to @CC@ here.
CC ?= @CC@
+
+# If $(CC) holds the usual built-in default value of 'cc' then replace it with
+# the configured value.
+# (To avoid this and force the use of 'cc' from the environment, supply its
+# full path.)
+ifeq ($(CC), cc)
+ CC = @CC@
+endif
+
RANLIB = @RANLIB@
INSTALL = @INSTALL@
MKDIR_P = @MKDIR_P@
10 years, 7 months
master - filters: Add bcache.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=97ba18f4cbedbd...
Commit: 97ba18f4cbedbdf7933d30d719cf997bb06e7214
Parent: 10bc19ec1070d16d7367285856ebba7f99cf1996
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Sep 16 16:56:55 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Sep 16 16:56:55 2013 +0100
filters: Add bcache.
N.B. Using bcache devices as PVs is still experimental.
Problems should be reported to the appropriate mailing lists.
---
WHATS_NEW | 8 +++-----
lib/device/device-types.h | 1 +
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1c4925b..d51f08c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.101 -
===================================
+ Recognise bcache block devices in filter (experimental).
Run lvm2-activation-net after lvm2-activation service to prevent parallel run.
Add man page entries for lvmdump's -u and -l options.
Fix lvm2app segfault while using lvm_list_pvs_free fn if there are no PVs.
@@ -14,19 +15,16 @@ Version 2.02.101 -
Fix dmeventd unmonitoring of thin pools.
Fix lvresize for stacked thin pool volumes (i.e. mirrors).
Write Completed debug message before reinstating log defaults after command.
- Skip pvmove of RAID, thin, snapshot, origin, or mirror LVs in a cluster.
Refresh existing VG before autoactivation (event retrigger/device reappeared).
Use pvscan -b in udev rules to avoid a deadlock on udev process count limit.
Add pvscan -b/--background for the command to be processed in the background.
Don't assume stdin file descriptor is readable.
Avoid unlimited recursion when creating dtree containing inactive pvmove LV.
Require exactly 3 arguments for lvm2-activation-generator. Remove defaults.
- Disable pvmove of merging or converting logical volumes.
- Enable pvmove of snapshots and snapshot origins.
- Fix inability to specify LV name when pvmove'ing a RAID, mirror, or thin-LV.
Inform lvmetad about any lost PV label to make it in sync with system state.
Support most of lvchange operations on stacked thin pool meta/data LVs.
- Add ability to pvmove RAID, mirror, and thin volumes.
+ Enable non-clustered pvmove of snapshots and snapshot origins.
+ Add ability to pvmove non-clustered RAID, mirror, and thin volumes.
Make lvm2-activation-generator silent unless it's in error state.
Remove "mpath major is not dm major" msg for mpath component scan (2.02.94).
Prevent cluster mirror logs from being corrupted by redundant checkpoints.
diff --git a/lib/device/device-types.h b/lib/device/device-types.h
index 48ae32a..d25c2f0 100644
--- a/lib/device/device-types.h
+++ b/lib/device/device-types.h
@@ -60,5 +60,6 @@ static const dev_known_type_t _dev_known_types[] = {
{"vtms", 16, "Violin Memory"},
{"skd", 16, "STEC"},
{"scm", 8, "Storage Class Memory (IBM S/390)"},
+ {"bcache", 1, "bcache block device cache"},
{"", 0, ""}
};
10 years, 7 months
master - doc: add a note about device filtering while lvmetad is used
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10bc19ec1070d1...
Commit: 10bc19ec1070d16d7367285856ebba7f99cf1996
Parent: 61427af377891b011089b14154fe0c1d2845fd21
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Sep 16 16:28:28 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Sep 16 16:29:33 2013 +0200
doc: add a note about device filtering while lvmetad is used
---
conf/example.conf.in | 12 ++++++++++++
man/pvscan.8.in | 3 ++-
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index b99f010..fb96079 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -80,6 +80,8 @@ devices {
# the cache file gets regenerated (see below).
# If it doesn't do what you expect, check the output of 'vgscan -vvvv'.
+ # If lvmetad is used, then see "A note about device filtering while
+ # lvmetad is used" comment that is attached to global/use_lvmetad setting.
# By default we accept every block device:
filter = [ "a/.*/" ]
@@ -559,6 +561,16 @@ global {
# that appear in the system. Once the VG is complete (all the PVs are
# present), it is auto-activated. The activation/auto_activation_volume_list
# setting controls which volumes are auto-activated (all by default).
+ #
+ # A note about device filtering while lvmetad is used:
+ # When lvmetad is updated (either automatically based on udev events
+ # or directly by pvscan --cache <device> call), the devices/filter
+ # is ignored and all devices are scanned by default. The lvmetad always
+ # keeps unfiltered information which is then provided to LVM commands
+ # and then each LVM command does the filtering based on devices/filter
+ # setting itself.
+ # To prevent scanning devices completely, even when using lvmetad,
+ # the devices/global_filter must be used.
use_lvmetad = 0
# Full path of the utility called to check that a thin metadata device
diff --git a/man/pvscan.8.in b/man/pvscan.8.in
index 78ee3e2..211c82b 100644
--- a/man/pvscan.8.in
+++ b/man/pvscan.8.in
@@ -59,7 +59,8 @@ Run the command in the background.
Scan one or more devices and instruct the lvmetad daemon to update its cached
state accordingly. Called internally by udev rules.
All devices listed explicitly are processed \fBregardless\fP of any device
-filters set in lvm.conf.
+filters set using \fBdevices/filter\fP configuration setting. To filter
+devices even in this case, the \fBdevices/global_filter\fP must be used.
.SH SEE ALSO
.BR lvm (8),
.BR pvcreate (8),
10 years, 7 months