[Ovirt-devel] [PATCH node] Hostname is now properly persisted between reboots. rhbz#504166

Joey Boggs jboggs at redhat.com
Mon Jun 8 19:40:18 UTC 2009


Darryl L. Pierce wrote:
> The o-c-hostname script now checks to see if local storage has been
> configured. If it has not then the script exits with an error.
> Otherwise, after the user enters a hostname, the /etc/script/network
> file is persisted.
>
> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
> ---
>  scripts/ovirt-config-hostname |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/ovirt-config-hostname b/scripts/ovirt-config-hostname
> index cad0270..ac8cdf1 100755
> --- a/scripts/ovirt-config-hostname
> +++ b/scripts/ovirt-config-hostname
> @@ -8,6 +8,13 @@
>  trap '__st=$?; stop_log; exit $__st' 0
>  trap 'exit $?' 1 2 13 15
>  
> +warn() { printf '%s\n' "$*" >&2; }
> +
> +if ! is_local_storage_configured; then
> +    warn "Local storage must be configured prior to setting the hostname."
> +    exit 99
> +fi
> +
>  HOSTNAME_FILE="/etc/sysconfig/network"
>  
>  function set_hostname {
> @@ -17,8 +24,9 @@ set /files$HOSTNAME_FILE/HOSTNAME "$1"
>  EOF
>      rc=$?
>      if [ $rc = 0 ]; then
> -    /bin/hostname "$1"
> -    rc=$?
> +        /bin/hostname "$1"
> +        rc=$?
> +        if [ $rc -eq 0 ]; then /usr/sbin/persist $HOSTNAME_FILE; fi
>      fi
>      stop_log
>      return $rc
> @@ -82,4 +90,3 @@ else
>      printf "\n\n Hostname Configuration\n\n"
>      prompt_user
>  fi
> -
>   
rebase applied fine,  ACK




More information about the ovirt-devel mailing list