Alan Pevec
2009-Feb-12 01:04 UTC
[Ovirt-devel] [PATCH node] ovirt_store_config: return error code
return codes: 1 = persistence failed on one of the files 2 = persistent /config filesystem is not available --- scripts/ovirt-functions | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions index 3079805..6d19747 100755 --- a/scripts/ovirt-functions +++ b/scripts/ovirt-functions @@ -359,6 +359,7 @@ EOF # ovirt_store_config /etc/config /etc/config2 ... # copy to /config and bind-mount back ovirt_store_config() { + rc=0 if grep -q " /config ext3" /proc/mounts; then printf "storing to /config :\n" for f in "$@"; do @@ -377,6 +378,7 @@ ovirt_store_config() { && mount -n --bind /config$f $f \ || printf " Failed to persist\n" printf " File persisted\n" + rc=1 fi # register in /config/files used by rc.sysinit if ! grep -q "^$f$" /config/files 2> /dev/null ; then @@ -386,7 +388,9 @@ ovirt_store_config() { echo else printf "warning: persistent config storage not available\n" + rc=2 fi + return $rc } # unmount bindmounted config files -- 1.6.0.6
Alan Pevec
2009-Feb-12 14:06 UTC
[Ovirt-devel] Re: [PATCH node] ovirt_store_config: return error code
Alan Pevec wrote:> && mount -n --bind /config$f $f \ > || printf " Failed to persist\n" > printf " File persisted\n" > + rc=1this is, of course, wrong, correct is: - && mount -n --bind /config$f $f \ - || printf " Failed to persist\n" - printf " File persisted\n" + && mount -n --bind /config$f $f + if [ $? -ne 0 ]; then + printf " Failed to persist\n" + rc=1 + else + printf " File persisted\n" + fi