From 8eb73616225908c5617e9dbd24f1314a0a3fd56a Mon Sep 17 00:00:00 2001 From: Nikhil Manchanda Date: Thu, 17 Apr 2014 18:10:11 -0700 Subject: [PATCH] Add support for a neutron-based install Update the trove-integration scripts to be able to install and configure trove based on Neutron instead of Nova-network. Co-authored by: Anna Shen Partially-implements bp: neutron-support Change-Id: Iec4773802034c42ddaeaa3c2f2c7cf4af3ee93ee --- scripts/conf/test_begin.conf | 6 ++-- .../fedora-guest/install.d/15-reddwarf-dep | 2 +- .../ubuntu-guest/install.d/15-reddwarf-dep | 2 +- scripts/localrc.rc | 6 +++- scripts/redstack | 30 ++++++++++++++++++- scripts/redstack.rc | 3 ++ tests/integration/int_tests.py | 2 +- tests/integration/tests/initialize.py | 8 +++-- 8 files changed, 50 insertions(+), 9 deletions(-) diff --git a/scripts/conf/test_begin.conf b/scripts/conf/test_begin.conf index 31db90ae..980e19d9 100644 --- a/scripts/conf/test_begin.conf +++ b/scripts/conf/test_begin.conf @@ -85,7 +85,9 @@ "databases_page_size": 20, "instances_page_size": 20, "users_page_size": 20, - "rabbit_runs_locally":true, + "rabbit_runs_locally": true, "dbaas_datastore": "%datastore_type%", "dbaas_datastore_version": "%datastore_version%", - + "neutron_enabled": %neutron_enabled%, + "shared_network": "%shared_network%", + "shared_network_subnet": "%shared_network_subnet%", \ No newline at end of file diff --git a/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep b/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep index aef6030e..7d20d539 100755 --- a/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep +++ b/scripts/files/elements/fedora-guest/install.d/15-reddwarf-dep @@ -10,4 +10,4 @@ yum install -y python-devel libxml2-devel libxslt-devel python-setuptools python python-routes python-eventlet python-webob python-kombu python-paste-deploy python-paste python-netaddr \ python-httplib2 python-iso8601 python-pexpect MySQL-python python-migrate python-pip python-anyjson gcc -pip-python install extras oslo.config>=1.2.0 python-novaclient python-swiftclient python-cinderclient kombu>2.4.7 six babel python-heatclient passlib jinja2 oslo.messaging>=1.3.0 +pip-python install extras oslo.config>=1.2.0 python-novaclient python-swiftclient python-cinderclient kombu>2.4.7 six babel python-heatclient passlib jinja2 oslo.messaging>=1.3.0 python-neutronclient diff --git a/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep b/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep index 368d10eb..96c4751e 100755 --- a/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep +++ b/scripts/files/elements/ubuntu-guest/install.d/15-reddwarf-dep @@ -11,4 +11,4 @@ apt-get -y install python-dev libxml2-dev libxslt1-dev python-setuptools python- python-routes python-eventlet python-webob python-pastedeploy python-paste python-netaddr \ python-httplib2 python-iso8601 python-pexpect python-mysqldb python-migrate -pip install extras oslo.config>=1.2.0 python-novaclient python-swiftclient python-cinderclient kombu>2.4.7 six babel python-heatclient passlib jinja2 oslo.messaging>=1.3.0 +pip install extras oslo.config>=1.2.0 python-novaclient python-swiftclient python-cinderclient kombu>2.4.7 six babel python-heatclient passlib jinja2 oslo.messaging>=1.3.0 python-neutronclient diff --git a/scripts/localrc.rc b/scripts/localrc.rc index c5adf04d..f5b1da5d 100644 --- a/scripts/localrc.rc +++ b/scripts/localrc.rc @@ -14,6 +14,10 @@ ENABLED_SERVICES+=,trove,tr-api,tr-tmgr,tr-cond ENABLED_SERVICES+=,s-proxy,s-object,s-container,s-account ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng ENABLED_SERVICES+=,-n-novnc,-n-xvnc +if [[ $ENABLE_NEUTRON = true ]]; then + ENABLED_SERVICES+=,neutron,q-svc,q-agt,q-dhcp,q-l3,q-meta + disable_service n-net +fi NOVNC_FROM_PACKAGE=false SWIFT_HASH=$SWIFT_HASH # Set Cinder Volume from Redstack so that later Redstack can help manage @@ -25,5 +29,5 @@ VOLUME_BACKING_FILE=${VOLUME_BACKING_FILE} # The lock_path is by default /opt/stack/nova; if this path is a shared # folder in VirtualBox things seem to break. We fix it by setting EXTRA_OPS # to force lock_path to /tmp. -EXTRA_OPTS=(lock_path=$USERHOME/nova_locks rescan_timeout=180 resizefs_timeout=240 force_dhcp_release=False host=`hostname`.`hostname --domain`) +EXTRA_OPTS=(lock_path=$USERHOME/nova_locks rescan_timeout=180 resizefs_timeout=240 force_dhcp_release=False) UNDO_REQUIREMENTS=False diff --git a/scripts/redstack b/scripts/redstack index 4d80aa79..fc025c73 100755 --- a/scripts/redstack +++ b/scripts/redstack @@ -32,10 +32,12 @@ function get_default_host_ip() { . $REDSTACK_SCRIPTS/reviews.rc # allow overrides from devstack if already set -[[ -f $PATH_DEVSTACK_SRC/localrc ]] && source $PATH_DEVSTACK_SRC/localrc +[[ -f $PATH_DEVSTACK_SRC/functions-common ]] && source $PATH_DEVSTACK_SRC/functions-common [[ -f $PATH_DEVSTACK_SRC/functions ]] && source $PATH_DEVSTACK_SRC/functions +[[ -f $PATH_DEVSTACK_SRC/localrc ]] && source $PATH_DEVSTACK_SRC/localrc # Public facing bits +[[ $ENABLE_NEUTRON = true ]] && BRIDGE_IP=172.24.4.1 || BRIDGE_IP=10.0.0.1 SERVICE_PROTOCOL=${SERVICE_PROTOCOL:-http} SERVICE_TENANT=${SERVICE_TENANT:-service} NETWORK_GATEWAY=${NETWORK_GATEWAY:-$BRIDGE_IP} @@ -392,6 +394,32 @@ function mod_confs() { sed -i "s/%demo_tenant_id%/$(get_attribute_id tenant demo 1)/g" $TROVE_CONF_DIR/test.conf sed -i "s/%admin_password%/$ADMIN_PASSWORD/g" $TROVE_CONF_DIR/test.conf + # Enable neutron tests if needed + sed -i "s/%neutron_enabled%/$ENABLE_NEUTRON/g" $TROVE_CONF_DIR/test.conf + + # If neutron is enabled, we create a shared network and write this info to the + # confs so that the integration tests can use it. + if [[ $ENABLE_NEUTRON = true ]]; then + # customer_network_id=$(neutron net-list | awk '/customer/ {print $2}') + # if [[ -z "$customer_network_id" ]]; then + # customer_network_id=$(neutron net-create customer | awk '/ id / {print $4}') + # customer_subnet_id=$(neutron subnet-create customer 10.0.1.0/24 --no-gateway | awk '/ id / {print $4}') + # fi + management_network_id=$(neutron net-list | awk '/private/ {print $2}') + management_subnet=$(neutron net-list | awk '/private/ {print $7}') + sed -i "s,%shared_network%,$management_network_id,g" $TROVE_CONF_DIR/test.conf + sed -i "s,%shared_network_subnet%,$management_subnet,g" $TROVE_CONF_DIR/test.conf + # sed -i "s,%private_network%,$customer_network_id,g" $TROVE_CONF_DIR/test.conf + # sed -i "s,%private_network_subnet%,10.0.1.0/24,g" $TROVE_CONF_DIR/test.conf + iniset $TROVE_CONF_DIR/trove.conf DEFAULT network_label_regex .* + iniset $TROVE_CONF_DIR/trove.conf DEFAULT ip_regex .* + iniset $TROVE_CONF_DIR/trove.conf DEFAULT black_list_regex ^10.0.1.* + iniset $TROVE_CONF_DIR/trove.conf DEFAULT default_neutron_networks $management_network_id + iniset $TROVE_CONF_DIR/trove.conf DEFAULT network_driver trove.network.neutron.NeutronDriver + iniset $TROVE_CONF_DIR/trove-taskmanager.conf DEFAULT network_driver trove.network.neutron.NeutronDriver + iniset $TROVE_CONF_DIR/trove-taskmanager.conf mysql tcp_ports 22,3306 + fi + # Create a conf for the guestagent based on the sample sudo install -b --mode 0664 $PATH_TROVE/etc/trove/trove-guestagent.conf.sample $TROVE_CONF_DIR/trove-guestagent.conf sed -i "s/10.0.0.1/$NETWORK_GATEWAY/g" $TROVE_CONF_DIR/trove-guestagent.conf diff --git a/scripts/redstack.rc b/scripts/redstack.rc index c0ed016c..5a9caaff 100644 --- a/scripts/redstack.rc +++ b/scripts/redstack.rc @@ -5,6 +5,9 @@ [ -z $PATH_DEVSTACK_SRC ] && PATH_DEVSTACK_SRC=~/devstack [ -z $TROVE_CONF_DIR ] && TROVE_CONF_DIR=/etc/trove +# Enable neutron instead of nova-network +[ -z $ENABLE_NEUTRON ] && ENABLE_NEUTRON=false + # Paths for various OpenStack components PATH_DEVSTACK_OUTPUT=$DEST PATH_NOVA=$DEST/nova diff --git a/tests/integration/int_tests.py b/tests/integration/int_tests.py index 3e7b44a6..3ed20589 100644 --- a/tests/integration/int_tests.py +++ b/tests/integration/int_tests.py @@ -183,6 +183,7 @@ def import_tests(): instances.GROUP_STOP, versions.GROUP, "dbaas.guest.start.test", + "dbaas.neutron", ] proboscis.register(groups=["blackbox", "mysql"], depends_on_groups=black_box_groups) @@ -361,4 +362,3 @@ def run_main(test_importer): if __name__ == "__main__": run_main(import_tests) - diff --git a/tests/integration/tests/initialize.py b/tests/integration/tests/initialize.py index 907ddfa7..ddd5aa86 100644 --- a/tests/integration/tests/initialize.py +++ b/tests/integration/tests/initialize.py @@ -31,6 +31,9 @@ FAKE = CONFIG.fake_mode START_SERVICES = (not FAKE) and CONFIG.values.get('start_services', False) +START_NOVA_NETWORK = (START_SERVICES and + not CONFIG.values.get('neutron_enabled', + False)) KEYSTONE_ALL = CONFIG.values.get('keystone_use_combined', True) USE_NOVA_VOLUME = CONFIG.values.get('use_nova_volume', False) @@ -111,7 +114,7 @@ def start_glance_api(): @test(groups=["services.initialize"], depends_on_classes=[start_glance_api], - enabled=START_SERVICES) + enabled=START_NOVA_NETWORK) def start_nova_network(): """Starts the Nova Network Service.""" Daemon(service_path_root="usr_bin_dir", @@ -128,8 +131,9 @@ def start_scheduler(): extra_cmds=['--config-file='], conf_file_name="nova_conf").run() + @test(groups=["services.initialize"], - depends_on_classes=[start_glance_api, start_nova_network], + depends_on_classes=[start_glance_api], enabled=START_SERVICES) def start_compute(): """Starts the Nova Compute Service."""