From e1eda65caac461ce10ce15f3f8eb5edd75a39dff Mon Sep 17 00:00:00 2001 From: Deklan Dieterly Date: Thu, 12 Nov 2015 16:09:06 -0700 Subject: [PATCH] Use SERVICE_HOST for ip addresses Use SERVICE_HOST for ip addresses for services. Only clean Horizon if the Horizon service is enabled. Change-Id: Iecf2d0a80ebba9435a9e0f0b4cbe135c4dab2c04 --- devstack/Vagrantfile | 3 + devstack/files/storm/cluster.xml | 89 ------------------- devstack/plugin.sh | 147 ++++++++++++++++++++++++++++--- 3 files changed, 136 insertions(+), 103 deletions(-) diff --git a/devstack/Vagrantfile b/devstack/Vagrantfile index be727f4e2..c806b5bfd 100644 --- a/devstack/Vagrantfile +++ b/devstack/Vagrantfile @@ -78,6 +78,9 @@ Vagrant.configure(2) do |config| echo '[[local|localrc]] SERVICE_HOST=192.168.10.6 +HOST_IP=192.168.10.6 +HOST_IP_IFACE=eth1 +MYSQL_HOST=192.168.10.6 MYSQL_PASSWORD=secretmysql DATABASE_PASSWORD=secretdatabase RABBIT_PASSWORD=secretrabbit diff --git a/devstack/files/storm/cluster.xml b/devstack/files/storm/cluster.xml index 3ebf4fe47..e5144d426 100644 --- a/devstack/files/storm/cluster.xml +++ b/devstack/files/storm/cluster.xml @@ -82,93 +82,4 @@ - - vagrant@mini-mon:/opt/storm/current/logback$ - vagrant@mini-mon:/opt/storm/current/logback$ ls - cluster.xml - vagrant@mini-mon:/opt/storm/current/logback$ cat * - - - - - - ${storm.home}/logs/${logfile.name} - - ${storm.home}/logs/${logfile.name}.%i - 1 - 9 - - - - 100MB - - - - %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n - - - - - ${storm.home}/logs/access.log - - ${storm.home}/logs/access.log.%i - 1 - 9 - - - - 100MB - - - - %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n - - - - - ${storm.home}/logs/metrics.log - - ${storm.home}/logs/metrics.log.%i - 1 - 9 - - - - 2MB - - - - %d %-8r %m%n - - - - - - - - - - - - - - - - - diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 63eacc3a8..9026c166e 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -149,7 +149,9 @@ function extra_monasca { install_monasca_default_alarms if is_service_enabled horizon; then + install_monasca_horizon_ui + fi install_monasca_smoke_test @@ -187,7 +189,11 @@ function clean_monasca { clean_monasca_smoke_test - clean_monasca_horizon_ui + if is_service_enabled horizon; then + + clean_monasca_horizon_ui + + fi clean_monasca_default_alarms @@ -288,6 +294,12 @@ function install_zookeeper { sudo cp "${MONASCA_BASE}"/monasca-api/devstack/files/zookeeper/zoo.cfg /etc/zookeeper/conf/zoo.cfg + if [[ ${SERVICE_HOST} ]]; then + + sudo sed -i "s/server\.0=127\.0\.0\.1/server.0=${SERVICE_HOST}/g" /etc/zookeeper/conf/zoo.cfg + + fi + sudo cp "${MONASCA_BASE}"/monasca-api/devstack/files/zookeeper/myid /etc/zookeeper/conf/myid sudo cp "${MONASCA_BASE}"/monasca-api/devstack/files/zookeeper/environment /etc/zookeeper/conf/environment @@ -368,6 +380,13 @@ function install_kafka { sudo chmod 644 /etc/kafka/server.properties + if [[ ${SERVICE_HOST} ]]; then + + sudo sed -i "s/host\.name=127\.0\.0\.1/host.name=${SERVICE_HOST}/g" /etc/kafka/server.properties + sudo sed -i "s/zookeeper\.connect=127\.0\.0\.1:2181/zookeeper.connect=${SERVICE_HOST}:2181/g" /etc/kafka/server.properties + + fi + sudo start kafka || sudo restart kafka } @@ -408,6 +427,13 @@ function install_influxdb { sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/influxdb/influxdb.conf /etc/opt/influxdb/influxdb.conf + if [[ ${SERVICE_HOST} ]]; then + + # set influxdb server listening ip address + sudo sed -i "s/hostname = \"127\.0\.0\.1\"/hostname = \"${SERVICE_HOST}\"/g" /etc/opt/influxdb/influxdb.conf + + fi + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/influxdb/influxdb /etc/default/influxdb sudo /etc/init.d/influxdb start || sudo /etc/init.d/influxdb restart @@ -499,7 +525,8 @@ function install_schema { sudo chown root:root /opt/monasca/sqls/mon.sql - sudo mysql -uroot -psecretmysql < /opt/monasca/sqls/mon.sql || echo "Did the schema change? This process will fail on schema changes." + # must login as root@localhost + sudo mysql -h "127.0.0.1" -uroot -psecretmysql < /opt/monasca/sqls/mon.sql || echo "Did the schema change? This process will fail on schema changes." sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/schema/winchester.sql /opt/monasca/sqls/winchester.sql @@ -507,7 +534,8 @@ function install_schema { sudo chown root:root /opt/monasca/sqls/winchester.sql - sudo mysql -uroot -psecretmysql < /opt/monasca/sqls/winchester.sql || echo "Did the schema change? This process will fail on schema changes." + # must login as root@localhost + sudo mysql -h "127.0.0.1" -uroot -psecretmysql < /opt/monasca/sqls/winchester.sql || echo "Did the schema change? This process will fail on schema changes." sudo mkdir -p /opt/kafka/logs || true @@ -651,7 +679,16 @@ function install_monasca_api_java { if [[ ${SERVICE_HOST} ]]; then + # set influxdb ip address + sudo sed -i "s/url: \"http://127\.0\.0\.1:8086\"/url: \"http://${SERVICE_HOST}:8086\"/g" /etc/monasca/api-config.yml + # set kafka ip address + sudo sed -i "s/127\.0\.0\.1:9092/${SERVICE_HOST}:9092/g" /etc/monasca/api-config.yml + # set zookeeper ip address + sudo sed -i "s/127\.0\.0\.1:2181/${SERVICE_HOST}:2181/g" /etc/monasca/api-config.yml + # set monasca api server listening ip address sudo sed -i "s/bindHost: 127\.0\.0\.1/bindHost: ${SERVICE_HOST}/g" /etc/monasca/api-config.yml + # set mysql ip address + sudo sed -i "s/127\.0\.0\.1:3306/${SERVICE_HOST}:3306/g" /etc/monasca/api-config.yml fi @@ -707,6 +744,19 @@ function install_monasca_api_python { sudo chmod 0660 /etc/monasca/api-config.conf + if [[ ${SERVICE_HOST} ]]; then + + # set influxdb ip address + sudo sed -i "s/ip_address = 127\.0\.0\.1/ip_address = ${SERVICE_HOST}/g" /etc/monasca/api-config.conf + # set kafka ip address + sudo sed -i "s/127\.0\.0\.1:9092/${SERVICE_HOST}:9092/g" /etc/monasca/api-config.conf + # set mysql ip address + sudo sed -i "s/hostname = 127\.0\.0\.1/hostname = ${SERVICE_HOST}/g" /etc/monasca/api-config.conf + # set keystone ip address + sudo sed -i "s/identity_uri = http:\/\/127\.0\.0\.1:35357/identity_uri = http:\/\/${SERVICE_HOST}:35357/g" /etc/monasca/api-config.conf + + fi + sudo ln -s /etc/monasca/api-config.conf /etc/api-config.conf sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-api/python/api-config.ini /etc/monasca/api-config.ini @@ -717,6 +767,7 @@ function install_monasca_api_python { if [[ ${SERVICE_HOST} ]]; then + # set monasca api server listening ip address sudo sed -i "s/host = 127\.0\.0\.1/host = ${SERVICE_HOST}/g" /etc/monasca/api-config.ini fi @@ -807,6 +858,11 @@ function install_monasca_persister_java { if [[ ${SERVICE_HOST} ]]; then + # set zookeeper ip address + sudo sed -i "s/zookeeperConnect: \"127\.0\.0\.1:2181\"/zookeeperConnect: \"${SERVICE_HOST}:2181\"/g" /etc/monasca/persister-config.yml + # set influxdb ip address + sudo sed -i "s/url: \"http:\/\/127\.0\.0\.1:8086\"/url: \"http:\/\/${SERVICE_HOST}:8086\"/g" /etc/monasca/persister-config.yml + # set monasca persister server listening ip address sudo sed -i "s/bindHost: 127\.0\.0\.1/bindHost: ${SERVICE_HOST}/g" /etc/monasca/persister-config.yml fi @@ -865,18 +921,41 @@ function install_monasca_persister_python { sudo chmod 0640 /etc/monasca/persister.conf + if [[ ${SERVICE_HOST} ]]; then + + # set zookeeper ip address + sudo sed -i "s/uri = 127\.0\.0\.1:2181/uri = ${SERVICE_HOST}:2181/g" /etc/monasca/persister.conf + # set kafka ip address + sudo sed -i "s/uri = 127\.0\.0\.1:9092/uri = ${SERVICE_HOST}:9092/g" /etc/monasca/persister.conf + # set influxdb ip address + sudo sed -i "s/ip_address = 127\.0\.0\.1/ip_address = ${SERVICE_HOST}/g" /etc/monasca/persister.conf + + fi + + # /etc/monasca/persister-config.yml is needed for the Monasca Agent configuration. + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-persister/persister-config.yml /etc/monasca/persister-config.yml + + sudo chown mon-persister:monasca /etc/monasca/persister-config.yml + + sudo chmod 0640 /etc/monasca/persister-config.yml + + if [[ ${SERVICE_HOST} ]]; then + + # set zookeeper ip address + sudo sed -i "s/zookeeperConnect: \"127\.0\.0\.1:2181\"/zookeeperConnect: \"${SERVICE_HOST}:2181\"/g" /etc/monasca/persister-config.yml + # set influxdb ip address + sudo sed -i "s/url: \"http:\/\/127\.0\.0\.1:8086\"/url: \"http:\/\/${SERVICE_HOST}:8086\"/g" /etc/monasca/persister-config.yml + # set monasca persister server listening ip address + sudo sed -i "s/bindHost: 127\.0\.0\.1/bindHost: ${SERVICE_HOST}/g" /etc/monasca/persister-config.yml + + fi + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-persister/python/monasca-persister.conf /etc/init/monasca-persister.conf sudo chown root:root /etc/init/monasca-persister.conf sudo chmod 0744 /etc/init/monasca-persister.conf - sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-persister/persister-config.yml /etc/monasca/persister-config.yml - - sudo chown mon-persister:monasca /etc/monasca/persister-config.yml - - sudo chmod 0660 /etc/monasca/persister-config.yml - sudo start monasca-persister || sudo restart monasca-persister } @@ -962,6 +1041,17 @@ function install_monasca_notification { sudo chmod 0660 /etc/monasca/notification.yaml + if [[ ${SERVICE_HOST} ]]; then + + # set kafka ip address + sudo sed -i "s/url: \"127\.0\.0\.1:9092\"/url: \"${SERVICE_HOST}:9092\"/g" /etc/monasca/notification.yaml + # set zookeeper ip address + sudo sed -i "s/url: \"127\.0\.0\.1:2181\"/url: \"${SERVICE_HOST}:2181\"/g" /etc/monasca/notification.yaml + # set mysql ip address + sudo sed -i "s/host: \"127\.0\.0\.1\"/host: \"${SERVICE_HOST}\"/g" /etc/monasca/notification.yaml + + fi + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-notification/monasca-notification.conf /etc/init/monasca-notification.conf sudo chown root:root /etc/init/monasca-notification.conf @@ -1049,6 +1139,13 @@ function install_storm { sudo chmod 0644 /opt/storm/apache-storm-0.9.6/conf/storm.yaml + if [[ ${SERVICE_HOST} ]]; then + + # set zookeeper ip address + sudo sed -i "s/127\.0\.0\.1\/${SERVICE_HOST}/g" /opt/storm/apache-storm-0.9.6/conf/storm.yaml + + fi + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/storm/storm-nimbus.conf /etc/init/storm-nimbus.conf sudo chown root:root /etc/init/storm-nimbus.conf @@ -1125,6 +1222,16 @@ function install_monasca_thresh { sudo chmod 0640 /etc/monasca/thresh-config.yml + if [[ ${SERVICE_HOST} ]]; then + + # set kafka ip address + sudo sed -i "s/metadataBrokerList: \"127\.0\.0\.1:9092\"/metadataBrokerList: \"${SERVICE_HOST}:9092\"/g" /etc/monasca/thresh-config.yml + # set zookeeper ip address + sudo sed -i "s/zookeeperConnect: \"127\.0\.0\.1:2181\"/zookeeperConnect: \"${SERVICE_HOST}:2181\"/g" /etc/monasca/thresh-config.yml + # set mysql ip address + sudo sed -i "s/jdbc:mysql:\/\/127\.0\.0\.1\/mon/jdbc:mysql:\/\/${SERVICE_HOST}\/mon/g" /etc/monasca/thresh-config.yml + fi + sudo cp -f "${MONASCA_BASE}"/monasca-api/devstack/files/monasca-thresh/monasca-thresh /etc/init.d/monasca-thresh sudo chown root:root /etc/init.d/monasca-thresh @@ -1133,7 +1240,6 @@ function install_monasca_thresh { sudo service monasca-thresh start || sudo service monasca-thresh restart - } function clean_monasca_thresh { @@ -1248,6 +1354,7 @@ function install_monasca_agent { if [[ ${SERVICE_HOST} ]]; then sudo sed -i "s/--monasca_url 'http:\/\/127\.0\.0\.1:8070\/v2\.0'/--monasca_url 'http:\/\/${SERVICE_HOST}:8070\/v2\.0'/" /usr/local/bin/monasca-reconfigure + sudo sed -i "s/--keystone_url 'http:\/\/127\.0\.0\.1:35357\/v3'/--keystone_url 'http:\/\/${SERVICE_HOST}:35357\/v3'/" /usr/local/bin/monasca-reconfigure fi sudo /usr/local/bin/monasca-reconfigure @@ -1276,6 +1383,8 @@ function clean_monasca_agent { sudo rm -rf /etc/monasca/agent/conf.d + sudo rm -rf /etc/monasca/agent + sudo apt-get -y purge libxslt1-dev sudo apt-get -y purge libxml2-dev sudo apt-get -y purge build-essential @@ -1296,8 +1405,18 @@ function install_monasca_smoke_test { HPCLOUD_MON_MONASCA_CI_DIR=$(ls -td /opt/monasca/hpcloud-mon-monasca-ci-* | head -1) - sudo sed -i s/192\.168\.10\.4/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py - sudo sed -i s/192\.168\.10\.5/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py + if [[ ${SERVICE_HOST} ]]; then + + sudo sed -i s/192\.168\.10\.4/${SERVICE_HOST}/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py + sudo sed -i s/192\.168\.10\.5/${SERVICE_HOST}/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py + + else + + sudo sed -i s/192\.168\.10\.4/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py + sudo sed -i s/192\.168\.10\.5/127\.0\.0\.1/g ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/utils.py + + fi + sudo sed -i "s/'hostname', '-f'/'hostname'/g" ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke_configs.py (cd /opt/monasca ; sudo -H ./bin/pip install influxdb) @@ -1306,11 +1425,11 @@ function install_monasca_smoke_test { if [[ ${SERVICE_HOST} ]]; then - sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2.py --monapi ${SERVICE_HOST} || true + sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2.py --monapi ${SERVICE_HOST} --kafka ${SERVICE_HOST} --zoo ${SERVICE_HOST} --mysql ${SERVICE_HOST} || true else - sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2.py --monapi "127.0.0.1" || true + sudo /opt/monasca/bin/python ${HPCLOUD_MON_MONASCA_CI_DIR}/tests/smoke/smoke2.py --monapi "127.0.0.1" --kafka "127.0.0.1" --zoo "127.0.0.1" --mysql "127.0.0.1" || true fi