Blame SOURCES/0051-v2v-Don-t-change-Augeas-device-entries-unless-the-va.patch

0d20ef
From 1b03fad9aa7e51bb30911af192f0d4eaa859dcc2 Mon Sep 17 00:00:00 2001
0d20ef
From: "Richard W.M. Jones" <rjones@redhat.com>
0d20ef
Date: Tue, 18 Nov 2014 13:37:21 +0000
0d20ef
Subject: [PATCH] v2v: Don't change Augeas device entries unless the value has
0d20ef
 changed.
0d20ef
0d20ef
When remapping block devices, don't change an entry unless its value
0d20ef
has changed.  This avoids unnecessary Augeas writes.
0d20ef
0d20ef
(cherry picked from commit 4c7026fb7a7514838a01771abb4c7e62a4e4485f)
0d20ef
---
0d20ef
 v2v/convert_linux.ml | 8 +++++---
0d20ef
 1 file changed, 5 insertions(+), 3 deletions(-)
0d20ef
0d20ef
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
0d20ef
index 48f351c..44b6c7f 100644
0d20ef
--- a/v2v/convert_linux.ml
0d20ef
+++ b/v2v/convert_linux.ml
0d20ef
@@ -1332,7 +1332,7 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
0d20ef
       fun path ->
0d20ef
         let value = g#aug_get path in
0d20ef
 
0d20ef
-        let value =
0d20ef
+        let new_value =
0d20ef
           (* Handle grub2 resume=<dev> specially. *)
0d20ef
           if string_find path "GRUB_CMDLINE" >= 0 then (
0d20ef
             if Str.string_match rex_resume value 0 then (
0d20ef
@@ -1346,8 +1346,10 @@ let rec convert ~verbose ~keep_serial_console (g : G.guestfs) inspect source =
0d20ef
           )
0d20ef
           else replace_if_device path value in
0d20ef
 
0d20ef
-        g#aug_set path value;
0d20ef
-        changed := true
0d20ef
+        if value <> new_value then (
0d20ef
+          g#aug_set path new_value;
0d20ef
+          changed := true
0d20ef
+        )
0d20ef
     ) paths;
0d20ef
 
0d20ef
     if !changed then (
0d20ef
-- 
0d20ef
1.8.3.1
0d20ef