summaryrefslogtreecommitdiffstats
path: root/tools/vgchange.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2010-02-24 18:15:05 +0000
committerDave Wysochanski <dwysocha@redhat.com>2010-02-24 18:15:05 +0000
commite17bcc743207dc90e81e04e7edba0d2210a98cf5 (patch)
treed0d03b543519d08312e729466f526df8a5010c2b /tools/vgchange.c
parentf59b0f3e07113d25ea4316ebc677e813e7d13482 (diff)
downloadlvm2-e17bcc743207dc90e81e04e7edba0d2210a98cf5.tar.gz
lvm2-e17bcc743207dc90e81e04e7edba0d2210a98cf5.tar.xz
lvm2-e17bcc743207dc90e81e04e7edba0d2210a98cf5.zip
Refactor _vgchange_tag() to vg_change_tag() library function.
Pull out common code to be called from tools as well as lvm2app. Leave archive() at tool level so we can use from vgcreate as well as vgchange. Should be no functional change. - add stack macro in vgchange Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'tools/vgchange.c')
-rw-r--r--tools/vgchange.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/tools/vgchange.c b/tools/vgchange.c
index b4f5d003..6d869f96 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -447,28 +447,14 @@ static int _vgchange_tag(struct cmd_context *cmd, struct volume_group *vg,
return ECMD_FAILED;
}
- if (!(vg->fid->fmt->features & FMT_TAGS)) {
- log_error("Volume group %s does not support tags", vg->name);
- return ECMD_FAILED;
- }
-
if (!archive(vg)) {
stack;
return ECMD_FAILED;
}
- if ((arg == addtag_ARG)) {
- if (!str_list_add(cmd->mem, &vg->tags, tag)) {
- log_error("Failed to add tag %s to volume group %s",
- tag, vg->name);
- return ECMD_FAILED;
- }
- } else {
- if (!str_list_del(&vg->tags, tag)) {
- log_error("Failed to remove tag %s from volume group "
- "%s", tag, vg->name);
- return ECMD_FAILED;
- }
+ if (!vg_change_tag(vg, tag, arg == addtag_ARG)) {
+ stack;
+ return ECMD_FAILED;
}
if (!vg_write(vg) || !vg_commit(vg)) {