diff --git a/devstack/local.conf.sample b/devstack/local.conf.sample index fa470ae..0204498 100644 --- a/devstack/local.conf.sample +++ b/devstack/local.conf.sample @@ -15,41 +15,13 @@ RABBIT_PASSWORD=password SERVICE_PASSWORD=password SERVICE_TOKEN=password ADMIN_PASSWORD=password -LOGFILE=/opt/stack/logs/stack.sh.log -VERBOSE=True -LOG_COLOR=True -SCREEN_LOGDIR=/opt/stack/logs -FIXED_RANGE=10.0.0.0/24 -NETWORK_GATEWAY=10.0.0.1 -FIXED_NETWORK_SIZE=256 -FLOATING_RANGE=10.100.100.160/24 -Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192 -NEUTRON_CREATE_INITIAL_NETWORKS=False -PUBLIC_NETWORK_GATEWAY=10.100.100.3 -Q_USE_SECGROUP=False -LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver # Enable Trio2o -Q_ENABLE_TRIO2O=True +TRIO2O_START_SERVICES=True enable_plugin trio2o https://github.com/openstack/trio2o/ # Change the HOST_IP address to the host's IP address where # the Trio2o is running HOST_IP=162.3.124.203 -# Use Neutron instead of nova-network -disable_service n-net -enable_service q-svc -enable_service q-dhcp -enable_service q-agt - -disable_service n-obj -disable_service n-cauth -disable_service n-novnc -disable_service q-l3 -enable_service c-api -enable_service c-vol -enable_service c-sch -disable_service c-bak -disable_service tempest disable_service horizon diff --git a/devstack/local.conf.sample2 b/devstack/local.conf.sample2 index 67beb6c..077541d 100644 --- a/devstack/local.conf.sample2 +++ b/devstack/local.conf.sample2 @@ -15,27 +15,13 @@ [[local|localrc]] -RECLONE=no - DATABASE_PASSWORD=password RABBIT_PASSWORD=password SERVICE_PASSWORD=password SERVICE_TOKEN=password ADMIN_PASSWORD=password -LOGFILE=/opt/stack/logs/stack.sh.log -VERBOSE=True -LOG_COLOR=True -SCREEN_LOGDIR=/opt/stack/logs -FIXED_RANGE=10.0.0.0/24 -NETWORK_GATEWAY=10.0.0.1 -FIXED_NETWORK_SIZE=256 -FLOATING_RANGE=10.100.100.160/24 -Q_FLOATING_ALLOCATION_POOL=start=10.100.100.160,end=10.100.100.192 -PUBLIC_NETWORK_GATEWAY=10.100.100.3 -Q_USE_SECGROUP=False -LIBVIRT_FIREWALL_DRIVER=nova.virt.firewall.NoopFirewallDriver + NEUTRON_CREATE_INITIAL_NETWORKS=False -Q_USE_PROVIDERNET_FOR_PUBLIC=True # the region name of this OpenStack instance, and it's also # the pod name in Trio2o @@ -56,21 +42,8 @@ KEYSTONE_AUTH_HOST=162.3.124.203 # Use the Glance which is located in RegionOne, where the Trio2o is # installed GLANCE_SERVICE_HOST=162.3.124.203 - -# Use Neutron instead of nova-network -disable_service n-net -enable_service q-svc -enable_service q-dhcp -enable_service q-agt -enable_service q-l3 - -enable_service c-api -enable_service c-vol -enable_service c-sch - -disable_service n-obj disable_service g-api disable_service g-reg -disable_service c-bak + disable_service tempest disable_service horizon diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 6beca2a..754d9ba 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -40,18 +40,16 @@ function create_nova_apigw_accounts { if [[ "$ENABLED_SERVICES" =~ "t-ngw" ]]; then create_service_user "nova_apigw" - if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then - local trio2o_nova_apigw=$(get_or_create_service "nova" \ - "compute" "Nova Compute Service") + local trio2o_nova_apigw=$(get_or_create_service "nova" \ + "compute" "Nova Compute Service") - remove_old_endpoint_conf $trio2o_nova_apigw + remove_old_endpoint_conf $trio2o_nova_apigw - get_or_create_endpoint $trio2o_nova_apigw \ - "$REGION_NAME" \ - "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \ - "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \ - "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' - fi + get_or_create_endpoint $trio2o_nova_apigw \ + "$REGION_NAME" \ + "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \ + "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' \ + "$SERVICE_PROTOCOL://$TRIO2O_NOVA_APIGW_HOST:$TRIO2O_NOVA_APIGW_PORT/v2.1/"'$(tenant_id)s' fi } @@ -66,18 +64,16 @@ function create_cinder_apigw_accounts { if [[ "$ENABLED_SERVICES" =~ "t-cgw" ]]; then create_service_user "cinder_apigw" - if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then - local trio2o_cinder_apigw=$(get_or_create_service "cinder" \ - "volumev2" "Cinder Volume Service") + local trio2o_cinder_apigw=$(get_or_create_service "cinder" \ + "volumev2" "Cinder Volume Service") - remove_old_endpoint_conf $trio2o_cinder_apigw + remove_old_endpoint_conf $trio2o_cinder_apigw - get_or_create_endpoint $trio2o_cinder_apigw \ - "$REGION_NAME" \ - "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' \ - "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' \ - "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' - fi + get_or_create_endpoint $trio2o_cinder_apigw \ + "$REGION_NAME" \ + "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' \ + "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' \ + "$SERVICE_PROTOCOL://$TRIO2O_CINDER_APIGW_HOST:$TRIO2O_CINDER_APIGW_PORT/v2/"'$(tenant_id)s' fi } @@ -210,6 +206,34 @@ function configure_trio2o_xjob { fi } +function reconfigure_nova { + + # Nova services are running, but we need to re-configure them to + # move them to bottom region + iniset $NOVA_CONF neutron region_name $POD_REGION_NAME + iniset $NOVA_CONF neutron url "$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT" + iniset $NOVA_CONF cinder os_region_name $POD_REGION_NAME + + iniset $NOVA_CONF DEFAULT vif_plugging_is_fatal False + iniset $NOVA_CONF DEFAULT vif_plugging_timeout 60 + + get_or_create_endpoint "compute" \ + "$POD_REGION_NAME" \ + "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \ + "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \ + "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' + + stop_process n-api + stop_process n-cpu + # remove previous failure flag file since we are going to restart service + rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-api.failure + rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-cpu.failure + sleep 20 + run_process n-api "$NOVA_BIN_DIR/nova-api" + run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF" $LIBVIRT_GROUP + +} + function move_neutron_server { local region_name=$1 @@ -231,107 +255,86 @@ function move_neutron_server { run_process q-svc "$NEUTRON_BIN_DIR/neutron-server --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" } -if [[ "$Q_ENABLE_TRIO2O" == "True" ]]; then - if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then - echo summary "Trio2o pre-install" - elif [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing Trio2o" - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - echo_summary "Configuring Trio2o" - export NEUTRON_CREATE_INITIAL_NETWORKS=False - sudo install -d -o $STACK_USER -m 755 $TRIO2O_CONF_DIR +if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then + echo summary "Trio2o pre-install" +elif [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing Trio2o" +elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then + echo_summary "Configuring Trio2o" - enable_service t-api t-job t-ngw t-cgw + export NEUTRON_CREATE_INITIAL_NETWORKS=False + export DEFAULT_INSTANCE_TYPE=m1.tiny - configure_trio2o_api - configure_trio2o_nova_apigw - configure_trio2o_cinder_apigw - configure_trio2o_xjob + sudo install -d -o $STACK_USER -m 755 $TRIO2O_CONF_DIR - echo export PYTHONPATH=\$PYTHONPATH:$TRIO2O_DIR >> $RC_DIR/.localrc.auto + enable_service t-api t-job t-ngw t-cgw - setup_package $TRIO2O_DIR -e + configure_trio2o_api + configure_trio2o_nova_apigw + configure_trio2o_cinder_apigw + configure_trio2o_xjob - recreate_database trio2o - python "$TRIO2O_DIR/cmd/manage.py" "$TRIO2O_API_CONF" + echo export PYTHONPATH=\$PYTHONPATH:$TRIO2O_DIR >> $RC_DIR/.localrc.auto - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - echo_summary "Initializing Trio2o Service" + setup_package $TRIO2O_DIR -e - if is_service_enabled t-api; then + recreate_database trio2o + python "$TRIO2O_DIR/cmd/manage.py" "$TRIO2O_API_CONF" - create_trio2o_accounts +elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + echo_summary "Initializing Trio2o Service" - run_process t-api "python $TRIO2O_API --config-file $TRIO2O_API_CONF" - fi + if is_service_enabled t-api; then - if is_service_enabled t-ngw; then + create_trio2o_accounts - create_nova_apigw_accounts - - run_process t-ngw "python $TRIO2O_NOVA_APIGW --config-file $TRIO2O_NOVA_APIGW_CONF" - - # Nova services are running, but we need to re-configure them to - # move them to bottom region - iniset $NOVA_CONF neutron region_name $POD_REGION_NAME - iniset $NOVA_CONF neutron url "$Q_PROTOCOL://$SERVICE_HOST:$Q_PORT" - iniset $NOVA_CONF cinder os_region_name $POD_REGION_NAME - - get_or_create_endpoint "compute" \ - "$POD_REGION_NAME" \ - "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \ - "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' \ - "$NOVA_SERVICE_PROTOCOL://$NOVA_SERVICE_HOST:$NOVA_SERVICE_PORT/v2.1/"'$(tenant_id)s' - - stop_process n-api - stop_process n-cpu - # remove previous failure flag file since we are going to restart service - rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-api.failure - rm -f "$SERVICE_DIR/$SCREEN_NAME"/n-cpu.failure - sleep 20 - run_process n-api "$NOVA_BIN_DIR/nova-api" - run_process n-cpu "$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF" $LIBVIRT_GROUP - fi - - if is_service_enabled q-svc; then - move_neutron_server $POD_REGION_NAME - fi - - if is_service_enabled t-cgw; then - - create_cinder_apigw_accounts - - run_process t-cgw "python $TRIO2O_CINDER_APIGW --config-file $TRIO2O_CINDER_APIGW_CONF" - - get_or_create_endpoint "volumev2" \ - "$POD_REGION_NAME" \ - "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' \ - "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' \ - "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' - fi - - if is_service_enabled t-job; then - - run_process t-job "python $TRIO2O_XJOB --config-file $TRIO2O_XJOB_CONF" - fi + run_process t-api "python $TRIO2O_API --config-file $TRIO2O_API_CONF" fi - if [[ "$1" == "unstack" ]]; then + if is_service_enabled t-ngw; then - if is_service_enabled t-api; then - stop_process t-api - fi + create_nova_apigw_accounts - if is_service_enabled t-ngw; then - stop_process t-ngw - fi + run_process t-ngw "python $TRIO2O_NOVA_APIGW --config-file $TRIO2O_NOVA_APIGW_CONF" - if is_service_enabled t-cgw; then - stop_process t-cgw - fi + reconfigure_nova - if is_service_enabled t-job; then - stop_process t-job - fi + fi + + if is_service_enabled t-cgw; then + + create_cinder_apigw_accounts + + run_process t-cgw "python $TRIO2O_CINDER_APIGW --config-file $TRIO2O_CINDER_APIGW_CONF" + + get_or_create_endpoint "volumev2" \ + "$POD_REGION_NAME" \ + "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' \ + "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' \ + "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/"'$(tenant_id)s' + fi + + if is_service_enabled t-job; then + + run_process t-job "python $TRIO2O_XJOB --config-file $TRIO2O_XJOB_CONF" + fi +fi + +if [[ "$1" == "unstack" ]]; then + + if is_service_enabled t-api; then + stop_process t-api + fi + + if is_service_enabled t-ngw; then + stop_process t-ngw + fi + + if is_service_enabled t-cgw; then + stop_process t-cgw + fi + + if is_service_enabled t-job; then + stop_process t-job fi fi diff --git a/devstack/settings b/devstack/settings index d18d7f0..f3d9ea5 100644 --- a/devstack/settings +++ b/devstack/settings @@ -7,6 +7,7 @@ TRIO2O_BRANCH=${TRIO2O_BRANCH:-master} POD_REGION_NAME=${POD_REGION_NAME:-Pod1} TRIO2O_CONF_DIR=${TRIO2O_CONF_DIR:-/etc/trio2o} TRIO2O_STATE_PATH=${TRIO2O_STATE_PATH:-/var/lib/trio2o} +TRIO2O_START_SERVICES=${TRIO2O_START_SERVICES:-True} # trio2o rest admin api TRIO2O_API=$TRIO2O_DIR/cmd/api.py @@ -14,7 +15,7 @@ TRIO2O_API_CONF=$TRIO2O_CONF_DIR/api.conf TRIO2O_API_LISTEN_ADDRESS=${TRIO2O_API_LISTEN_ADDRESS:-0.0.0.0} TRIO2O_API_HOST=${TRIO2O_API_HOST:-$SERVICE_HOST} -TRIO2O_API_PORT=${TRIO2O_API_PORT:-19999} +TRIO2O_API_PORT=${TRIO2O_API_PORT:-19996} TRIO2O_API_PROTOCOL=${TRIO2O_API_PROTOCOL:-$SERVICE_PROTOCOL} # trio2o nova_apigw diff --git a/doc/source/api_v1.rst b/doc/source/api_v1.rst index fa6c01c..fc8efb9 100644 --- a/doc/source/api_v1.rst +++ b/doc/source/api_v1.rst @@ -25,8 +25,8 @@ the OpenStack Identity service. They also require a base service url that can be got from the OpenStack Trio2o endpoint. This will be the root url that every call below will be added to build a full path. -For instance, if the Trio2o service url is http://127.0.0.1:19999/v1.0 then -the full API call for /pods is http://127.0.0.1:19999/v1.0/pods. +For instance, if the Trio2o service url is http://127.0.0.1:19996/v1.0 then +the full API call for /pods is http://127.0.0.1:19996/v1.0/pods. As such, for the rest of this document we will leave out the root url where GET /pods really means GET {trio2o_service_url}/pods. diff --git a/doc/source/installation.rst b/doc/source/installation.rst index 8a120b2..de33db5 100644 --- a/doc/source/installation.rst +++ b/doc/source/installation.rst @@ -72,20 +72,20 @@ installing DevStack in virtual machine. availability zone and OpenStack instances, the "$token" is obtained in the step 7:: - curl -X POST http://127.0.0.1:19999/v1.0/pods -H "Content-Type: application/json" \ + curl -X POST http://127.0.0.1:19996/v1.0/pods -H "Content-Type: application/json" \ -H "X-Auth-Token: $token" -d '{"pod": {"pod_name": "RegionOne"}}' - curl -X POST http://127.0.0.1:19999/v1.0/pods -H "Content-Type: application/json" \ + curl -X POST http://127.0.0.1:19996/v1.0/pods -H "Content-Type: application/json" \ -H "X-Auth-Token: $token" -d '{"pod": {"pod_name": "Pod1", "az_name": "az1"}}' Pay attention to "pod_name" parameter we specify when creating pod. Pod name should exactly match the region name registered in Keystone. In the above commands, we create pods named "RegionOne" and "Pod1". -- 10 Create necessary resources in local Neutron server:: +- 10 Create necessary resources in Neutron server:: - neutron --os-region-name=Pod1 net-create net1 - neutron --os-region-name=Pod1 subnet-create net1 10.0.0.0/24 + neutron --os-region-name=RegionOne net-create net1 + neutron --os-region-name=RegionOne subnet-create net1 10.0.0.0/24 Please note that the net1 ID will be used in later step to boot VM. @@ -101,8 +101,9 @@ installing DevStack in virtual machine. - 13 Verify the VM is connected to the net1:: - neutron --os-region-name=Pod1 port-list nova --os-region-name=RegionOne list + nova --os-region-name=Pod1 list + neutron --os-region-name=RegionOne port-list - 14 Create, list, show and delete volume:: @@ -223,7 +224,7 @@ Add another pod to Trio2o with DevStack availability zone and OpenStack instances, the "$token" is obtained in the step 11:: - curl -X POST http://127.0.0.1:19999/v1.0/pods -H "Content-Type: application/json" \ + curl -X POST http://127.0.0.1:19996/v1.0/pods -H "Content-Type: application/json" \ -H "X-Auth-Token: $token" -d '{"pod": {"pod_name": "Pod2", "az_name": "az2"}}' Pay attention to "pod_name" parameter we specify when creating pod. Pod name diff --git a/requirements.txt b/requirements.txt index bf6381f..18a94d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,14 +11,12 @@ Routes!=2.0,!=2.3.0,>=1.12.3;python_version!='2.7' # MIT debtcollector>=1.2.0 # Apache-2.0 eventlet!=0.18.3,>=0.18.2 # MIT pecan!=1.0.2,!=1.0.3,!=1.0.4,!=1.2,>=1.0.0 # BSD -greenlet>=0.3.2 # MIT -httplib2>=0.7.5 # MIT requests!=2.12.2,>=2.10.0 # Apache-2.0 -Jinja2>=2.8 # BSD License (3 clause) +Jinja2!=2.9.0,!=2.9.1,!=2.9.2,!=2.9.3,!=2.9.4,>=2.8 # BSD License (3 clause) keystonemiddleware>=4.12.0 # Apache-2.0 netaddr!=0.7.16,>=0.7.13 # BSD netifaces>=0.10.4 # MIT -neutron-lib>=1.0.0 # Apache-2.0 +neutron-lib>=1.1.0 # Apache-2.0 retrying!=1.3.0,>=1.2.3 # Apache-2.0 SQLAlchemy<1.1.0,>=1.0.10 # MIT WebOb>=1.6.0 # MIT @@ -26,14 +24,14 @@ python-cinderclient!=1.7.0,!=1.7.1,>=1.6.0 # Apache-2.0 python-glanceclient>=2.5.0 # Apache-2.0 python-keystoneclient>=3.8.0 # Apache-2.0 python-neutronclient>=5.1.0 # Apache-2.0 -python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0 -alembic>=0.8.4 # MIT +python-novaclient!=7.0.0,>=6.0.0 # Apache-2.0 +alembic>=0.8.10 # MIT six>=1.9.0 # MIT stevedore>=1.17.1 # Apache-2.0 oslo.concurrency>=3.8.0 # Apache-2.0 oslo.config!=3.18.0,>=3.14.0 # Apache-2.0 oslo.context>=2.9.0 # Apache-2.0 -oslo.db!=4.13.1,!=4.13.2,>=4.11.0 # Apache-2.0 +oslo.db>=4.15.0 # Apache-2.0 oslo.i18n>=2.1.0 # Apache-2.0 oslo.log>=3.11.0 # Apache-2.0 oslo.messaging>=5.14.0 # Apache-2.0 @@ -45,4 +43,3 @@ oslo.service>=1.10.0 # Apache-2.0 oslo.utils>=3.18.0 # Apache-2.0 oslo.versionedobjects>=1.17.0 # Apache-2.0 sqlalchemy-migrate>=0.9.6 # Apache-2.0 -kombu!=4.0.0,!=4.0.1,!=4.0.2,>=3.0.25 # BSD diff --git a/test-requirements.txt b/test-requirements.txt index 4d6b1bf..64fc150 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,23 +3,20 @@ # process, which may cause wedges in the gate later. hacking<0.11,>=0.10.2 -cliff>=2.3.0 # Apache-2.0 coverage>=4.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0 # BSD python-subunit>=0.0.18 # Apache-2.0/BSD requests-mock>=1.1 # Apache-2.0 +docutils!=0.13.1,>=0.11 # OSI-Approved Open Source, Public Domain sphinx!=1.3b1,<1.4,>=1.2.1 # BSD oslosphinx>=4.7.0 # Apache-2.0 testrepository>=0.0.18 # Apache-2.0/BSD testtools>=1.4.0 # MIT testresources>=0.2.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD -WebTest>=2.0 # MIT oslotest>=1.10.0 # Apache-2.0 os-testr>=0.8.0 # Apache-2.0 tempest-lib>=0.14.0 # Apache-2.0 ddt>=1.0.1 # MIT -pylint==1.4.5 # GPLv2 -docutils>=0.11,!=0.13.1 # OSI-Approved Open Source, Public Domain - +reno>=1.8.0 # Apache-2.0 diff --git a/tox.ini b/tox.ini index e62efbb..aad5f85 100644 --- a/tox.ini +++ b/tox.ini @@ -1,45 +1,57 @@ [tox] minversion = 1.6 -envlist = py34,py27,pypy,pep8 +envlist = py35,py27,pypy,pep8 skipsdist = True [testenv] sitepackages = True usedevelop = True -install_command = pip install -U --force-reinstall {opts} {packages} +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning TRIO2O_TEST_DIRECTORY=trio2o/tests deps = -r{toxinidir}/test-requirements.txt -commands = python setup.py testr --slowest --testr-args='{posargs}' +commands = python setup.py testr --slowest --testr-args='{posargs}' whitelist_externals = rm +[testenv:releasenotes] +commands = sphinx-build -a -W -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html + [testenv:pep8] +deps = + -r{toxinidir}/test-requirements.txt commands = flake8 [testenv:venv] commands = {posargs} [testenv:cover] -commands = python setup.py testr --coverage --testr-args='{posargs}' +commands = + python setup.py testr --coverage --testr-args='{posargs}' + coverage report [testenv:genconfig] +deps = + -r{toxinidir}/test-requirements.txt commands = oslo-config-generator --config-file=etc/api-cfg-gen.conf oslo-config-generator --config-file=etc/nova_apigw-cfg-gen.conf oslo-config-generator --config-file=etc/cinder_apigw-cfg-gen.conf oslo-config-generator --config-file=etc/xjob-cfg-gen.conf [testenv:docs] +deps = + -r{toxinidir}/test-requirements.txt commands = python setup.py build_sphinx [testenv:debug] commands = oslo_debug_helper {posargs} [flake8] - show-source = True - builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build + +[hacking] +import_exceptions = trio2o.common.i18n diff --git a/trio2o/api/app.py b/trio2o/api/app.py index a4cc848..4f43bb8 100644 --- a/trio2o/api/app.py +++ b/trio2o/api/app.py @@ -24,7 +24,7 @@ from trio2o.common import restapp common_opts = [ cfg.IPOpt('bind_host', default='0.0.0.0', help=_("The host IP to bind to")), - cfg.PortOpt('bind_port', default=19999, + cfg.PortOpt('bind_port', default=19996, help=_("The port to bind to")), cfg.IntOpt('api_workers', default=1, help=_("number of api workers")), diff --git a/trio2o/common/resource_handle.py b/trio2o/common/resource_handle.py index 5e8055a..299b781 100644 --- a/trio2o/common/resource_handle.py +++ b/trio2o/common/resource_handle.py @@ -215,12 +215,14 @@ class NovaResourceHandle(ResourceHandle): 'server_volume': ACTION} def _get_client(self, cxt): + url = self.endpoint_url.replace('$(tenant_id)s', cxt.tenant) cli = n_client.Client(api_versions.APIVersion(cxt.nova_micro_version), auth_token=cxt.auth_token, auth_url=self.auth_url, + project_name=cxt.tenant_name, + project_domain_name=cxt.project_domain, + endpoint_override=url, timeout=cfg.CONF.client.nova_timeout) - cli.set_management_url( - self.endpoint_url.replace('$(tenant_id)s', cxt.tenant)) return cli def _adapt_resource(self, resource): diff --git a/trio2o/tempestplugin/post_test_hook.sh b/trio2o/tempestplugin/post_test_hook.sh index 8a75c97..402b87e 100755 --- a/trio2o/tempestplugin/post_test_hook.sh +++ b/trio2o/tempestplugin/post_test_hook.sh @@ -25,16 +25,19 @@ export TEMPEST_CONF=$TEMPEST_DIR/etc/tempest.conf # use admin role to create Trio2o top Pod and Pod1 source $DEVSTACK_DIR/openrc admin admin -token=$(openstack token issue | awk 'NR==5 {print $4}') -echo $token +# unset OS_REGION_NAME -curl -X POST http://127.0.0.1:19999/v1.0/pods \ - -H "Content-Type: application/json" \ - -H "X-Auth-Token: $token" -d '{"pod": {"pod_name": "RegionOne"}}' +# mytoken=$(openstack --os-region-name=RegionOne token issue -f value -c id) +mytoken=$(openstack token issue -f value -c id) +echo $mytoken -curl -X POST http://127.0.0.1:19999/v1.0/pods \ +curl -X POST http://127.0.0.1:19996/v1.0/pods \ -H "Content-Type: application/json" \ - -H "X-Auth-Token: $token" \ + -H "X-Auth-Token: $mytoken" -d '{"pod": {"pod_name": "RegionOne"}}' + +curl -X POST http://127.0.0.1:19996/v1.0/pods \ + -H "Content-Type: application/json" \ + -H "X-Auth-Token: $mytoken" \ -d '{"pod": {"pod_name": "Pod1", "az_name": "az1"}}' # the usage of "nova flavor-create": @@ -43,8 +46,10 @@ curl -X POST http://127.0.0.1:19999/v1.0/pods \ # # the following command is to create a flavor wih name='test', # id=1, ram=1024MB, disk=10GB, vcpu=1 +# nova --os-region-name=RegionOne flavor-create test 1 1024 10 1 +# image_id=$(glance --os-region-name=RegionOne image-list | awk 'NR==4 {print $2}') nova flavor-create test 1 1024 10 1 -image_id=$(openstack image list | awk 'NR==4 {print $2}') +image_id=$(glance image-list | awk 'NR==4 {print $2}') # preparation for the tests cd $TEMPEST_DIR @@ -65,8 +70,10 @@ source $DEVSTACK_DIR/functions iniset $TEMPEST_CONF auth admin_username ${ADMIN_USERNAME:-"admin"} iniset $TEMPEST_CONF auth admin_project_name admin iniset $TEMPEST_CONF auth admin_password $OS_PASSWORD -iniset $TEMPEST_CONF identity uri $OS_AUTH_URL -iniset $TEMPEST_CONF identity-feature-enabled api_v3 false +iniset $TEMPEST_CONF identity auth_version v2 +iniset $TEMPEST_CONF identity uri_v3 http://$SERVICE_HOST/identity/v3 +iniset $TEMPEST_CONF identity uri http://$SERVICE_HOST:5000/v2.0/ +iniset $TEMPEST_CONF identity-feature-enabled api_v2 True iniset $TEMPEST_CONF compute region RegionOne iniset $TEMPEST_CONF compute image_ref $image_id diff --git a/trio2o/tests/functional/nova_apigw/controllers/test_microversion.py b/trio2o/tests/functional/nova_apigw/controllers/test_microversion.py index 61f3a23..ce62560 100644 --- a/trio2o/tests/functional/nova_apigw/controllers/test_microversion.py +++ b/trio2o/tests/functional/nova_apigw/controllers/test_microversion.py @@ -227,8 +227,9 @@ class MicroversionsTest(MicroVersionFunctionTest): api_version=api_versions.APIVersion( constants.NOVA_APIGW_MIN_VERSION), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -241,8 +242,9 @@ class MicroversionsTest(MicroVersionFunctionTest): mock_client.assert_called_with( api_version=api_versions.APIVersion(self.vaild_version.split()[1]), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -255,8 +257,9 @@ class MicroversionsTest(MicroVersionFunctionTest): mock_client.assert_called_with( api_version=api_versions.APIVersion(self.vaild_leagcy_version), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -270,8 +273,9 @@ class MicroversionsTest(MicroVersionFunctionTest): api_version=api_versions.APIVersion( constants.NOVA_APIGW_MAX_VERSION), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -284,8 +288,9 @@ class MicroversionsTest(MicroVersionFunctionTest): mock_client.assert_called_with( api_version=api_versions.APIVersion(self.min_version), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -298,8 +303,9 @@ class MicroversionsTest(MicroVersionFunctionTest): mock_client.assert_called_with( api_version=api_versions.APIVersion(self.max_version.split()[1]), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None, ) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client) @@ -413,8 +419,9 @@ class MicroversionsTest(MicroVersionFunctionTest): mock_client.assert_called_with( api_version=api_versions.APIVersion(self.vaild_version.split()[1]), auth_token=None, auth_url='auth_url', - direct_use=False, project_id=None, - timeout=60, username=None, api_key=None) + direct_use=False, project_name=None, + endpoint_override='endpoint_url', project_domain_name=None, + timeout=60, username=None) @mock.patch.object(server.ServerController, '_get_client', new=get_trio2o_client)