summaryrefslogtreecommitdiffstats
path: root/tools/lvconvert.c
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2011-01-05 20:02:45 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2011-01-05 20:02:45 +0000
commit327dbf10783f8c82d98bdc66db74f09a0a5d373e (patch)
treecd3167a8bd29ed0e3fc645dd8d7aead8b1b615d3 /tools/lvconvert.c
parent2d6e83ea19d98832bb6f3726b3a19190fe5d779b (diff)
downloadlvm2-327dbf10783f8c82d98bdc66db74f09a0a5d373e.tar.gz
lvm2-327dbf10783f8c82d98bdc66db74f09a0a5d373e.tar.xz
lvm2-327dbf10783f8c82d98bdc66db74f09a0a5d373e.zip
Prevent the user from simultaneously adding a mirror log while removing
a mirror image (or removing a log while adding a mirror). Advise the user to use two separate commands instead. This issue become especially problematic when PVs are specified, as they tend to mean different things when adding vs removing. In a command that mixes adding and removing, it is impossible to decern exactly what the user wants. This change prevents bug 603912.
Diffstat (limited to 'tools/lvconvert.c')
-rw-r--r--tools/lvconvert.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 7c7826bb..3dab0d3f 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -927,6 +927,25 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
}
/*
+ * Disallow adding logs while removing images or
+ * adding images while removing logs
+ */
+ if ((*old_log_count < *new_log_count) &&
+ (*old_mimage_count > *new_mimage_count)) {
+ log_error("Mirror logs cannot be added while images are"
+ " being removed.");
+ log_error("Try two separate commands.");
+ return 0;
+ }
+ if ((*old_log_count > *new_log_count) &&
+ (*old_mimage_count < *new_mimage_count)) {
+ log_error("Mirror images cannot be added while logs are"
+ " being removed.");
+ log_error("Try two separate commands.");
+ return 0;
+ }
+
+ /*
* No mirrored logs for cluster mirrors until
* log daemon is multi-threaded.
*/