mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Add --prefixes to reporting tools for field name prefix output format.
E.g. lvs --prefixes --noheadings --unbuffered --units m --nosuffix (Used '--prefixes' for now, but I'm looking for a better name.)
This commit is contained in:
parent
c791f186ce
commit
f419a87150
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.36 -
|
Version 2.02.36 -
|
||||||
=================================
|
=================================
|
||||||
|
Add --prefixes to reporting tools for field name prefix output format.
|
||||||
Fix lvconvert -m0 allocatable space check.
|
Fix lvconvert -m0 allocatable space check.
|
||||||
|
|
||||||
Version 2.02.35 - 15th April 2008
|
Version 2.02.35 - 15th April 2008
|
||||||
|
@ -102,6 +102,7 @@
|
|||||||
#define DEFAULT_REP_ALIGNED 1
|
#define DEFAULT_REP_ALIGNED 1
|
||||||
#define DEFAULT_REP_BUFFERED 1
|
#define DEFAULT_REP_BUFFERED 1
|
||||||
#define DEFAULT_REP_HEADINGS 1
|
#define DEFAULT_REP_HEADINGS 1
|
||||||
|
#define DEFAULT_REP_PREFIXES 0
|
||||||
#define DEFAULT_REP_SEPARATOR " "
|
#define DEFAULT_REP_SEPARATOR " "
|
||||||
|
|
||||||
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,origin,snap_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
#define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,origin,snap_percent,move_pv,mirror_log,copy_percent,convert_lv"
|
||||||
|
@ -386,7 +386,7 @@ static int _pvstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
|
|||||||
const uint32_t status = *(const uint32_t *) data;
|
const uint32_t status = *(const uint32_t *) data;
|
||||||
char *repstr;
|
char *repstr;
|
||||||
|
|
||||||
if (!(repstr = dm_pool_zalloc(mem, 4))) {
|
if (!(repstr = dm_pool_zalloc(mem, 3))) {
|
||||||
log_error("dm_pool_alloc failed");
|
log_error("dm_pool_alloc failed");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1077,9 +1077,10 @@ static struct dm_report_field_type _fields[] = {
|
|||||||
|
|
||||||
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
||||||
report_type_t *report_type, const char *separator,
|
report_type_t *report_type, const char *separator,
|
||||||
int aligned, int buffered, int headings)
|
int aligned, int buffered, int headings, int field_prefixes)
|
||||||
{
|
{
|
||||||
uint32_t report_flags = 0;
|
uint32_t report_flags = 0;
|
||||||
|
void *rh;
|
||||||
|
|
||||||
if (aligned)
|
if (aligned)
|
||||||
report_flags |= DM_REPORT_OUTPUT_ALIGNED;
|
report_flags |= DM_REPORT_OUTPUT_ALIGNED;
|
||||||
@ -1090,8 +1091,16 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
|||||||
if (headings)
|
if (headings)
|
||||||
report_flags |= DM_REPORT_OUTPUT_HEADINGS;
|
report_flags |= DM_REPORT_OUTPUT_HEADINGS;
|
||||||
|
|
||||||
return dm_report_init(report_type, _report_types, _fields, format,
|
if (field_prefixes)
|
||||||
separator, report_flags, keys, cmd);
|
report_flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
|
||||||
|
|
||||||
|
rh = dm_report_init(report_type, _report_types, _fields, format,
|
||||||
|
separator, report_flags, keys, cmd);
|
||||||
|
|
||||||
|
if (field_prefixes)
|
||||||
|
dm_report_set_output_field_name_prefix(rh, "lvm2_");
|
||||||
|
|
||||||
|
return rh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -28,7 +28,7 @@ typedef int (*field_report_fn) (struct report_handle * dh, struct field * field,
|
|||||||
|
|
||||||
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
|
||||||
report_type_t *report_type, const char *separator,
|
report_type_t *report_type, const char *separator,
|
||||||
int aligned, int buffered, int headings);
|
int aligned, int buffered, int headings, int field_prefixes);
|
||||||
void report_free(void *handle);
|
void report_free(void *handle);
|
||||||
int report_object(void *handle, struct volume_group *vg,
|
int report_object(void *handle, struct volume_group *vg,
|
||||||
struct logical_volume *lv, struct physical_volume *pv,
|
struct logical_volume *lv, struct physical_volume *pv,
|
||||||
|
@ -53,6 +53,7 @@ arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0)
|
|||||||
arg(config_ARG, '\0', "config", string_arg, 0)
|
arg(config_ARG, '\0', "config", string_arg, 0)
|
||||||
arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
|
arg(trustcache_ARG, '\0', "trustcache", NULL, 0)
|
||||||
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
|
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0)
|
||||||
|
arg(prefixes_ARG, '\0', "prefixes", NULL, 0)
|
||||||
|
|
||||||
/* Allow some variations */
|
/* Allow some variations */
|
||||||
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
|
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
|
||||||
|
@ -368,6 +368,7 @@ xx(lvs,
|
|||||||
"\t[-o|--options [+]Field[,Field]]\n"
|
"\t[-o|--options [+]Field[,Field]]\n"
|
||||||
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
||||||
"\t[-P|--partial] " "\n"
|
"\t[-P|--partial] " "\n"
|
||||||
|
"\t[--prefixes]\n"
|
||||||
"\t[--segments]\n"
|
"\t[--segments]\n"
|
||||||
"\t[--separator Separator]\n"
|
"\t[--separator Separator]\n"
|
||||||
"\t[--trustcache]\n"
|
"\t[--trustcache]\n"
|
||||||
@ -378,8 +379,9 @@ xx(lvs,
|
|||||||
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
|
"\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n",
|
||||||
|
|
||||||
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
||||||
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, segments_ARG,
|
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, prefixes_ARG,
|
||||||
separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
|
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
|
||||||
|
units_ARG)
|
||||||
|
|
||||||
xx(lvscan,
|
xx(lvscan,
|
||||||
"List all logical volumes in all volume groups",
|
"List all logical volumes in all volume groups",
|
||||||
@ -575,6 +577,7 @@ xx(pvs,
|
|||||||
"\t[-o|--options [+]Field[,Field]]\n"
|
"\t[-o|--options [+]Field[,Field]]\n"
|
||||||
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
||||||
"\t[-P|--partial] " "\n"
|
"\t[-P|--partial] " "\n"
|
||||||
|
"\t[--prefixes]\n"
|
||||||
"\t[--segments]\n"
|
"\t[--segments]\n"
|
||||||
"\t[--separator Separator]\n"
|
"\t[--separator Separator]\n"
|
||||||
"\t[--trustcache]\n"
|
"\t[--trustcache]\n"
|
||||||
@ -585,8 +588,9 @@ xx(pvs,
|
|||||||
"\t[PhysicalVolume [PhysicalVolume...]]\n",
|
"\t[PhysicalVolume [PhysicalVolume...]]\n",
|
||||||
|
|
||||||
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
||||||
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, segments_ARG,
|
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, prefixes_ARG,
|
||||||
separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
|
segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG,
|
||||||
|
units_ARG)
|
||||||
|
|
||||||
xx(pvscan,
|
xx(pvscan,
|
||||||
"List all physical volumes",
|
"List all physical volumes",
|
||||||
@ -890,6 +894,7 @@ xx(vgs,
|
|||||||
"\t[-o|--options [+]Field[,Field]]\n"
|
"\t[-o|--options [+]Field[,Field]]\n"
|
||||||
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
"\t[-O|--sort [+|-]key1[,[+|-]key2[,...]]]\n"
|
||||||
"\t[-P|--partial] " "\n"
|
"\t[-P|--partial] " "\n"
|
||||||
|
"\t[--prefixes]\n"
|
||||||
"\t[--separator Separator]\n"
|
"\t[--separator Separator]\n"
|
||||||
"\t[--trustcache]\n"
|
"\t[--trustcache]\n"
|
||||||
"\t[--unbuffered]\n"
|
"\t[--unbuffered]\n"
|
||||||
@ -899,8 +904,8 @@ xx(vgs,
|
|||||||
"\t[VolumeGroupName [VolumeGroupName...]]\n",
|
"\t[VolumeGroupName [VolumeGroupName...]]\n",
|
||||||
|
|
||||||
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
aligned_ARG, all_ARG, ignorelockingfailure_ARG, noheadings_ARG,
|
||||||
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, separator_ARG,
|
nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, prefixes_ARG,
|
||||||
sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
|
separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG)
|
||||||
|
|
||||||
xx(vgscan,
|
xx(vgscan,
|
||||||
"Search for all volume groups",
|
"Search for all volume groups",
|
||||||
|
@ -158,7 +158,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
char *str;
|
char *str;
|
||||||
const char *keys = NULL, *options = NULL, *separator;
|
const char *keys = NULL, *options = NULL, *separator;
|
||||||
int r = ECMD_PROCESSED;
|
int r = ECMD_PROCESSED;
|
||||||
int aligned, buffered, headings;
|
int aligned, buffered, headings, field_prefixes;
|
||||||
unsigned args_are_pvs;
|
unsigned args_are_pvs;
|
||||||
|
|
||||||
aligned = find_config_tree_int(cmd, "report/aligned",
|
aligned = find_config_tree_int(cmd, "report/aligned",
|
||||||
@ -169,6 +169,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
DEFAULT_REP_HEADINGS);
|
DEFAULT_REP_HEADINGS);
|
||||||
separator = find_config_tree_str(cmd, "report/separator",
|
separator = find_config_tree_str(cmd, "report/separator",
|
||||||
DEFAULT_REP_SEPARATOR);
|
DEFAULT_REP_SEPARATOR);
|
||||||
|
field_prefixes = find_config_tree_int(cmd, "report/prefixes",
|
||||||
|
DEFAULT_REP_PREFIXES);
|
||||||
|
|
||||||
args_are_pvs = (report_type == PVS || report_type == PVSEGS) ? 1 : 0;
|
args_are_pvs = (report_type == PVS || report_type == PVSEGS) ? 1 : 0;
|
||||||
|
|
||||||
@ -270,10 +272,14 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
|
|||||||
buffered = 0;
|
buffered = 0;
|
||||||
if (arg_count(cmd, noheadings_ARG))
|
if (arg_count(cmd, noheadings_ARG))
|
||||||
headings = 0;
|
headings = 0;
|
||||||
|
if (arg_count(cmd, prefixes_ARG)) {
|
||||||
|
aligned = 0;
|
||||||
|
field_prefixes = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(report_handle = report_init(cmd, options, keys, &report_type,
|
if (!(report_handle = report_init(cmd, options, keys, &report_type,
|
||||||
separator, aligned, buffered,
|
separator, aligned, buffered,
|
||||||
headings))) {
|
headings, field_prefixes))) {
|
||||||
stack;
|
stack;
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user