1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tools: Add internal tags command.

This commit is contained in:
Alasdair G Kergon 2014-01-30 13:09:15 +00:00
parent e833d84e67
commit 83358d4c03
7 changed files with 43 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Add internal tags command to display any tags defined on the host.
Prohibit use of external origin with size incompatible with thin pool.
Avoid trying to convert single to thin pool and volume at the same time.
Add support for partitions on ZFS zvol.

View File

@ -921,6 +921,15 @@ void display_segtypes(const struct cmd_context *cmd)
}
}
void display_tags(const struct cmd_context *cmd)
{
const struct str_list *sl;
dm_list_iterate_items(sl, &cmd->tags) {
log_print("%s", sl->str);
}
}
void display_name_error(name_error_t name_error)
{
if (name_error != NAME_VALID) {

View File

@ -53,6 +53,7 @@ void vgdisplay_short(const struct volume_group *vg);
void display_formats(const struct cmd_context *cmd);
void display_segtypes(const struct cmd_context *cmd);
void display_tags(const struct cmd_context *cmd);
void display_name_error(name_error_t name_error);

View File

@ -56,6 +56,8 @@ loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
\fBsegtypes\fP \(em Display recognised Logical Volume segment types.
.TP
\fBtags\fP \(em Display any tags defined on this host.
.TP
\fBversion\fP \(em Display version information.
.LP
.SH COMMANDS

View File

@ -43,6 +43,7 @@ SOURCES =\
pvscan.c \
reporter.c \
segtypes.c \
tags.c \
toollib.c \
vgcfgbackup.c \
vgcfgrestore.c \
@ -166,7 +167,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|version) *$$' > .commands
egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|tags|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))

View File

@ -789,6 +789,11 @@ xx(segtypes,
PERMITTED_READ_ONLY,
"segtypes\n")
xx(tags,
"List tags defined on this host",
PERMITTED_READ_ONLY,
"tags\n")
xx(vgcfgbackup,
"Backup volume group configuration(s)",
PERMITTED_READ_ONLY,

23
tools/tags.c Normal file
View File

@ -0,0 +1,23 @@
/*
* Copyright (C) 2014 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
*/
#include "tools.h"
int tags(struct cmd_context *cmd, int argc __attribute__((unused)),
char **argv __attribute__((unused)))
{
display_tags(cmd);
return ECMD_PROCESSED;
}