[PATCH] wait for db to become ready - WAS Re: [Ovirt-devel] Still having issues with the wui appliance install
Perry N. Myers
pmyers at redhat.com
Wed May 28 16:26:28 UTC 2008
Alan Pevec wrote:
> Darryl L. Pierce wrote:
>> I ran through it again and it's still not creating the ovirt database
>> or role. After it finished the full installation and restarted, I
>> watched it as it tried to bring up the ovirt system it complained that
>> the postgres database was not initialized. When I got to a command
>> prompt, went into Postgres and listed databases with \l I only saw
>> postgres, template0 and template1 listed.
>
> This turned out to be a timing issue in ovirt-wui-install during first
> boot, postgres was not ready immediately after 'service postgres start'
> returned.
> PG initscript has optimistic sleep 2 after starting postmaster daemon
> but this wui VM was created w/o KVM support (VT was not enabled in BIOS)
> and running slooowly with qemu-system-x86_64
> With KVM it's fast enough so this doesn't happen.
We really should print a warning if create-wui-appliance doesn't detect
hardware virt support or if the qemu process is not launched with
qemu-kvm. That way people will understand why things are so slow.
Though... create-wui-appliance will need to be rewritten once we start
using livecd creator from the ADK to generate the appliance and this will
be moot.
> Here's the patch which should fix this: wait until we can connect to the
> database or timeout
Looks ok to me. ACK.
Perry
> diff --git a/wui/scripts/ovirt-wui-install b/wui/scripts/ovirt-wui-install
> index 8d95d48..3891604 100755
> --- a/wui/scripts/ovirt-wui-install
> +++ b/wui/scripts/ovirt-wui-install
> @@ -135,6 +135,21 @@ echo "host all all 127.0.0.1 255.255.255.0 trust"
> >> /var/lib/pgsql/data/pg_hba.
> service postgresql stop > /dev/null 2>&1
> service postgresql start
> [ $? != 0 ] && echo "Failed to start database" && exit 1
> +declare -i timeout=10 +while [[ timeout -gt 0 ]]
> +do
> + sleep 2
> + psql -l -U postgres > /dev/null 2>&1
> + rc=$?
> + if [[ rc -eq 0 ]]
> + then
> + break
> + else
> + echo Database not ready yet, retrying...
> + fi
> + let timeout--
> +done
> +[[ timeout -eq 0 ]] && echo "Failed to start database" && exit 1
>
> if [ -z $PASSWD ]; then
> # generate random pg user password
>
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
--
|=- Red Hat, Engineering, Emerging Technologies, Boston -=|
|=- Email: pmyers at redhat.com -=|
|=- Office: +1 412 474 3552 Mobile: +1 703 362 9622 -=|
|=- GnuPG: E65E4F3D 88F9 F1C9 C2F3 1303 01FE 817C C5D2 8B91 E65E 4F3D -=|
More information about the ovirt-devel
mailing list