]> review.fuel-infra Code Review - openstack-build/neutron-lbaas-build.git/commitdiff
Add Neutron LBaaS 2015.1 for Ubuntu 14.04 91/6791/4
authorSergey Kolekonov <skolekonov@mirantis.com>
Fri, 30 Jan 2015 12:10:14 +0000 (15:10 +0300)
committerSergey Kolekonov <skolekonov@mirantis.com>
Tue, 19 May 2015 16:15:28 +0000 (19:15 +0300)
- Updated specs for 2015.1
- Updated dependencies according to global-requirements [0]
  [0] https://github.com/openstack/requirements/blob/stable/kilo/global-requirements.txt

Change-Id: I63fb870a42c813af7aecd7b9f7d29b4f05a17363

13 files changed:
tests/runtests.sh [new file with mode: 0755]
trusty/debian/changelog [new file with mode: 0644]
trusty/debian/compat [new file with mode: 0644]
trusty/debian/control [new file with mode: 0644]
trusty/debian/copyright [new file with mode: 0644]
trusty/debian/cron.d/neutron-lbaas-agent-netns-cleanup [new file with mode: 0644]
trusty/debian/neutron-lbaas-agent.init.in [new file with mode: 0644]
trusty/debian/neutron-lbaas-agent.install [new file with mode: 0644]
trusty/debian/patches/series [new file with mode: 0644]
trusty/debian/patches/skip-failing-tests.patch [new file with mode: 0644]
trusty/debian/python-neutron-lbaas.install [new file with mode: 0644]
trusty/debian/rules [new file with mode: 0755]
trusty/debian/source/format [new file with mode: 0644]

