From cef065f63fad1e42490038cac94c52fbfeac1e66 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 24 Jan 2011 14:19:05 +0000 Subject: [PATCH] Fix lvchange --test to exit cleanly. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 6 ++++++ lib/metadata/mirror.c | 5 +++++ lib/misc/lvm-globals.c | 2 +- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 9052df800..5e8464f13 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.82 - =================================== + Fix lvchange --test to exit cleanly. Add change_tag to toollib. Allow multiple pvchange command line options to be specified together. Add -f (don't fork) option to clvmd and fix clvmd -d description. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index a2ae30e31..6f7d0bef5 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3321,6 +3321,11 @@ int lv_create_single(struct volume_group *vg, backup(vg); + if (test_mode()) { + log_verbose("Test mode: Skipping activation and zeroing."); + goto out; + } + init_dmeventd_monitor(lp->activation_monitoring); if (lp->snapshot) { @@ -3399,6 +3404,7 @@ int lv_create_single(struct volume_group *vg, /* FIXME out of sequence */ backup(vg); +out: log_print("Logical volume \"%s\" created", lv->name); /* diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index f4d3a10b2..5e0f8d860 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -285,6 +285,11 @@ static int _init_mirror_log(struct cmd_context *cmd, uint64_t orig_status = log_lv->status; int was_active = 0; + if (test_mode()) { + log_verbose("Test mode: Skipping mirror log initialisation."); + return 1; + } + if (!activation() && in_sync) { log_error("Aborting. Unable to create in-sync mirror log " "while activation is disabled."); diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c index 9da61fe05..28516b013 100644 --- a/lib/misc/lvm-globals.c +++ b/lib/misc/lvm-globals.c @@ -51,7 +51,7 @@ void init_verbose(int level) void init_test(int level) { if (!_test && level) - log_print("Test mode: Metadata will NOT be updated."); + log_print("Test mode: Metadata will NOT be updated and volumes will not be (de)activated."); _test = level; } -- 2.43.5