Skip to contentSkip to conversation

master - backup: show warning once per command

PATCH Zdenek Kabelac 1 participant 1 message Dec 18, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75f23880934a8c1cb192e9a898261320db15043a
Commit:        75f23880934a8c1cb192e9a898261320db15043a
Parent:        5bb6266046b11e6e4b47596689e3f4a75ba692a3
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Dec 18 16:36:33 2016 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Sun Dec 18 19:38:30 2016 +0100

backup: show warning once per command

When command calls backup() more then once (which is actually not wanted) this warning message is shown repeatedly:

"WARNING: This metadata update is NOT backed up."

Instead now print message just once and less confuse user.

---
 WHATS_NEW                  |    1 +
 lib/format_text/archiver.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index e7abf59..fbaa369 100644
@@ -1,5 +1,6 @@
 Version 2.02.169 - 
 =====================================
+  Warn about command not making metadata backup just once per command.
   Enable usage of cached volume as thin volume's external origin.
   Support cache volume activation with -real layer.
   Improve search of lock-holder for external origin and thin-pool.
lib/format_text/archiver.c +3 -1
index 92799e4..d381155 100644
@@ -35,6 +35,7 @@ struct archive_params {
 struct backup_params {
 	int enabled;
 	char *dir;
+	int suppress;
 };
 
 int archive_init(struct cmd_context *cmd, const char *dir,
@@ -235,7 +236,8 @@ static int _backup(struct volume_group *vg)
 int backup_locally(struct volume_group *vg)
 {
 	if (!vg->cmd->backup_params->enabled || !vg->cmd->backup_params->dir) {
-		log_warn("WARNING: This metadata update is NOT backed up");
+		log_warn_suppress(vg->cmd->backup_params->suppress++,
+				  "WARNING: This metadata update is NOT backed up.");
 		return 1;
 	}