Skip to content

Commit

Permalink
Various optimizations in Vagrant env
Browse files Browse the repository at this point in the history
Make sure to stop Pacemaker before creating primary or standby
pgsql instance.

Allow the master ip address to already exists when building the
primary pgsql instance.
  • Loading branch information
ioguix committed Feb 4, 2019
1 parent 0090d8c commit 963eea5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 5 additions & 2 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ all: create_vm pgsql-replicas pacemaker
create_vm:
vagrant up

pgsql-replicas:
pgsql-replicas: pcmk-stop pgsql-primary
vagrant up --provision-with=pgsql-replicas

pacemaker:
vagrant up --provision-with=pacemaker

pgsql-primary:
pgsql-primary: pcmk-stop
vagrant up --provision-with=pgsql-primary

prov:
Expand All @@ -34,3 +34,6 @@ validate:
cts: all
vagrant up --provision-with=cts

pcmk-stop:
vagrant ssh -c 'if [ -f "/etc/corosync/corosync.conf" ]; then sudo pcs cluster stop --all --wait; fi'

7 changes: 5 additions & 2 deletions test/provision/pgsql-primary.bash
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ cp "${PGDATA}/postgresql.conf" "${PGDATA}/.."
cp "${PGDATA}/recovery.conf.pcmk" "${PGDATA}/.."

# create master ip
DEV=$(ip route show to "${MASTER_IP}/24"|grep -Eo 'dev \w+')
ip addr add "${MASTER_IP}/24" dev "${DEV/dev }"
ip -o addr show to "${MASTER_IP}" | if ! grep -q "${MASTER_IP}"
then
DEV=$(ip route show to "${MASTER_IP}/24"|grep -Eo 'dev \w+')
ip addr add "${MASTER_IP}/24" dev "${DEV/dev }"
fi

# restart master pgsql
systemctl --quiet restart "postgresql-${PGVER}"
2 changes: 1 addition & 1 deletion test/provision/system.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for N in "${NODES[@]}"; do
done

PACKAGES=(
screen vim
screen vim bash-completion
)

yum install --nogpgcheck --quiet -y -e 0 "${PACKAGES[@]}"
Expand Down

0 comments on commit 963eea5

Please sign in to comment.