-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Partial-Bug: #1488259 smlite changes for packaging changes
- Add server manager lite deb packaging changes - Modify setup.sh to include server manager lite option - Add provision shell script to install server manager, create server manager objects and issue provision - Pre check/config for testbey.py specified servers for a cluster - Local repo pinning changes Change-Id: I45b4cf957a4c1f393e8068ee8eee2d9580d397a3
- Loading branch information
Showing
19 changed files
with
816 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Package: * | ||
Pin: origin "" | ||
Pin-Priority: 990 | ||
|
||
Package: * | ||
Pin: release o=Debian | ||
Pin-Priority: -10 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
202 changes: 202 additions & 0 deletions
202
common/debian/contrail-server-manager-installer/debian/provision.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
#!/bin/bash | ||
set -x | ||
set -e | ||
|
||
datetime_string=$(date +%Y_%m_%d__%H_%M_%S) | ||
mkdir -p /var/log/contrail/install_logs/ | ||
log_file=/var/log/contrail/install_logs/provision_$datetime_string.log | ||
exec &> >(tee -a "$log_file") | ||
|
||
start_time=$(date +"%s") | ||
|
||
SOURCES_LIST="sources_list" | ||
TESTBED="testbed.py" | ||
CONTRAIL_PKG="" | ||
INSTALL_SM_LITE="install_sm_lite" | ||
CLEANUP_PUPPET_AGENT="" | ||
NO_LOCAL_REPO=1 | ||
LOCAL_REPO_DIR=/opt/contrail/contrail_local_repo | ||
CLUSTER_ID="" | ||
|
||
function usage() | ||
{ | ||
set +x | ||
echo "Usage" | ||
echo "" | ||
echo "$0" | ||
echo -e "\t-h --help" | ||
echo -e "\t-c|--contrail-package <pkg>" | ||
echo -e "\t-t|--testbed <testbed.py>" | ||
echo -e "\t-ni|--no-install-sm-lite" | ||
echo -e "\t-cp|--cleanup-puppet-agent" | ||
echo -e "\t-nr|--no-local-repo" | ||
echo -e "\t-cid|--cluster-id <cluster-id>" | ||
echo "" | ||
set -x | ||
} | ||
|
||
if [ "$#" -eq 0 ]; then | ||
usage | ||
exit | ||
fi | ||
|
||
while [[ $# > 0 ]] | ||
do | ||
key="$1" | ||
|
||
case $key in | ||
-c|--contrail-package) | ||
CONTRAIL_PKG="$2" | ||
shift # past argument | ||
;; | ||
-t|--testbed) | ||
TESTBED="$2" | ||
shift # past argument | ||
;; | ||
-nr|--no-local-repo) | ||
NO_LOCAL_REPO=0 | ||
;; | ||
-ni|--no-install-sm-lite) | ||
INSTALL_SM_LITE="" | ||
;; | ||
-cp|--no-cleanup-puppet-agent) | ||
CLEANUP_PUPPET_AGENT="cleanup_puppet_agent" | ||
;; | ||
-cid|--cluster-id) | ||
CLUSTER_ID="$2" | ||
shift # past argument | ||
;; | ||
-h|--help) | ||
usage | ||
exit | ||
;; | ||
*) | ||
# unknown option | ||
echo "ERROR: unknown parameter $key" | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
shift # past argument or value | ||
done | ||
|
||
if [ "$TESTBED" == "" ] || [ "$CONTRAIL_PKG" == "" ]; then | ||
exit | ||
fi | ||
|
||
function unmount_contrail_local_repo() | ||
{ | ||
echo "INFO: Removing Contrail Local Repo - $LOCAL_REPO_DIR" | ||
# Remove local repo dir | ||
if [ -d $LOCAL_REPO_DIR ]; then | ||
rm -rf $LOCAL_REPO_DIR | ||
fi | ||
|
||
# Remove preference file | ||
if [ -f /etc/apt/preferences.d/contrail_local_repo ]; then | ||
rm -f /etc/apt/preferences.d/contrail_local_repo | ||
fi | ||
|
||
set +e | ||
grep "^deb file:$LOCAL_REPO_DIR ./" /etc/apt/sources.list | ||
exit_status=$? | ||
set -e | ||
if [ $exit_status == 0 ]; then | ||
sed -i "s#deb file:$LOCAL_REPO_DIR ./##g" /etc/apt/sources.list | ||
apt-get update | ||
fi | ||
} | ||
|
||
function mount_contrail_local_repo() | ||
{ | ||
set -e | ||
# check if package is available | ||
if [ ! -f "$CONTRAIL_PKG" ]; then | ||
echo "ERROR: $CONTRAIL_PKG : No Such file..." | ||
exit 2 | ||
fi | ||
|
||
# mount package and create local repo | ||
echo "INFO: Creating Local Repo -- $LOCAL_REPO_DIR" | ||
set +e | ||
grep "^deb file:$LOCAL_REPO_DIR ./" /etc/apt/sources.list | ||
exit_status=$? | ||
set -e | ||
|
||
if [ $exit_status != 0 ]; then | ||
mkdir -p $LOCAL_REPO_DIR | ||
dpkg -x $CONTRAIL_PKG $LOCAL_REPO_DIR | ||
(cd $LOCAL_REPO_DIR && tar xfz opt/contrail/contrail_packages/*.tgz) | ||
(cd $LOCAL_REPO_DIR && DEBIAN_FRONTEND=noninteractive dpkg -i binutils_*.deb dpkg-dev_*.deb libdpkg-perl_*.deb make_*.deb patch_*.deb) | ||
(cd $LOCAL_REPO_DIR && dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz) | ||
datetime_string=$(date +%Y_%m_%d__%H_%M_%S) | ||
cp /etc/apt/sources.list /etc/apt/sources.list.contrail.$datetime_string | ||
echo >> /etc/apt/sources.list | ||
sed -i "1 i\deb file:$LOCAL_REPO_DIR ./" /etc/apt/sources.list | ||
cp -v /opt/contrail/contrail_server_manager/contrail_local_preferences /etc/apt/preferences.d/contrail_local_repo | ||
apt-get update | ||
fi | ||
} | ||
|
||
function cleanup_puppet_agent() | ||
{ | ||
set +e | ||
apt-get -y --purge autoremove puppet puppet-common hiera | ||
set -e | ||
} | ||
|
||
if [ "$CLEANUP_PUPPET_AGENT" != "" ]; then | ||
echo "--> Remove puppet agent, if it is present" | ||
cleanup_puppet_agent | ||
fi | ||
|
||
# Install sever manager | ||
if [ "$INSTALL_SM_LITE" != "" ]; then | ||
# Create a local repo from contrail-install packages | ||
# so packages from this repo gets preferred | ||
if [ $NO_LOCAL_REPO != 0 ]; then | ||
echo "--> Provision contrail local repo" | ||
mount_contrail_local_repo | ||
LOCAL_REPO_MOUNTED=1 | ||
fi | ||
|
||
echo "--> Install server manager lite" | ||
pushd /opt/contrail/contrail_server_manager | ||
./setup.sh --all --smlite --nowebui --nosm-mon | ||
popd | ||
fi | ||
|
||
echo "--> Convert testbed.py to server manager entities" | ||
# Convert testbed.py to server manager object json files | ||
optional_args="" | ||
if [ ! -z "$CLUSTER_ID" ]; then | ||
optional_args="--cluster-id $CLUSTER_ID" | ||
fi | ||
/opt/contrail/server_manager/client/testbed_parser.py --testbed ${TESTBED} --contrail-packages ${CONTRAIL_PKG} $optional_args | ||
|
||
echo "--> Pre provision checks to make sure setup is ready for contrail provisioning" | ||
# Precheck the targets to make sure that, ready for contrail provisioning | ||
SERVER_MGR_IP=$(grep listen_ip_addr /opt/contrail/server_manager/sm-config.ini | grep -Po "listen_ip_addr = \K.*") | ||
/opt/contrail/server_manager/client/preconfig.py --server-json server.json --server-manager-ip ${SERVER_MGR_IP} | ||
|
||
# Remove contrail local repo if any | ||
if [[ $LOCAL_REPO_MOUNTED -eq 1 ]]; then | ||
unmount_contrail_local_repo | ||
fi | ||
|
||
echo "--> Adding server manager objects to server manager database" | ||
# Create package, cluster, server objects | ||
server-manager add image -f image.json | ||
server-manager add cluster -f cluster.json | ||
server-manager add server -f server.json | ||
|
||
echo "--> Provisioning the cluster" | ||
# Provision the cluster | ||
CONTRAIL_PKG_ID=$(python -c "import json; fid = open('image.json', 'r'); contents = fid.read(); cjson = json.loads(contents); print cjson['image'][0]['id']") | ||
CLUSTER_ID=$(python -c "import json; fid = open('cluster.json', 'r'); data = json.load(fid); fid.close(); print data['cluster'][0]['id']") | ||
server-manager provision -F --cluster_id $CLUSTER_ID ${CONTRAIL_PKG_ID} | ||
|
||
end_time=$(date +"%s") | ||
diff=$(($end_time-$start_time)) | ||
echo "--> Provisioning is issued, and took $(($diff / 60)) minutes and $(($diff % 60)) seconds." | ||
echo "--> Check provisioning status using /opt/contrail/contrail_server_manager/provision_status.sh" |
3 changes: 3 additions & 0 deletions
3
common/debian/contrail-server-manager-installer/debian/provision_status.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
server-manager show cluster --select provision_role_sequence | ||
server-manager status server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
common/debian/contrail-server-manager-lite/debian/changelog.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
contrail-server-manager-lite (BUILDTAG) tsurendra; urgency=low | ||
|
||
[tsurendra ] | ||
* debian/changelog: changelog | ||
|
||
-- tsurendra <tsurendra@juniper.net> Wed Jun 11 17:39:50 PDT 2014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Source: contrail-server-manager-lite | ||
Maintainer: tsurendra <tsurendra@juniper.net> | ||
Section: misc | ||
Priority: optional | ||
Standards-Version: 1.0 | ||
Build-Depends: debhelper (>= 8) | ||
|
||
Package: contrail-server-manager-lite | ||
Architecture: all | ||
Maintainer: tsurendra <tsurendra@juniper.net> | ||
Depends: python, apache2, sqlite, puppetmaster-passenger (=3.7.3-1puppetlabs1), xinetd, python-pip, python-gevent, ntp,autoconf, gcc, tftp, sendmail, dpkg-dev, syslinux, ipmitool, createrepo, libapache2-mod-wsgi, python-urlgrabber, python-django, selinux-utils, python-simplejson, python-dev, fence-agents, python-requests, reprepro, python-netaddr | ||
Section: contrail-server-manager-lite | ||
Priority: extra | ||
Description: Contrail Server Manager - Server Package, without cobbler, only provisioning supported package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Name: contrail-server-manager-lite | ||
Maintainer: tsurendra <tsurendra@juniper.net> | ||
License: Commercial | ||
Files: * | ||
Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. |
Oops, something went wrong.