From: Arvin Schnell Date: Tue, 6 Mar 2012 10:40:02 +0000 (+0100) Subject: - allow to disable background comparison (bnc#726122) X-Git-Tag: v0.1.3~246 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75962e5ce8721e813fd4ccaf30c9c015dc76e913;p=thirdparty%2Fsnapper.git - allow to disable background comparison (bnc#726122) --- diff --git a/data/default-config b/data/default-config index bcb3bf9a..af179035 100644 --- a/data/default-config +++ b/data/default-config @@ -5,6 +5,10 @@ SUBVOLUME="/" # filesystem type FSTYPE="btrfs" +# start comparing pre- and post-snapshot in background after creating +# post-snapshot +BACKGROUND_COMPARISON="yes" + # run daily number cleanup NUMBER_CLEANUP="yes" diff --git a/package/snapper.changes b/package/snapper.changes index dda6fa63..5c030c10 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Mar 06 11:37:34 CET 2012 - aschnell@suse.de + +- allow to disable background comparison (bnc#726122) +- 0.0.10 + ------------------------------------------------------------------- Fri Mar 02 16:25:26 CET 2012 - aschnell@suse.de diff --git a/snapper/AsciiFile.cc b/snapper/AsciiFile.cc index 93d4971f..38ffdccf 100644 --- a/snapper/AsciiFile.cc +++ b/snapper/AsciiFile.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -149,6 +149,25 @@ AsciiFile::save() } + void + SysconfigFile::setValue(const string& key, bool value) + { + setValue(key, value ? "yes" : "no"); + } + + + bool + SysconfigFile::getValue(const string& key, bool& value) const + { + string tmp; + if (!getValue(key, tmp)) + return false; + + value = tmp == "yes"; + return true; + } + + void SysconfigFile::setValue(const string& key, const string& value) { @@ -190,8 +209,6 @@ AsciiFile::save() bool SysconfigFile::getValue(const string& key, vector& values) const { - values.clear(); - string tmp; if (!getValue(key, tmp)) return false; @@ -200,6 +217,8 @@ AsciiFile::save() if (!tmp.empty()) boost::split(values, tmp, boost::is_any_of(" \t"), boost::token_compress_on); + else + values.clear(); return true; } diff --git a/snapper/AsciiFile.h b/snapper/AsciiFile.h index 8089bed1..ccd7736b 100644 --- a/snapper/AsciiFile.h +++ b/snapper/AsciiFile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) [2004-2011] Novell, Inc. + * Copyright (c) [2004-2012] Novell, Inc. * * All Rights Reserved. * @@ -91,6 +91,9 @@ namespace snapper SysconfigFile(const string& name) : AsciiFile(name), modified(false) {} ~SysconfigFile() { if (modified) save(); } + void setValue(const string& key, bool value); + bool getValue(const string& key, bool& value) const; + void setValue(const string& key, const string& value); bool getValue(const string& key, string& value) const; diff --git a/snapper/Snapper.cc b/snapper/Snapper.cc index 6bf086f8..d8ab0100 100644 --- a/snapper/Snapper.cc +++ b/snapper/Snapper.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Novell, Inc. + * Copyright (c) [2011-2012] Novell, Inc. * * All Rights Reserved. * @@ -178,6 +178,11 @@ namespace snapper if (snapshot2 == snapshots.end() || snapshot2->isCurrent()) throw IllegalSnapshotException(); + bool background_comparison = true; + config->getValue("BACKGROUND_COMPARISON", background_comparison); + if (!background_comparison) + return; + y2mil("num1:" << snapshot1->getNum() << " num2:" << snapshot2->getNum()); if (!snapshot1->isCurrent())