diff --git a/tests/runtests.sh b/tests/runtests.sh
new file mode 100755 (executable)
index 0000000..3cee2c1
--- /dev/null
@@ -0,0 +1,233 @@
+#!/bin/bash
+
+set -ex
+PACKAGE=$1
+UBUNTU=false
+FAILURE=false
+FAILED_TESTS=""
+SERVICE_STARTED=false
+PLATFORM=$(python -mplatform)
+TOKEN=$(openssl rand -hex 10)
+MYSQL_PASS=mysql_pass
+AUTH="--os-auth-url http://127.0.0.1:35357 --os-token $TOKEN --os-endpoint http://127.0.0.1:35357/v2.0/"
+NEUTRON_AUTH="--os-username neutron --os-password neutron --os-tenant-name neutron --os-auth-url http://127.0.0.1:35357/v2.0"
+CORE_PLUGIN="neutron.plugins.ml2.plugin.Ml2Plugin"
+
+if [[ $PLATFORM =~ Ubuntu ]]; then UBUNTU=true; fi
+if [ -z $PACKAGE ]; then echo "Package for testing is not specified"; exit 1; fi
+echo "127.0.10.1 $(hostname)" >> /etc/hosts
+
+install_packages() {
+    #Install packages
+    if $UBUNTU
+    then
+        echo "mysql-server mysql-server/root_password select $MYSQL_PASS" | debconf-set-selections
+        echo "mysql-server mysql-server/root_password_again select $MYSQL_PASS" | debconf-set-selections
+        apt-get install -y --force-yes rabbitmq-server mysql-server mysql-client-core-5.5 python-mysqldb keystone
+    else
+        #yum install -y openstack-keystone rabbitmq-server mysql-server MySQL-client python-oslo-utils
+        yum install -y openstack-keystone rabbitmq-server python-oslo-utils
+        #CentOS 7 temporary workaround
+        yum install -y http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
+        yum install -y mysql-community-server mysql-community-client
+        #Install some plugins because they are required for db-migration scripts (bug #1371184)
+        #Ubuntu neutron-server package include them
+        #yum install -y openstack-neutron-bigswitch openstack-neutron-brocade openstack-neutron-cisco openstack-neutron-hyperv openstack-neutron-vmware openstack-neutron-openvswitch \
+        #               openstack-neutron-ryu openstack-neutron-linuxbridge openstack-neutron-metaplugin openstack-neutron-mellanox openstack-neutron-nec openstack-neutron-nuage
+    fi
+}
+
+install_neutron_server () {
+    if $UBUNTU
+    then
+        apt-get install -y --force-yes neutron-server
+    else
+        yum install -y openstack-neutron openstack-neutron-ml2
+    fi
+}
+
+setup_rabbitmq () {
+    #Setup firewall on CentOS 7
+    if ! $UBUNTU ; then
+        firewall-cmd --permanent --add-port=5672/tcp
+        firewall-cmd --reload
+        setsebool -P nis_enabled 1
+    fi
+
+    restart_service rabbitmq-server
+    if [ $? -ne 0 ]; then
+        echo "RabbitMQ server failed to start"
+        cat /var/log/rabbitmq/startup_err
+        cat /var/log/rabbitmq/startup_log
+    fi
+}
+
+setup_database() {
+    #Setup databases
+    restart_service mysql
+    if ! $UBUNTU
+    then
+       mysqladmin -u root password $MYSQL_PASS
+    fi
+    mysql -uroot -p$MYSQL_PASS -Bse "drop database if exists keystone"
+    mysql -uroot -p$MYSQL_PASS -Bse "drop database if exists neutron"
+    mysql -uroot -p$MYSQL_PASS -Bse "create database keystone"
+    mysql -uroot -p$MYSQL_PASS -Bse "create database neutron"
+    mysql -uroot -p$MYSQL_PASS -Bse "GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'neutron'"
+    mysql -uroot -p$MYSQL_PASS -Bse "GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone'"
+    mysql -uroot -p$MYSQL_PASS -Bse "flush privileges"
+}
+
+setup_keystone() {
+    #Setup Keystone
+    if ! $UBUNTU
+    then
+        cp /usr/share/keystone/keystone-dist-paste.ini /etc/keystone/keystone-paste.ini
+    fi
+    cat > /etc/keystone/keystone.conf << EOF
+[DEFAULT]
+admin_token=$TOKEN
+[database]
+connection=mysql://keystone:keystone@localhost/keystone
+[token]
+provider=keystone.token.providers.uuid.Provider
+EOF
+    keystone-manage db_sync
+    chown -R keystone:keystone /var/log/keystone/
+    if $UBUNTU
+    then
+        restart_service keystone
+    else
+        restart_service openstack-keystone
+    fi
+    sleep 10
+    #Setup Neutron credentials
+    keystone $AUTH user-create --name neutron --pass neutron
+    keystone $AUTH tenant-create --name neutron
+    keystone $AUTH role-create --name=admin
+    keystone $AUTH user-role-add --user neutron --role admin --tenant neutron
+    NEUTRON_SERVICE=`keystone $AUTH service-create --name=neutron --type=network --description="Neutron Networking Service" | grep id | awk -F '|' '{print $3}' | tr -d ' '`
+    keystone $AUTH endpoint-create --region RegionOne --service-id=$NEUTRON_SERVICE --publicurl=http://localhost:9696 --internalurl=http://localhost:9696 --adminurl=http://localhost:9696
+}
+
+setup_neutron_services() {
+#Setup Neutron
+cat > /etc/neutron/neutron.conf << EOF
+[DEFAULT]
+auth_strategy = keystone
+debug = True
+verbose = True
+service_plugins = neutron.services.l3_router.l3_router_plugin.L3RouterPlugin,lbaas
+core_plugin = $CORE_PLUGIN
+rabbit_password = guest
+rabbit_hosts = 127.0.0.1
+rpc_backend = neutron.openstack.common.rpc.impl_kombu
+state_path = /var/lib/neutron
+lock_path = $state_path/lock
+[keystone_authtoken]
+auth_host = 127.0.0.1
+auth_port = 35357
+auth_protocol = http
+admin_tenant_name = neutron
+admin_user = neutron
+admin_password = neutron
+auth_url=http://127.0.0.1:35357/v2.0
+[matchmaker_redis]
+[matchmaker_ring]
+[quotas]
+[agent]
+root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
+[database]
+connection = mysql://neutron:neutron@127.0.0.1/neutron?charset=utf8
+[service_providers]
+service_provider = LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
+EOF
+
+cat > /etc/neutron/lbaas_agent.ini << EOF
+[DEFAULT]
+interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
+[haproxy]
+EOF
+
+}
+
+upgrade_neutron_db () {
+    neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head || (echo "DB migration failed" && exit 1)
+}
+
+start_neutron_server () {
+    restart_service neutron-server
+    # Sleep is to let Neutron server successfully reconnect to AMQP
+    sleep 10
+}
+
+try () {
+    TEST_FUNCTION=$1
+    SERVICE_STARTED=false
+    for i in {1..5}
+    do
+       FAILURE=false
+       $TEST_FUNCTION
+       if ! $FAILURE
+       then break
+       elif [ $i -eq 5 ]
+       then
+           FAILED_TESTS+="$TEST_FUNCTION "
+       fi
+    done
+}
+
+restart_service () {
+    local SERVICE=$1
+    if $UBUNTU; then
+        service $SERVICE restart
+    else
+        systemctl restart $SERVICE
+    fi
+}
+
+check_neutron_lbaas () {
+    NET_ID=$(neutron net-create $NEUTRON_AUTH net$RANDOM | grep ' id ' | awk '{print $4}')
+    SUBNET_ID=$(neutron $NEUTRON_AUTH subnet-create $NET_ID 10.0.0.0/24 | grep ' id ' | awk '{print $4}')
+    LB_POOL_ID=$(neutron $NEUTRON_AUTH lb-pool-create --lb-method ROUND_ROBIN --name mypool --protocol HTTP --subnet-id $SUBNET_ID | grep ' id ' | awk '{print $4}')
+    CHECK=$(neutron $NEUTRON_AUTH lb-pool-list | grep $LB_POOL_ID)
+    if [ -z "$CHECK" ]; then echo "ERROR. The pool wasn't created" && FAILURE=true; fi
+}
+
+check_neutron_lbaas_agent () {
+    if ! $SERVICE_STARTED ; then
+        restart_service neutron-lbaas-agent
+        SERVICE_STARTED=true
+    fi
+    #This sleep here and in other functions is intended to let the agent add information to the queue
+    sleep 10
+    STATUS=$(neutron $NEUTRON_AUTH agent-list | grep "Loadbalancer agent" | awk '{print $9}')
+    if [ "$STATUS" != ":-)" ]; then echo "LBaaS agent check failed"; FAILURE=true; fi
+}
+
+check_error () {
+    if [ "$FAILED_TESTS" != "" ]
+    then
+        grep TRACE /var/log/neutron/*
+        grep ERROR /var/log/neutron/*
+        echo "Failed tests are: $FAILED_TESTS"
+        exit 1
+    fi
+}
+
+case $PACKAGE in
+  neutron-lbaas-agent)
+    install_neutron_server
+    install_packages
+    setup_database
+    setup_keystone
+    setup_neutron_services
+    upgrade_neutron_db
+    start_neutron_server
+    try check_neutron_lbaas_agent
+    try check_neutron_lbaas
+    check_error
+  ;;
+esac
+
+exit 0
\ No newline at end of file
diff --git a/trusty/debian/changelog b/trusty/debian/changelog
new file mode 100644 (file)
index 0000000..24483f1
--- /dev/null
@@ -0,0 +1,7 @@
+neutron-lbaas (1:2015.1.0-1~u14.04+mos1) mos7.0; urgency=medium
+
+  * Updated specs for stable/kilo
+  * Updated dependencies according to global-requirements [0]
+    [0] https://github.com/openstack/requirements/blob/stable/kilo/global-requirements.txt
+
+ -- Sergey Kolekonov <skolekonov@mirantis.com> Tue, 28 Apr 2015 21:35:25 +0300
diff --git a/trusty/debian/compat b/trusty/debian/compat
new file mode 100644 (file)
index 0000000..ec63514
--- /dev/null
@@ -0,0 +1 @@
+9
diff --git a/trusty/debian/control b/trusty/debian/control
new file mode 100644 (file)
index 0000000..128d5b9
--- /dev/null
@@ -0,0 +1,85 @@
+Source: neutron-lbaas
+Section: python
+Priority: optional
+Maintainer: MOS Neutron Team <mos-neutron@mirantis.com>
+Build-Depends:
+ debhelper (>= 9),
+ dh-python,
+ dh-systemd,
+ openstack-pkg-tools (>= 21),
+ python-all (>= 2.7.1)
+Build-Depends-Indep:
+ alembic (>= 0.7.2),
+ neutron-common (>= 1:2015.1),
+ python-barbicanclient (>= 3.0.1),
+ python-cliff (>= 1.10.0),
+ python-coverage,
+ python-eventlet (>= 0.16.1),
+ python-fixtures (>= 0.3.14),
+ python-greenlet (>= 0.3.2),
+ python-hacking (>= 0.10.0),
+ python-mock (>= 1.0),
+ python-netaddr (>= 0.7.12),
+ python-novaclient (>= 1:2.22.0),
+ python-openssl (>= 0.11),
+ python-oslo-config (>= 1:1.9.3),
+ python-oslo-db (>= 1.7.0),
+ python-oslo-log (>= 1.0.0),
+ python-oslo-messaging (>= 1.8.0),
+ python-oslo-rootwrap (>= 1.6.0),
+ python-oslo-serialization (>= 1.4.0),
+ python-oslo-utils (>= 1.4.0),
+ python-oslotest (>= 1.5.1),
+ python-pbr (>= 0.10),
+ python-pyasn1,
+ python-pyasn1-modules,
+ python-requests (>= 2.2.0),
+ python-requests-mock (>= 0.6.0),
+ python-setuptools,
+ python-six (>= 1.9.0),
+ python-sqlalchemy (>= 0.9.7),
+ python-stevedore (>= 1.3.0),
+ python-subunit (>= 0.0.18),
+ python-testscenarios (>= 0.4),
+ python-testtools (>= 0.9.36),
+ python-webob (>= 1.2.3),
+ python-webtest (>= 2.0),
+ testrepository ( >= 0.0.18)
+Standards-Version: 3.9.6
+Homepage: http://github.com/openstack/neutron-lbaas
+
+Package: python-neutron-lbaas
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends}
+Description: Loadbalancer-as-a-Service driver for OpenStack Neutron
+ Neutron is a virtual network service for Openstack, and a part of
+ Netstack. Just like OpenStack Nova provides an API to dynamically
+ request and configure virtual servers, Neutron provides an API to
+ dynamically request and configure virtual networks. These networks
+ connect "interfaces" from other OpenStack services (e.g., virtual NICs
+ from Nova VMs). The Neutron API supports extensions to provide
+ advanced network capabilities (e.g., QoS, ACLs, network monitoring,
+ etc.)
+ .
+ This package provices the Loadbalancer-as-a-Service driver for Neutron.
+
+Package: neutron-lbaas-agent
+Architecture: all
+Depends:
+ haproxy,
+ neutron-common,
+ python-neutron-lbaas (= ${source:Version}),
+ ${misc:Depends},
+ ${python:Depends},
+ ${shlibs:Depends}
+Description: Neutron is a virtual network service for Openstack - LBaaS agent
+ Neutron is a virtual network service for Openstack, and a part of
+ Netstack. Just like OpenStack Nova provides an API to dynamically
+ request and configure virtual servers, Neutron provides an API to
+ dynamically request and configure virtual networks. These networks
+ connect "interfaces" from other OpenStack services (e.g., virtual NICs
+ from Nova VMs). The Neutron API supports extensions to provide
+ advanced network capabilities (e.g., QoS, ACLs, network monitoring,
+ etc.)
+ .
+ This package provides the Load Balancing as-a Service (LBaaS) agent.
diff --git a/trusty/debian/copyright b/trusty/debian/copyright
new file mode 100644 (file)
index 0000000..7bb3eda
--- /dev/null
@@ -0,0 +1,40 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: neutron-lbaas
+Source: http://github.com/openstack/neutron-lbaas
+Comment: Refactor of LBaaS codebase from Neutron core.
+
+Files: *
+Copyright: 2010-2014 OpenStack Foundation,
+           2010 United States Government,
+           2013 IBM Corp,
+           2013-2014 Embrane, Inc,
+           2013-2014 Hewlett-Packard Development Company, L.P,
+           2013 Mirantis, Inc,
+           2013 New Dream Network, LLC (DreamHost),
+           2013 Radware LTD,
+           2014 A10 Networks,
+           2014 Citrix Systems, Inc,
+           2014 Doug Wiegley (dougwig),
+           2014 VA Linux Systems Japan K.K,
+           2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
+License: Apache-2
+
+Files: debian/*
+Copyright: 2015 Canonical Ltd
+License: Apache-2
+
+License: Apache-2
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ .
+    http://www.apache.org/licenses/LICENSE-2.0
+ .
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ .
+ On Debian-based systems the full text of the Apache version 2.0 license
+ can be found in `/usr/share/common-licenses/Apache-2.0'
diff --git a/trusty/debian/cron.d/neutron-lbaas-agent-netns-cleanup b/trusty/debian/cron.d/neutron-lbaas-agent-netns-cleanup
new file mode 100644 (file)
index 0000000..92a4bc8
--- /dev/null
@@ -0,0 +1,4 @@
+# vim: set filetype=crontab:
+# Periodically cleans Neutron's network namespaces on behalf of the Neutron
+# L3 agent.
+0 * * * * neutron if [ -x /usr/bin/neutron-netns-cleanup ] ; then /usr/bin/neutron-netns-cleanup --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/lbaas_agent.ini >/dev/null 2>&1; fi
diff --git a/trusty/debian/neutron-lbaas-agent.init.in b/trusty/debian/neutron-lbaas-agent.init.in
new file mode 100644 (file)
index 0000000..a5bcfaf
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          neutron-lbaas-agent
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Should-Start:      mysql postgresql rabbitmq-server keystone
+# Should-Stop:       mysql postgresql rabbitmq-server keystone
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Neutron LBaaS agent
+# Description:       Provide LBaaS agent for neutron
+### END INIT INFO
+
+# Author: Thomas Goirand <zigo@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Neutron LBaaS agent"
+PROJECT_NAME=neutron
+NAME=${PROJECT_NAME}-lbaas-agent
+# --config-file=/etc/neutron/neutron.conf will be happened 
+# to DAEMON_ARGS later by openstack-pkg-tools
+DAEMON_ARGS="--config-file=/etc/neutron/lbaas_agent.ini --log-file=/var/log/neutron/lbaas-agent.log"
diff --git a/trusty/debian/neutron-lbaas-agent.install b/trusty/debian/neutron-lbaas-agent.install
new file mode 100644 (file)
index 0000000..45251fb
--- /dev/null
@@ -0,0 +1,4 @@
+debian/cron.d/neutron-lbaas-agent-netns-cleanup etc/cron.d
+etc/lbaas_agent.ini etc/neutron
+etc/neutron/rootwrap.d/lbaas-haproxy.filters etc/neutron/rootwrap.d
+usr/bin/neutron-lbaas-agent usr/bin
diff --git a/trusty/debian/patches/series b/trusty/debian/patches/series
new file mode 100644 (file)
index 0000000..f70cbc8
--- /dev/null
@@ -0,0 +1 @@
+skip-failing-tests.patch
diff --git a/trusty/debian/patches/skip-failing-tests.patch b/trusty/debian/patches/skip-failing-tests.patch
new file mode 100644 (file)
index 0000000..482006f
--- /dev/null
@@ -0,0 +1,11 @@
+diff -Naurp neutron-lbaas-2015.1.0rc1.orig/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py neutron-lbaas-2015.1.0rc1/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py
+--- neutron-lbaas-2015.1.0rc1.orig/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py       2015-04-09 15:01:20.000000000 -0400
++++ neutron-lbaas-2015.1.0rc1/neutron_lbaas/tests/unit/common/tls_utils/test_cert_parser.py    2015-04-11 20:28:15.164898414 -0400
+@@ -251,6 +251,7 @@ class TestTLSParseUtils(base.BaseTestCas
+         self.assertTrue(epkey.check())
+     def test_dump_private_key(self):
++        self.skipTest('Skipped by Ubuntu')
+         self.assertRaises(exceptions.NeedsPassphrase,
+                           cert_parser.dump_private_key,
+                           ENCRYPTED_PKCS8_CRT_KEY)
diff --git a/trusty/debian/python-neutron-lbaas.install b/trusty/debian/python-neutron-lbaas.install
new file mode 100644 (file)
index 0000000..47e0ed4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/python*
diff --git a/trusty/debian/rules b/trusty/debian/rules
new file mode 100755 (executable)
index 0000000..c07f42e
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/openstack-pkg-tools/pkgos.make
+
+%:
+       dh $@ --with python2,systemd --buildsystem=python_distutils
+
+# NOTE(jamespage): Some tests need access to /etc/neutron/neutron.conf,
+#                  skip these as this file will contain access credentials
+#                  so is not world readable.
+# neutron_lbaas.tests.unit.agent.test_agent.TestLbaasService.test_main
+# neutron_lbaas.tests.unit.common.tls_utils.test_cert_parser.TestTLSParseUtils.test_read_private_key
+# neutron_lbaas.tests.unit.services.loadbalancer.agent.test_agent.TestLbaasService.test_main
+SKIPTEST := (?!.*TestTLSParseUtils.test_read_private_key.*)(?!.*TestLbaasService.test_main.*)
+ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
+override_dh_auto_test:
+       rm -rf .testrepository
+       testr init && \
+       set -e && \
+       TEMP_REZ=`mktemp -t` && \
+       PYTHONPATH=$(CURDIR) testr run --subunit 'neutron_lbaas\.tests\.unit\.$(SKIPTEST)' | tee $$TEMP_REZ | subunit2pyunit; \
+       rm -f $$TEMP_REZ ;
+endif
+
+override_dh_auto_clean:
+       dh_auto_clean
+       rm -rf .testrepository
+       rm -f debian/*.upstart debian/*.init debian/*.service
diff --git a/trusty/debian/source/format b/trusty/debian/source/format
new file mode 100644 (file)
index 0000000..163aaf8
--- /dev/null
@@ -0,0 +1 @@
+3.0 (quilt)