]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- allow to disable background comparison (bnc#726122)
authorArvin Schnell <aschnell@suse.de>
Tue, 6 Mar 2012 10:40:02 +0000 (11:40 +0100)
committerArvin Schnell <aschnell@suse.de>
Tue, 6 Mar 2012 10:40:02 +0000 (11:40 +0100)
data/default-config
package/snapper.changes
snapper/AsciiFile.cc
snapper/AsciiFile.h
snapper/Snapper.cc

index bcb3bf9a829cc79aedddc50bdfb2893d90dc2eb7..af1790353288d37d4473729e9d9a384bbc1de930 100644 (file)
@@ -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"
index dda6fa630469d804ceb2f9c115983981b240b390..5c030c10a6374f2e9984cbf3bb9cc7df4166355f 100644 (file)
@@ -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
 
index 93d4971fd238ed9661aea39c670d50cab8027542..38ffdccfac1dc9e04a65852383091fa9d091f968 100644 (file)
@@ -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<string>& 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;
     }
index 8089bed1120cf69f68f5b55361145e909a741347..ccd7736bf5db7435c90a8a4b57a3cd14db56baa4 100644 (file)
@@ -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;
 
index 6bf086f8556fda519c44c5c6b84cc07c70d4193e..d8ab010015f9497fd6a073dafbe903810ec429b5 100644 (file)
@@ -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())