[Ovirt-devel] [PATCH 3/4] ovirt_store_config must refresh persistent copy

Darryl L. Pierce dpierce at redhat.com
Tue Mar 23 15:48:44 UTC 2010


From: Alan Pevec <apevec at redhat.com>

Related: rhbz#576239

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-functions |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index dfa53a8..cfcedbb 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -480,13 +480,21 @@ ovirt_store_config() {
             # persisted
             if [ -f $p ]; then
                 if [ -f /config$p ]; then
-                    printf "File already persisted: $p\n"
-                    persist_it=false
+                    local md5root=$(md5 $p)
+                    local md5stored=$(md5 /config$p)
+                    if [ "$md5root" = "$md5stored" ]; then
+                        printf "File already persisted: $p\n"
+                        persist_it=false
+                    else
+                        # persistent copy needs refresh
+                        umount -n $p 2> /dev/null || :
+                        rm -f /config$p
+                    fi
                 fi
             fi
 
             if $persist_it; then
-                f=$(readlink -f $p)
+                local f=$(readlink -f $p)
                 printf "$f"
                 # skip if file does not exist or is empty
                 if [ ! -s "$f" ]; then
-- 
1.6.6.1




More information about the ovirt-devel mailing list