MT#8773 [CARRIER] add sp2 commands. Use no-sync-db on sp1 commit

Copy relevant sp2 commands from modify network.yml
PRO section that will be skipped later.

Don't try to connect to db, on CARRIER nodes the
config is already pointing to db1a and that node
could be not even created. This will reduce,
installation time due to ngcpcfg timeouts.

Change-Id: I54aa56277d2d61344a7e77e794da850b364d2e40
changes/25/125/7
Victor Seva 11 years ago
parent 6d34000a5c
commit 4352ad9f46

@ -1496,7 +1496,40 @@ EOT
die "Error during installation of ngcp. Find details at: $TARGET/tmp/ngcp-installer.log $TARGET/tmp/ngcp-installer-debug.log" die "Error during installation of ngcp. Find details at: $TARGET/tmp/ngcp-installer.log $TARGET/tmp/ngcp-installer-debug.log"
fi fi
if "$RETRIEVE_MGMT_CONFIG" && [ "$ROLE" = "sp1" ] ; then if "$PRO_EDITION" ; then
# set variable to have the *other* node from the PRO setup available for ngcp-network
case $ROLE in
sp1)
logit "Role matching sp1"
if [ -n "$TARGET_HOSTNAME" ] && [[ "$TARGET_HOSTNAME" == *a ]] ; then # usually carrier env
logit "Target hostname is set and ends with 'a'"
THIS_HOST="$TARGET_HOSTNAME"
PEER="${TARGET_HOSTNAME%a}b"
else # usually PRO env
logit "Target hostname is not set or does not end with 'a'"
THIS_HOST="$ROLE"
PEER=sp2
fi
;;
sp2)
logit "Role matching sp2"
if [ -n "$TARGET_HOSTNAME" ] && [[ "$TARGET_HOSTNAME" == *b ]] ; then # usually carrier env
THIS_HOST="$TARGET_HOSTNAME"
PEER="${TARGET_HOSTNAME%b}a"
else # usually PRO env
logit "Target hostname is not set or does not end with 'b'"
THIS_HOST="$ROLE"
PEER=sp1
fi
;;
*)
logit "Using unsupported role: $ROLE"
;;
esac
fi
if "$RETRIEVE_MGMT_CONFIG" ; then
if [ "$ROLE" = "sp1" ] ; then
password=sipwise password=sipwise
logit "Retrieving config.yml from management server" logit "Retrieving config.yml from management server"
@ -1520,10 +1553,27 @@ EOT
logit "Sync constants" logit "Sync constants"
chroot $TARGET ngcp-sync-constants -r chroot $TARGET ngcp-sync-constants -r
# use --no-db-sync only if supported by ngcp[cfg] version
if chroot $TARGET grep -q -- --no-db-sync /usr/sbin/ngcpcfg ; then
chroot $TARGET ngcpcfg --no-db-sync commit 'get network|config|constants yaml [via deployment process]'
chroot $TARGET ngcpcfg build --no-db-sync
chroot $TARGET ngcpcfg push --no-db-sync --shared-only
else
chroot $TARGET ngcpcfg commit 'get network|config|constants yaml [via deployment process]' chroot $TARGET ngcpcfg commit 'get network|config|constants yaml [via deployment process]'
chroot $TARGET ngcpcfg build chroot $TARGET ngcpcfg build
chroot $TARGET ngcpcfg push --shared-only chroot $TARGET ngcpcfg push --shared-only
fi fi
else # ROLE = sp2
# make sure login from second node to first node works
chroot $TARGET ssh-keyscan $PEER >> ~/.ssh/known_hosts
# live system uses a different SSH host key than the finally installed
# system, so do NOT use ssh-keyscan here
chroot $TARGET tail -1 ~/.ssh/known_hosts | sed "s/\w* /$THIS_HOST /" >> ~/.ssh/known_hosts
chroot $TARGET tail -1 ~/.ssh/known_hosts | sed "s/\w* /$MANAGEMENT_IP /" >> ~/.ssh/known_hosts
chroot $TARGET scp ~/.ssh/known_hosts $PEER:~/.ssh/known_hosts
fi
fi
case "$CROLE" in case "$CROLE" in
proxy) proxy)
@ -1661,36 +1711,6 @@ fi
if "$RETRIEVE_MGMT_CONFIG" ; then if "$RETRIEVE_MGMT_CONFIG" ; then
echo "Nothing to do (RETRIEVE_MGMT_CONFIG is set), network.yml was already set up." echo "Nothing to do (RETRIEVE_MGMT_CONFIG is set), network.yml was already set up."
elif "$PRO_EDITION" ; then elif "$PRO_EDITION" ; then
# set variable to have the *other* node from the PRO setup available for ngcp-network
case $ROLE in
sp1)
logit "Role matching sp1"
if [ -n "$TARGET_HOSTNAME" ] && [[ "$TARGET_HOSTNAME" == *a ]] ; then # usually carrier env
logit "Target hostname is set and ends with 'a'"
THIS_HOST="$TARGET_HOSTNAME"
PEER="${TARGET_HOSTNAME%a}b"
else # usually PRO env
logit "Target hostname is not set or does not end with 'a'"
THIS_HOST="$ROLE"
PEER=sp2
fi
;;
sp2)
logit "Role matching sp2"
if [ -n "$TARGET_HOSTNAME" ] && [[ "$TARGET_HOSTNAME" == *b ]] ; then # usually carrier env
THIS_HOST="$TARGET_HOSTNAME"
PEER="${TARGET_HOSTNAME%b}a"
else # usually PRO env
logit "Target hostname is not set or does not end with 'b'"
THIS_HOST="$ROLE"
PEER=sp1
fi
;;
*)
logit "Using unsupported role: $ROLE"
;;
esac
# get list of available network devices (excl. some known-to-be-irrelevant ones, also see MT#8297) # get list of available network devices (excl. some known-to-be-irrelevant ones, also see MT#8297)
net_devices=$(tail -n +3 /proc/net/dev | awk -F: '{print $1}'| sed "s/\s*//" | grep -ve '^vmnet' -ve '^vboxnet' -ve '^docker' -ve '^usb' | sort -u) net_devices=$(tail -n +3 /proc/net/dev | awk -F: '{print $1}'| sed "s/\s*//" | grep -ve '^vmnet' -ve '^vboxnet' -ve '^docker' -ve '^usb' | sort -u)

Loading…
Cancel
Save