summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-12-15 13:59:29 -0600
committerDavid Teigland <teigland@redhat.com>2016-12-15 14:25:22 -0600
commitf126c7a55fda20d082373e9d3d8275fccd91b9c4 (patch)
treecd736791c317733999ae4c6db91b862943906d20
parent4af953d13e28246b5aba8571120b20b1d037e677 (diff)
downloadlvm2-dev-dct-cmd-defs61.tar.gz
lvconvert snapshot cleanup checksdev-dct-cmd-defs61
-rw-r--r--tools/command-lines.in3
-rw-r--r--tools/lvconvert_other.c30
-rw-r--r--tools/lvconvert_snapshot.c20
-rw-r--r--tools/tools.h5
4 files changed, 6 insertions, 52 deletions
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 4857a5633..3e4b4a9c3 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -525,6 +525,7 @@ OO: --background, --interval Number, OO_LVCONVERT
ID: lvconvert_merge_snapshot
DESC: Merge COW snapshot LV into its origin.
RULE: all not lv_is_locked lv_is_pvmove lv_is_merging_origin lv_is_virtual_origin lv_is_external_origin lv_is_merging_cow
+RULE: all and lv_is_visible
---
@@ -552,6 +553,7 @@ DESC: Combine a former COW snapshot (second arg) with a former
DESC: origin LV (first arg) to reverse a splitsnapshot command.
FLAGS: SECONDARY_SYNTAX
RULE: all not lv_is_locked lv_is_pvmove
+RULE: all and lv_is_visible
lvconvert --snapshot LV LV_linear
OO: --type snapshot, --chunksize SizeKB, --zero Bool, OO_LVCONVERT
@@ -559,6 +561,7 @@ ID: lvconvert_combine_split_snapshot
DESC: Combine a former COW snapshot (second arg) with a former
DESC: origin LV (first arg) to reverse a splitsnapshot command.
RULE: all not lv_is_locked lv_is_pvmove
+RULE: all and lv_is_visible
---
diff --git a/tools/lvconvert_other.c b/tools/lvconvert_other.c
index 22b565608..e70ab5670 100644
--- a/tools/lvconvert_other.c
+++ b/tools/lvconvert_other.c
@@ -20,36 +20,6 @@
#include "command-lines-count.h"
/*
- * FIXME: it's very unlikely that the same !visible exceptions apply to every
- * lvconvert command. Add specific !visible exceptions in command-specific
- * check functions.
- */
-
-int lvconvert_generic_check(struct cmd_context *cmd, struct logical_volume *lv,
- struct processing_handle *handle,
- int lv_is_named_arg)
-{
- if (!lv_is_visible(lv)) {
- if (lv_is_cache_pool_metadata(lv) ||
- lv_is_cache_pool_data(lv) ||
- lv_is_thin_pool_metadata(lv) ||
- lv_is_thin_pool_data(lv) ||
- lv_is_used_cache_pool(lv) ||
- lv_is_mirrored(lv) ||
- lv_is_raid(lv)) {
- return 1;
- }
-
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_line_id, cmd->command->command_line_enum,
- display_lvname(lv));
- return 0;
- }
-
- return 1;
-}
-
-/*
* Reomove missing and empty PVs from VG, if are also in provided list
*/
static void _remove_missing_empty_pv(struct volume_group *vg, struct dm_list *remove_pvs)
diff --git a/tools/lvconvert_snapshot.c b/tools/lvconvert_snapshot.c
index 56d4df9ef..d8a8366ff 100644
--- a/tools/lvconvert_snapshot.c
+++ b/tools/lvconvert_snapshot.c
@@ -293,20 +293,6 @@ int lvconvert_merge_snapshot_single(struct cmd_context *cmd,
return ECMD_PROCESSED;
}
-static int _lvconvert_merge_snapshot_check(struct cmd_context *cmd, struct logical_volume *lv,
- struct processing_handle *handle,
- int lv_is_named_arg)
-{
- if (!lv_is_visible(lv)) {
- log_error("Operation not permitted (%s %d) on hidden LV %s.",
- cmd->command->command_line_id, cmd->command->command_line_enum,
- display_lvname(lv));
- return 0;
- }
-
- return 1;
-}
-
int lvconvert_merge_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv)
{
struct processing_handle *handle;
@@ -324,7 +310,7 @@ int lvconvert_merge_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv)
handle->custom_handle = &lr;
ret = process_each_lv(cmd, cmd->position_argc, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
- handle, &_lvconvert_merge_snapshot_check, &lvconvert_merge_snapshot_single);
+ handle, NULL, &lvconvert_merge_snapshot_single);
if (lr.need_polling) {
dm_list_iterate_items(idl, &lr.poll_idls) {
@@ -360,7 +346,7 @@ static int _lvconvert_split_snapshot_single(struct cmd_context *cmd,
int lvconvert_split_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv)
{
return process_each_lv(cmd, 1, cmd->position_argv, NULL, NULL, READ_FOR_UPDATE,
- NULL, &lvconvert_generic_check, &_lvconvert_split_snapshot_single);
+ NULL, NULL, &_lvconvert_split_snapshot_single);
}
/*
@@ -422,5 +408,5 @@ static int _lvconvert_combine_split_snapshot_single(struct cmd_context *cmd,
int lvconvert_combine_split_snapshot_cmd(struct cmd_context *cmd, int argc, char **argv)
{
return process_each_lv(cmd, 1, cmd->position_argv + 1, NULL, NULL, READ_FOR_UPDATE,
- NULL, &lvconvert_generic_check, &_lvconvert_combine_split_snapshot_single);
+ NULL, NULL, &_lvconvert_combine_split_snapshot_single);
}
diff --git a/tools/tools.h b/tools/tools.h
index c2a591544..2f2c0f15f 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -278,11 +278,6 @@ int lvconvert_change_mirrorlog_cmd(struct cmd_context * cmd, int argc, char **ar
int lvconvert_merge_cmd(struct cmd_context *cmd, int argc, char **argv);
-int lvconvert_generic_check(struct cmd_context *cmd, struct logical_volume *lv,
- struct processing_handle *handle,
- int lv_is_named_arg);
-
-
int lvconvert_repair_pvs_mirror(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle,
struct dm_list *use_pvh);