Merge "Add variable SWIFT_STORAGE_IPS"
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index f3eda01..3e380f3 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -423,8 +423,8 @@
----------
``IP_VERSION`` can be used to configure DevStack to create either an
-IPv4, IPv6, or dual-stack tenant data-network by with either
-``IP_VERSION=4``, ``IP_VERSION=6``, or ``IP_VERSION=4+6``
+IPv4, IPv6, or dual-stack self service project data-network by with
+either ``IP_VERSION=4``, ``IP_VERSION=6``, or ``IP_VERSION=4+6``
respectively. This functionality requires that the Neutron networking
service is enabled by setting the following options:
diff --git a/doc/source/guides/neutron.rst b/doc/source/guides/neutron.rst
index 6ac3993..a834314 100644
--- a/doc/source/guides/neutron.rst
+++ b/doc/source/guides/neutron.rst
@@ -15,8 +15,8 @@
network interface that is available. In this scenario, the physical
interface is added to the Open vSwitch bridge, and the IP address of
the laptop is migrated onto the bridge interface. That way, the
-physical interface can be used to transmit tenant network traffic,
-the OpenStack API traffic, and management traffic.
+physical interface can be used to transmit self service project
+network traffic, the OpenStack API traffic, and management traffic.
.. warning::
@@ -222,12 +222,12 @@
which is used as the "integration bridge" where ports are created, and
plugged into the virtual switching fabric. `br-ex` is an OVS bridge
that is used to connect physical ports (like `eth0`), so that floating
-IP traffic for tenants can be received from the physical network
-infrastructure (and the internet), and routed to tenant network ports.
-`br-tun` is a tunnel bridge that is used to connect OpenStack nodes
-(like `devstack-2`) together. This bridge is used so that tenant
-network traffic, using the VXLAN tunneling protocol, flows between
-each compute node where tenant instances run.
+IP traffic for project networks can be received from the physical
+network infrastructure (and the internet), and routed to self service
+project network ports. `br-tun` is a tunnel bridge that is used to
+connect OpenStack nodes (like `devstack-2`) together. This bridge is
+used so that project network traffic, using the VXLAN tunneling
+protocol, flows between each compute node where project instances run.
@@ -381,8 +381,8 @@
## Neutron options
Q_USE_SECGROUP=True
- ENABLE_TENANT_VLANS=True
- TENANT_VLAN_RANGE=3001:4000
+ ENABLE_PROJECT_VLANS=True
+ PROJECT_VLAN_RANGE=3001:4000
PHYSICAL_NETWORK=default
OVS_PHYSICAL_BRIDGE=br-ex
@@ -553,4 +553,3 @@
LB_PHYSICAL_INTERFACE=eth0
PUBLIC_PHYSICAL_NETWORK=default
LB_INTERFACE_MAPPINGS=default:eth0
-
diff --git a/doc/source/openrc.rst b/doc/source/openrc.rst
index 4e7f075..d28b568 100644
--- a/doc/source/openrc.rst
+++ b/doc/source/openrc.rst
@@ -51,7 +51,7 @@
OS\_AUTH\_URL
Authenticating against an OpenStack cloud using Keystone returns a
*Token* and *Service Catalog*. The catalog contains the endpoints
- for all services the user/tenant has access to - including Nova,
+ for all services the user/project has access to - including Nova,
Glance, Keystone and Swift.
::
diff --git a/driver_certs/cinder_driver_cert.sh b/driver_certs/cinder_driver_cert.sh
deleted file mode 100755
index d066e06..0000000
--- a/driver_certs/cinder_driver_cert.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/usr/bin/env bash
-
-# **cinder_cert.sh**
-
-# This script is a simple wrapper around the tempest volume api tests
-# It requires that you have a working and functional devstack install
-# and that you've enabled your device driver by making the necessary
-# modifications to /etc/cinder/cinder.conf
-
-# This script will refresh your openstack repo's and restart the cinder
-# services to pick up your driver changes.
-# please NOTE; this script assumes your devstack install is functional
-# and includes tempest. A good first step is to make sure you can
-# create volumes on your device before you even try and run this script.
-
-# It also assumes default install location (/opt/stack/xxx)
-# to aid in debug, you should also verify that you've added
-# an output directory for screen logs:
-#
-# SCREEN_LOGDIR=/opt/stack/screen-logs
-
-set -o pipefail
-
-CERT_DIR=$(cd $(dirname "$0") && pwd)
-TOP_DIR=$(cd $CERT_DIR/..; pwd)
-
-source $TOP_DIR/functions
-source $TOP_DIR/stackrc
-source $TOP_DIR/openrc
-source $TOP_DIR/lib/infra
-source $TOP_DIR/lib/tempest
-source $TOP_DIR/lib/cinder
-
-TEMPFILE=`mktemp`
-RECLONE=True
-
-function log_message {
- MESSAGE=$1
- STEP_HEADER=$2
- if [[ "$STEP_HEADER" = "True" ]]; then
- echo -e "\n========================================================" | tee -a $TEMPFILE
- fi
- echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
- if [[ "$STEP_HEADER" = "True" ]]; then
- echo -e "========================================================" | tee -a $TEMPFILE
- fi
-}
-
-if [[ "$OFFLINE" = "True" ]]; then
- echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
- echo " Please set OFFLINE=False and retry."
- exit 1
-fi
-
-log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
-log_message "Output is being logged to: $TEMPFILE"
-
-cd $CINDER_DIR
-log_message "Cloning to ${CINDER_REPO}...", True
-install_cinder
-
-log_message "Pull a fresh Clone of cinder repo...", True
-git status | tee -a $TEMPFILE
-git log --pretty=oneline -n 1 | tee -a $TEMPFILE
-
-log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
-cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
-sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
-log_message "End of cinder.conf.", True
-
-cd $TOP_DIR
-# Verify tempest is installed/enabled
-if ! is_service_enabled tempest; then
- log_message "ERROR!!! Cert requires tempest in enabled_services!", True
- log_message" Please add tempest to enabled_services and retry."
- exit 1
-fi
-
-cd $TEMPEST_DIR
-install_tempest
-
-log_message "Verify tempest is current....", True
-git status | tee -a $TEMPFILE
-log_message "Check status and get latest commit..."
-git log --pretty=oneline -n 1 | tee -a $TEMPFILE
-
-
-#stop and restart cinder services
-log_message "Restart Cinder services...", True
-stop_cinder
-sleep 1
-start_cinder
-sleep 5
-
-# run tempest api/volume/test_*
-log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh volume)...", True
-./tools/pretty_tox.sh volume 2>&1 | tee -a $TEMPFILE
-if [[ $? = 0 ]]; then
- log_message "CONGRATULATIONS!!! Device driver PASSED!", True
- log_message "Submit output: ($TEMPFILE)"
- exit 0
-else
- log_message "SORRY!!! Device driver FAILED!", True
- log_message "Check output in $TEMPFILE"
- exit 1
-fi
diff --git a/functions-common b/functions-common
index b0352d3..0806681 100644
--- a/functions-common
+++ b/functions-common
@@ -380,7 +380,7 @@
DISTRO="sle${os_RELEASE%.*}"
elif [[ "$os_VENDOR" =~ (Red.*Hat) || \
"$os_VENDOR" =~ (CentOS) || \
- "$os_VENDOR" =~ (OracleLinux) || \
+ "$os_VENDOR" =~ (OracleServer) || \
"$os_VENDOR" =~ (Virtuozzo) ]]; then
# Drop the . release as we assume it's compatible
# XXX re-evaluate when we get RHEL10
@@ -427,7 +427,7 @@
GetOSVersion
fi
- [ "$os_VENDOR" = "OracleLinux" ]
+ [ "$os_VENDOR" = "OracleServer" ]
}
@@ -441,7 +441,7 @@
[ "$os_VENDOR" = "Fedora" ] || [ "$os_VENDOR" = "Red Hat" ] || \
[ "$os_VENDOR" = "RedHatEnterpriseServer" ] || \
- [ "$os_VENDOR" = "CentOS" ] || [ "$os_VENDOR" = "OracleLinux" ] || \
+ [ "$os_VENDOR" = "CentOS" ] || [ "$os_VENDOR" = "OracleServer" ] || \
[ "$os_VENDOR" = "Virtuozzo" ] || [ "$os_VENDOR" = "kvmibm" ]
}
diff --git a/lib/keystone b/lib/keystone
index f058114..b5c107c 100644
--- a/lib/keystone
+++ b/lib/keystone
@@ -106,9 +106,9 @@
# Bind hosts
KEYSTONE_ADMIN_BIND_HOST=${KEYSTONE_ADMIN_BIND_HOST:-$KEYSTONE_SERVICE_HOST}
-# Set the tenant for service accounts in Keystone
-SERVICE_TENANT_NAME=${SERVICE_TENANT_NAME:-service}
-SERVICE_PROJECT_NAME=${SERVICE_TENANT_NAME:-service}
+# Set the project for service accounts in Keystone
+SERVICE_PROJECT_NAME=${SERVICE_PROJECT_NAME:-service}
+SERVICE_TENANT_NAME=${SERVICE_PROJECT_NAME:-service}
# if we are running with SSL use https protocols
if is_ssl_enabled_service "key" || is_service_enabled tls-proxy; then
@@ -335,7 +335,7 @@
# create_keystone_accounts() - Sets up common required keystone accounts
-# Tenant User Roles
+# Project User Roles
# ------------------------------------------------------------------
# admin admin admin
# service -- --
@@ -348,7 +348,7 @@
# alt_demo alt_demo Member, anotherrole
# invisible_to_admin demo Member
-# Group Users Roles Tenant
+# Group Users Roles Project
# ------------------------------------------------------------------
# admins admin admin admin
# nonadmins demo, alt_demo Member, anotherrole demo, alt_demo
@@ -360,8 +360,8 @@
# The keystone bootstrapping process (performed via keystone-manage bootstrap)
# creates an admin user, admin role and admin project. As a sanity check
# we exercise the CLI to retrieve the IDs for these values.
- local admin_tenant
- admin_tenant=$(openstack project show "admin" -f value -c id)
+ local admin_project
+ admin_project=$(openstack project show "admin" -f value -c id)
local admin_user
admin_user=$(openstack user show "admin" -f value -c id)
local admin_role
@@ -376,8 +376,8 @@
get_or_create_role service
# The ResellerAdmin role is used by Nova and Ceilometer so we need to keep it.
- # The admin role in swift allows a user to act as an admin for their tenant,
- # but ResellerAdmin is needed for a user to act as any tenant. The name of this
+ # The admin role in swift allows a user to act as an admin for their project,
+ # but ResellerAdmin is needed for a user to act as any project. The name of this
# role is also configurable in swift-proxy.conf
get_or_create_role ResellerAdmin
@@ -390,32 +390,32 @@
local another_role
another_role=$(get_or_create_role "anotherrole")
- # invisible tenant - admin can't see this one
- local invis_tenant
- invis_tenant=$(get_or_create_project "invisible_to_admin" default)
+ # invisible project - admin can't see this one
+ local invis_project
+ invis_project=$(get_or_create_project "invisible_to_admin" default)
# demo
- local demo_tenant
- demo_tenant=$(get_or_create_project "demo" default)
+ local demo_project
+ demo_project=$(get_or_create_project "demo" default)
local demo_user
demo_user=$(get_or_create_user "demo" \
"$ADMIN_PASSWORD" "default" "demo@example.com")
- get_or_add_user_project_role $member_role $demo_user $demo_tenant
- get_or_add_user_project_role $admin_role $admin_user $demo_tenant
- get_or_add_user_project_role $another_role $demo_user $demo_tenant
- get_or_add_user_project_role $member_role $demo_user $invis_tenant
+ get_or_add_user_project_role $member_role $demo_user $demo_project
+ get_or_add_user_project_role $admin_role $admin_user $demo_project
+ get_or_add_user_project_role $another_role $demo_user $demo_project
+ get_or_add_user_project_role $member_role $demo_user $invis_project
# alt_demo
- local alt_demo_tenant
- alt_demo_tenant=$(get_or_create_project "alt_demo" default)
+ local alt_demo_project
+ alt_demo_project=$(get_or_create_project "alt_demo" default)
local alt_demo_user
alt_demo_user=$(get_or_create_user "alt_demo" \
"$ADMIN_PASSWORD" "default" "alt_demo@example.com")
- get_or_add_user_project_role $member_role $alt_demo_user $alt_demo_tenant
- get_or_add_user_project_role $admin_role $admin_user $alt_demo_tenant
- get_or_add_user_project_role $another_role $alt_demo_user $alt_demo_tenant
+ get_or_add_user_project_role $member_role $alt_demo_user $alt_demo_project
+ get_or_add_user_project_role $admin_role $admin_user $alt_demo_project
+ get_or_add_user_project_role $another_role $alt_demo_user $alt_demo_project
# groups
local admin_group
@@ -425,11 +425,11 @@
non_admin_group=$(get_or_create_group "nonadmins" \
"default" "non-admin group")
- get_or_add_group_project_role $member_role $non_admin_group $demo_tenant
- get_or_add_group_project_role $another_role $non_admin_group $demo_tenant
- get_or_add_group_project_role $member_role $non_admin_group $alt_demo_tenant
- get_or_add_group_project_role $another_role $non_admin_group $alt_demo_tenant
- get_or_add_group_project_role $admin_role $admin_group $admin_tenant
+ get_or_add_group_project_role $member_role $non_admin_group $demo_project
+ get_or_add_group_project_role $another_role $non_admin_group $demo_project
+ get_or_add_group_project_role $member_role $non_admin_group $alt_demo_project
+ get_or_add_group_project_role $another_role $non_admin_group $alt_demo_project
+ get_or_add_group_project_role $admin_role $admin_group $admin_project
}
# Create a user that is capable of verifying keystone tokens for use with auth_token middleware.
diff --git a/lib/neutron-legacy b/lib/neutron-legacy
index 084a356..f5a7a0a 100644
--- a/lib/neutron-legacy
+++ b/lib/neutron-legacy
@@ -107,7 +107,6 @@
NEUTRON_DIR=$DEST/neutron
NEUTRON_FWAAS_DIR=$DEST/neutron-fwaas
-NEUTRON_LBAAS_DIR=$DEST/neutron-lbaas
NEUTRON_VPNAAS_DIR=$DEST/neutron-vpnaas
NEUTRON_AUTH_CACHE_DIR=${NEUTRON_AUTH_CACHE_DIR:-/var/cache/neutron}
@@ -122,9 +121,6 @@
NEUTRON_CONF=$NEUTRON_CONF_DIR/neutron.conf
export NEUTRON_TEST_CONFIG_FILE=${NEUTRON_TEST_CONFIG_FILE:-"$NEUTRON_CONF_DIR/debug.ini"}
-# Default provider for load balancer service
-DEFAULT_LB_PROVIDER=LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
-
# Default provider for VPN service
DEFAULT_VPN_PROVIDER=VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default
@@ -347,12 +343,6 @@
source $TOP_DIR/lib/neutron_plugins/$Q_PLUGIN
fi
-# Agent loadbalancer service plugin functions
-# -------------------------------------------
-
-# Hardcoding for 1 service plugin for now
-source $TOP_DIR/lib/neutron_plugins/services/loadbalancer
-
# Agent metering service plugin functions
# -------------------------------------------
@@ -442,10 +432,6 @@
iniset_rpc_backend neutron $NEUTRON_CONF
# goes before q-svc to init Q_SERVICE_PLUGIN_CLASSES
- if is_service_enabled q-lbaas; then
- deprecated "Configuring q-lbaas through devstack is deprecated"
- _configure_neutron_lbaas
- fi
if is_service_enabled q-metering; then
_configure_neutron_metering
fi
@@ -657,10 +643,6 @@
git_clone $NEUTRON_FWAAS_REPO $NEUTRON_FWAAS_DIR $NEUTRON_FWAAS_BRANCH
setup_develop $NEUTRON_FWAAS_DIR
fi
- if is_service_enabled q-lbaas; then
- git_clone $NEUTRON_LBAAS_REPO $NEUTRON_LBAAS_DIR $NEUTRON_LBAAS_BRANCH
- setup_develop $NEUTRON_LBAAS_DIR
- fi
if is_service_enabled q-vpn; then
git_clone $NEUTRON_VPNAAS_REPO $NEUTRON_VPNAAS_DIR $NEUTRON_VPNAAS_BRANCH
setup_develop $NEUTRON_VPNAAS_DIR
@@ -704,10 +686,6 @@
if is_service_enabled q-agt q-dhcp q-l3; then
neutron_plugin_install_agent_packages
fi
-
- if is_service_enabled q-lbaas; then
- neutron_agent_lbaas_install_agent_packages
- fi
}
# Start running processes, including screen
@@ -770,7 +748,6 @@
fi
run_process q-meta "$AGENT_META_BINARY --config-file $NEUTRON_CONF --config-file=$Q_META_CONF_FILE"
- run_process q-lbaas "$AGENT_LBAAS_BINARY --config-file $NEUTRON_CONF --config-file=$LBAAS_AGENT_CONF_FILENAME"
run_process q-metering "$AGENT_METERING_BINARY --config-file $NEUTRON_CONF --config-file $METERING_AGENT_CONF_FILENAME"
if [ "$VIRT_DRIVER" = 'xenserver' ]; then
@@ -809,9 +786,6 @@
stop_process q-meta
fi
- if is_service_enabled q-lbaas; then
- neutron_lbaas_stop
- fi
if is_service_enabled q-fwaas; then
neutron_fwaas_stop
fi
@@ -916,7 +890,7 @@
fi
# delete all namespaces created by neutron
- for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|qlbaas|fip|snat)-[0-9a-f-]*'); do
+ for ns in $(sudo ip netns list | grep -o -E '(qdhcp|qrouter|fip|snat)-[0-9a-f-]*'); do
sudo ip netns delete ${ns}
done
}
@@ -1109,18 +1083,6 @@
iniset $NEUTRON_CONF oslo_messaging_notifications driver messaging
}
-function _configure_neutron_lbaas {
- # Uses oslo config generator to generate LBaaS sample configuration files
- (cd $NEUTRON_LBAAS_DIR && exec ./tools/generate_config_file_samples.sh)
-
- if [ -f $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample ]; then
- cp $NEUTRON_LBAAS_DIR/etc/neutron_lbaas.conf.sample $NEUTRON_CONF_DIR/neutron_lbaas.conf
- iniset $NEUTRON_CONF_DIR/neutron_lbaas.conf service_providers service_provider $DEFAULT_LB_PROVIDER
- fi
- neutron_agent_lbaas_configure_common
- neutron_agent_lbaas_configure_agent
-}
-
function _configure_neutron_metering {
neutron_agent_metering_configure_common
neutron_agent_metering_configure_agent
diff --git a/lib/neutron_plugins/openvswitch_agent b/lib/neutron_plugins/openvswitch_agent
index 339d5fd..aba2587 100644
--- a/lib/neutron_plugins/openvswitch_agent
+++ b/lib/neutron_plugins/openvswitch_agent
@@ -96,17 +96,17 @@
# Set up domU's L2 agent:
- # Create a bridge "br-$GUEST_INTERFACE_DEFAULT"
- _neutron_ovs_base_add_bridge "br-$GUEST_INTERFACE_DEFAULT"
- # Add $GUEST_INTERFACE_DEFAULT to that bridge
- sudo ovs-vsctl -- --may-exist add-port "br-$GUEST_INTERFACE_DEFAULT" $GUEST_INTERFACE_DEFAULT
+ # Create a bridge "br-$VLAN_INTERFACE"
+ _neutron_ovs_base_add_bridge "br-$VLAN_INTERFACE"
+ # Add $VLAN_INTERFACE to that bridge
+ sudo ovs-vsctl -- --may-exist add-port "br-$VLAN_INTERFACE" $VLAN_INTERFACE
# Create external bridge and add port
_neutron_ovs_base_add_bridge $PUBLIC_BRIDGE
- sudo ovs-vsctl -- --may-exist add-port $PUBLIC_BRIDGE $PUBLIC_INTERFACE_DEFAULT
+ sudo ovs-vsctl -- --may-exist add-port $PUBLIC_BRIDGE $PUBLIC_INTERFACE
# Set bridge mappings to "physnet1:br-$GUEST_INTERFACE_DEFAULT"
- iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs bridge_mappings "physnet1:br-$GUEST_INTERFACE_DEFAULT,physnet-ex:$PUBLIC_BRIDGE"
+ iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs bridge_mappings "physnet1:br-$VLAN_INTERFACE,physnet-ex:$PUBLIC_BRIDGE"
# Set integration bridge to domU's
iniset "/$Q_PLUGIN_CONF_FILE.domU" ovs integration_bridge $OVS_BRIDGE
# Set root wrap
diff --git a/lib/neutron_plugins/services/loadbalancer b/lib/neutron_plugins/services/loadbalancer
deleted file mode 100644
index 30e9480..0000000
--- a/lib/neutron_plugins/services/loadbalancer
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/bash
-
-# Neutron loadbalancer plugin
-# ---------------------------
-
-# Save trace setting
-_XTRACE_NEUTRON_LB=$(set +o | grep xtrace)
-set +o xtrace
-
-
-AGENT_LBAAS_BINARY="$NEUTRON_BIN_DIR/neutron-lbaas-agent"
-LBAAS_PLUGIN=neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPlugin
-
-function neutron_agent_lbaas_install_agent_packages {
- if is_ubuntu || is_fedora || is_suse; then
- install_package haproxy
- fi
-}
-
-function neutron_agent_lbaas_configure_common {
- _neutron_service_plugin_class_add $LBAAS_PLUGIN
- _neutron_deploy_rootwrap_filters $NEUTRON_LBAAS_DIR
-}
-
-function neutron_agent_lbaas_configure_agent {
- LBAAS_AGENT_CONF_PATH=/etc/neutron/services/loadbalancer/haproxy
- mkdir -p $LBAAS_AGENT_CONF_PATH
-
- LBAAS_AGENT_CONF_FILENAME="$LBAAS_AGENT_CONF_PATH/lbaas_agent.ini"
-
- cp $NEUTRON_LBAAS_DIR/etc/lbaas_agent.ini.sample $LBAAS_AGENT_CONF_FILENAME
-
- # ovs_use_veth needs to be set before the plugin configuration
- # occurs to allow plugins to override the setting.
- iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT ovs_use_veth $Q_OVS_USE_VETH
-
- neutron_plugin_setup_interface_driver $LBAAS_AGENT_CONF_FILENAME
-
- if is_fedora; then
- iniset $LBAAS_AGENT_CONF_FILENAME DEFAULT user_group "nobody"
- iniset $LBAAS_AGENT_CONF_FILENAME haproxy user_group "nobody"
- fi
-}
-
-function neutron_lbaas_stop {
- pids=$(ps aux | awk '/haproxy/ { print $2 }')
- [ ! -z "$pids" ] && sudo kill $pids || true
-}
-
-# Restore xtrace
-$_XTRACE_NEUTRON_LB
diff --git a/lib/nova b/lib/nova
index ad72fc3..8823e1d 100644
--- a/lib/nova
+++ b/lib/nova
@@ -648,7 +648,7 @@
if is_service_enabled n-cell; then
cp $NOVA_CONF $NOVA_CELLS_CONF
iniset $NOVA_CELLS_CONF database connection `database_connection_url $NOVA_CELLS_DB`
- iniset $NOVA_CELLS_CONF DEFAULT rabbit_virtual_host child_cell
+ iniset $NOVA_CELLS_CONF oslo_messaging_rabbit rabbit_virtual_host child_cell
iniset $NOVA_CELLS_CONF DEFAULT dhcpbridge_flagfile $NOVA_CELLS_CONF
iniset $NOVA_CELLS_CONF cells enable True
iniset $NOVA_CELLS_CONF cells cell_type compute
diff --git a/lib/swift b/lib/swift
index bef55b9..f47608c 100644
--- a/lib/swift
+++ b/lib/swift
@@ -500,21 +500,21 @@
iniset ${swift_node_config} DEFAULT bind_ip ${SWIFT_SERVICE_LISTEN_ADDRESS}
done
- # Set new accounts in tempauth to match keystone tenant/user (to make testing easier)
- iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest1 "testing .admin"
- iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest2_swiftusertest2 "testing2 .admin"
- iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swifttenanttest1_swiftusertest3 "testing3 .admin"
+ # Set new accounts in tempauth to match keystone project/user (to make testing easier)
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swiftprojecttest1_swiftusertest1 "testing .admin"
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swiftprojecttest2_swiftusertest2 "testing2 .admin"
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth user_swiftprojecttest1_swiftusertest3 "testing3 .admin"
testfile=${SWIFT_CONF_DIR}/test.conf
cp ${SWIFT_DIR}/test/sample.conf ${testfile}
# Set accounts for functional tests
- iniset ${testfile} func_test account swifttenanttest1
+ iniset ${testfile} func_test account swiftprojecttest1
iniset ${testfile} func_test username swiftusertest1
iniset ${testfile} func_test username3 swiftusertest3
- iniset ${testfile} func_test account2 swifttenanttest2
+ iniset ${testfile} func_test account2 swiftprojecttest2
iniset ${testfile} func_test username2 swiftusertest2
- iniset ${testfile} func_test account4 swifttenanttest4
+ iniset ${testfile} func_test account4 swiftprojecttest4
iniset ${testfile} func_test username4 swiftusertest4
iniset ${testfile} func_test password4 testing4
iniset ${testfile} func_test domain4 swift_test
@@ -608,13 +608,13 @@
# since we want to make it compatible with tempauth which use
# underscores for separators.
-# Tenant User Roles Domain
-# ------------------------------------------------------------------
-# service swift service default
-# swifttenanttest1 swiftusertest1 admin default
-# swifttenanttest1 swiftusertest3 anotherrole default
-# swifttenanttest2 swiftusertest2 admin default
-# swifttenanttest4 swiftusertest4 admin swift_test
+# Project User Roles Domain
+# -------------------------------------------------------------------
+# service swift service default
+# swiftprojecttest1 swiftusertest1 admin default
+# swiftprojecttest1 swiftusertest3 anotherrole default
+# swiftprojecttest2 swiftusertest2 admin default
+# swiftprojecttest4 swiftusertest4 admin swift_test
function create_swift_accounts {
# Defines specific passwords used by ``tools/create_userrc.sh``
@@ -640,43 +640,43 @@
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:$SWIFT_DEFAULT_BIND_PORT" \
"$SWIFT_SERVICE_PROTOCOL://$SERVICE_HOST:$SWIFT_DEFAULT_BIND_PORT/v1/AUTH_\$(project_id)s"
- local swift_tenant_test1
- swift_tenant_test1=$(get_or_create_project swifttenanttest1 default)
- die_if_not_set $LINENO swift_tenant_test1 "Failure creating swift_tenant_test1"
+ local swift_project_test1
+ swift_project_test1=$(get_or_create_project swiftprojecttest1 default)
+ die_if_not_set $LINENO swift_project_test1 "Failure creating swift_project_test1"
SWIFT_USER_TEST1=$(get_or_create_user swiftusertest1 $swiftusertest1_password \
"default" "test@example.com")
die_if_not_set $LINENO SWIFT_USER_TEST1 "Failure creating SWIFT_USER_TEST1"
- get_or_add_user_project_role admin $SWIFT_USER_TEST1 $swift_tenant_test1
+ get_or_add_user_project_role admin $SWIFT_USER_TEST1 $swift_project_test1
local swift_user_test3
swift_user_test3=$(get_or_create_user swiftusertest3 $swiftusertest3_password \
"default" "test3@example.com")
die_if_not_set $LINENO swift_user_test3 "Failure creating swift_user_test3"
- get_or_add_user_project_role $another_role $swift_user_test3 $swift_tenant_test1
+ get_or_add_user_project_role $another_role $swift_user_test3 $swift_project_test1
- local swift_tenant_test2
- swift_tenant_test2=$(get_or_create_project swifttenanttest2 default)
- die_if_not_set $LINENO swift_tenant_test2 "Failure creating swift_tenant_test2"
+ local swift_project_test2
+ swift_project_test2=$(get_or_create_project swiftprojecttest2 default)
+ die_if_not_set $LINENO swift_project_test2 "Failure creating swift_project_test2"
local swift_user_test2
swift_user_test2=$(get_or_create_user swiftusertest2 $swiftusertest2_password \
"default" "test2@example.com")
die_if_not_set $LINENO swift_user_test2 "Failure creating swift_user_test2"
- get_or_add_user_project_role admin $swift_user_test2 $swift_tenant_test2
+ get_or_add_user_project_role admin $swift_user_test2 $swift_project_test2
local swift_domain
swift_domain=$(get_or_create_domain swift_test 'Used for swift functional testing')
die_if_not_set $LINENO swift_domain "Failure creating swift_test domain"
- local swift_tenant_test4
- swift_tenant_test4=$(get_or_create_project swifttenanttest4 $swift_domain)
- die_if_not_set $LINENO swift_tenant_test4 "Failure creating swift_tenant_test4"
+ local swift_project_test4
+ swift_project_test4=$(get_or_create_project swiftprojecttest4 $swift_domain)
+ die_if_not_set $LINENO swift_project_test4 "Failure creating swift_project_test4"
local swift_user_test4
swift_user_test4=$(get_or_create_user swiftusertest4 $swiftusertest4_password \
$swift_domain "test4@example.com")
die_if_not_set $LINENO swift_user_test4 "Failure creating swift_user_test4"
- get_or_add_user_project_role admin $swift_user_test4 $swift_tenant_test4
+ get_or_add_user_project_role admin $swift_user_test4 $swift_project_test4
}
# init_swift() - Initialize rings
diff --git a/lib/tempest b/lib/tempest
index 67b631e..fd98c94 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -317,44 +317,6 @@
fi
# Compute Features
- # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
- # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
- local tmp_cfg_file
- tmp_cfg_file=$(mktemp)
- cd $TEMPEST_DIR
- if [[ "$OFFLINE" != "True" ]]; then
- tox -revenv --notest
- fi
-
- # Auth
- iniset $TEMPEST_CONFIG auth tempest_roles "Member"
- if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
- if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml
- else
- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml
- fi
- iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
- iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
- elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
- iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
-
- else
- iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
- fi
-
- # NOTE(mtreinish): Respect constraints on tempest verify-config venv
- tox -evenv -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
- tox -evenv -- tempest verify-config -uro $tmp_cfg_file
-
- local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
- if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
- # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
- compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
- # Remove disabled extensions
- compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
- fi
-
# Set the microversion range for compute tests.
# This is used to run the Nova microversions tests.
# Setting [None, latest] range of microversion which allow Tempest to run all microversions tests.
@@ -383,7 +345,6 @@
iniset $TEMPEST_CONFIG compute-feature-enabled live_migration ${LIVE_MIGRATION_AVAILABLE:-False}
iniset $TEMPEST_CONFIG compute-feature-enabled change_password False
iniset $TEMPEST_CONFIG compute-feature-enabled block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
- iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
# TODO(mriedem): Remove the preserve_ports flag when Juno is end of life.
iniset $TEMPEST_CONFIG compute-feature-enabled preserve_ports True
# TODO(gilliard): Remove the live_migrate_paused_instances flag when Juno is end of life.
@@ -420,15 +381,6 @@
iniset $TEMPEST_CONFIG network-feature-enabled ipv6 "$IPV6_ENABLED"
iniset $TEMPEST_CONFIG network-feature-enabled ipv6_subnet_attributes "$IPV6_SUBNET_ATTRIBUTES_ENABLED"
- local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
- if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
- # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
- network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
- # Remove disabled extensions
- network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
- fi
- iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
-
# Orchestration Tests
if is_service_enabled heat; then
if [[ ! -z "$HEAT_CFN_IMAGE_URL" ]]; then
@@ -461,16 +413,6 @@
# Telemetry
iniset $TEMPEST_CONFIG telemetry-feature-enabled events "True"
- # Object Store
- local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
- if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
- # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
- object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
- # Remove disabled extensions
- object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
- fi
- iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
-
# Validation
iniset $TEMPEST_CONFIG validation run_validation ${TEMPEST_RUN_VALIDATION:-False}
iniset $TEMPEST_CONFIG validation ip_version_for_ssh 4
@@ -484,15 +426,6 @@
# TODO(ynesenenko): Remove the volume_services flag when Liberty and Kilo will correct work with host info.
iniset $TEMPEST_CONFIG volume-feature-enabled volume_services True
- local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
- if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
- # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
- volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
- # Remove disabled extensions
- volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
- fi
- iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
-
if ! is_service_enabled c-bak; then
iniset $TEMPEST_CONFIG volume-feature-enabled backup False
fi
@@ -573,6 +506,76 @@
iniset $TEMPEST_CONFIG service_available cinder "False"
fi
+ # Run tempest configuration utilities. This must be done last during configuration to
+ # ensure as complete a config as possible already exists
+
+ # NOTE(mtreinish): Respect constraints on tempest verify-config venv
+ local tmp_cfg_file
+ tmp_cfg_file=$(mktemp)
+ cd $TEMPEST_DIR
+ if [[ "$OFFLINE" != "True" ]]; then
+ tox -revenv --notest
+ fi
+ tox -evenv -- pip install -c $REQUIREMENTS_DIR/upper-constraints.txt -r requirements.txt
+
+ # Auth:
+ iniset $TEMPEST_CONFIG auth tempest_roles "Member"
+ if [[ $TEMPEST_USE_TEST_ACCOUNTS == "True" ]]; then
+ if [[ $TEMPEST_HAS_ADMIN == "True" ]]; then
+ tox -evenv -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY --with-admin etc/accounts.yaml
+ else
+ tox -evenv -- tempest-account-generator -c $TEMPEST_CONFIG --os-username $admin_username --os-password "$password" --os-tenant-name $admin_project_name -r $TEMPEST_CONCURRENCY etc/accounts.yaml
+ fi
+ iniset $TEMPEST_CONFIG auth use_dynamic_credentials False
+ iniset $TEMPEST_CONFIG auth test_accounts_file "etc/accounts.yaml"
+ elif [[ $TEMPEST_HAS_ADMIN == "False" ]]; then
+ iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-False}
+
+ else
+ iniset $TEMPEST_CONFIG auth use_dynamic_credentials ${TEMPEST_ALLOW_TENANT_ISOLATION:-True}
+ fi
+
+ # API Extensions
+ # Run ``verify_tempest_config -ur`` to retrieve enabled extensions on API endpoints
+ # NOTE(mtreinish): This must be done after auth settings are added to the tempest config
+ tox -evenv -- tempest verify-config -uro $tmp_cfg_file
+ # Nova API extensions
+ local compute_api_extensions=${COMPUTE_API_EXTENSIONS:-"all"}
+ if [[ ! -z "$DISABLE_COMPUTE_API_EXTENSIONS" ]]; then
+ # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
+ compute_api_extensions=${COMPUTE_API_EXTENSIONS:-$(iniget $tmp_cfg_file compute-feature-enabled api_extensions | tr -d " ")}
+ # Remove disabled extensions
+ compute_api_extensions=$(remove_disabled_extensions $compute_api_extensions $DISABLE_COMPUTE_API_EXTENSIONS)
+ fi
+ iniset $TEMPEST_CONFIG compute-feature-enabled api_extensions $compute_api_extensions
+ # Neutron API Extensions
+ local network_api_extensions=${NETWORK_API_EXTENSIONS:-"all"}
+ if [[ ! -z "$DISABLE_NETWORK_API_EXTENSIONS" ]]; then
+ # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
+ network_api_extensions=${NETWORK_API_EXTENSIONS:-$(iniget $tmp_cfg_file network-feature-enabled api_extensions | tr -d " ")}
+ # Remove disabled extensions
+ network_api_extensions=$(remove_disabled_extensions $network_api_extensions $DISABLE_NETWORK_API_EXTENSIONS)
+ fi
+ iniset $TEMPEST_CONFIG network-feature-enabled api_extensions $network_api_extensions
+ # Swift API Extensions
+ local object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-"all"}
+ if [[ ! -z "$DISABLE_OBJECT_STORAGE_API_EXTENSIONS" ]]; then
+ # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
+ object_storage_api_extensions=${OBJECT_STORAGE_API_EXTENSIONS:-$(iniget $tmp_cfg_file object-storage-feature-enabled discoverable_apis | tr -d " ")}
+ # Remove disabled extensions
+ object_storage_api_extensions=$(remove_disabled_extensions $object_storage_api_extensions $DISABLE_STORAGE_API_EXTENSIONS)
+ fi
+ iniset $TEMPEST_CONFIG object-storage-feature-enabled discoverable_apis $object_storage_api_extensions
+ # Cinder API Extensions
+ local volume_api_extensions=${VOLUME_API_EXTENSIONS:-"all"}
+ if [[ ! -z "$DISABLE_VOLUME_API_EXTENSIONS" ]]; then
+ # Enabled extensions are either the ones explicitly specified or those available on the API endpoint
+ volume_api_extensions=${VOLUME_API_EXTENSIONS:-$(iniget $tmp_cfg_file volume-feature-enabled api_extensions | tr -d " ")}
+ # Remove disabled extensions
+ volume_api_extensions=$(remove_disabled_extensions $volume_api_extensions $DISABLE_VOLUME_API_EXTENSIONS)
+ fi
+ iniset $TEMPEST_CONFIG volume-feature-enabled api_extensions $volume_api_extensions
+
# Restore IFS
IFS=$ifs
}
diff --git a/stackrc b/stackrc
index 17d6047..5dd837b 100644
--- a/stackrc
+++ b/stackrc
@@ -238,10 +238,6 @@
NEUTRON_FWAAS_REPO=${NEUTRON_FWAAS_REPO:-${GIT_BASE}/openstack/neutron-fwaas.git}
NEUTRON_FWAAS_BRANCH=${NEUTRON_FWAAS_BRANCH:-master}
-# neutron lbaas service
-NEUTRON_LBAAS_REPO=${NEUTRON_LBAAS_REPO:-${GIT_BASE}/openstack/neutron-lbaas.git}
-NEUTRON_LBAAS_BRANCH=${NEUTRON_LBAAS_BRANCH:-master}
-
# neutron vpnaas service
NEUTRON_VPNAAS_REPO=${NEUTRON_VPNAAS_REPO:-${GIT_BASE}/openstack/neutron-vpnaas.git}
NEUTRON_VPNAAS_BRANCH=${NEUTRON_VPNAAS_BRANCH:-master}
diff --git a/tools/fixup_stuff.sh b/tools/fixup_stuff.sh
index 15cb5a1..193a1f7 100755
--- a/tools/fixup_stuff.sh
+++ b/tools/fixup_stuff.sh
@@ -159,14 +159,6 @@
pip_install --upgrade --force-reinstall requests
fi
fi
-
- if [[ "$os_VENDOR" == "Fedora" ]] && [[ "$os_RELEASE" -ge "23" ]]; then
- # work-around broken rabbitmq-server 3.6.1 packages
- # https://bugzilla.redhat.com/show_bug.cgi?id=1323610
- # Will be removed when this bug is fixed.
- sudo dnf -y install \
- https://kojipkgs.fedoraproject.org/packages/rabbitmq-server/3.5.7/4.fc23/noarch/rabbitmq-server-3.5.7-4.fc23.noarch.rpm
- fi
fi
# The version of pip(1.5.4) supported by python-virtualenv(1.11.4) has
diff --git a/tools/generate-devstack-plugins-list.py b/tools/generate-devstack-plugins-list.py
index aeec4dd..089a6ef 100644
--- a/tools/generate-devstack-plugins-list.py
+++ b/tools/generate-devstack-plugins-list.py
@@ -53,7 +53,7 @@
if len(r.text) > 0:
return True
else:
- False
+ return False
logging.debug("Getting project list from %s" % url)
r = requests.get(url)
@@ -64,4 +64,4 @@
for project in found_plugins:
# strip of openstack/
- print project[10:]
+ print(project[10:])
diff --git a/tools/generate-devstack-plugins-list.sh b/tools/generate-devstack-plugins-list.sh
old mode 100644
new mode 100755
diff --git a/tools/worlddump.py b/tools/worlddump.py
index 3ff22a9..8c053e0 100755
--- a/tools/worlddump.py
+++ b/tools/worlddump.py
@@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+
"""Dump the state of the world for post mortem."""
import argparse
@@ -48,32 +49,38 @@
def warn(msg):
- print "WARN: %s" % msg
+ print("WARN: %s" % msg)
def _dump_cmd(cmd):
- print cmd
- print "-" * len(cmd)
- print
+ print(cmd)
+ print("-" * len(cmd))
+ print()
try:
subprocess.check_call(cmd, shell=True)
- print
+ print()
except subprocess.CalledProcessError as e:
- print "*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e}
+ print("*** Failed to run '%(cmd)s': %(err)s" % {'cmd': cmd, 'err': e})
def _find_cmd(cmd):
if not spawn.find_executable(cmd):
- print "*** %s not found: skipping" % cmd
+ print("*** %s not found: skipping" % cmd)
return False
return True
def _header(name):
- print
- print name
- print "=" * len(name)
- print
+ print()
+ print(name)
+ print("=" * len(name))
+ print()
+
+
+def _bridge_list():
+ process = subprocess.Popen(['ovs-vsctl', 'list-br'], stdout=subprocess.PIPE)
+ stdout, _ = process.communicate()
+ return stdout.split()
# This method gets a max openflow version supported by openvswitch.
@@ -109,7 +116,7 @@
# if it doesn't look like an int, that's fine
pass
- print dfraw
+ print(dfraw)
def ebtables_dump():
@@ -157,14 +164,11 @@
if not _find_cmd('ovs-vsctl'):
return
- # NOTE(ihrachys): worlddump is used outside of devstack context (f.e. in
- # grenade), so there is no single place to determine the bridge names from.
- # Hardcode for now.
- bridges = ('br-int', 'br-tun', 'br-ex')
+ bridges = _bridge_list()
ofctl_cmds = ('show', 'dump-ports-desc', 'dump-ports', 'dump-flows')
ofp_max = _get_ofp_version()
vers = 'OpenFlow10'
- for i in range(ofp_max + 1):
+ for i in range(1, ofp_max + 1):
vers += ',OpenFlow1' + str(i)
_dump_cmd("sudo ovs-vsctl show")
for ofctl_cmd in ofctl_cmds:
@@ -193,17 +197,17 @@
try:
subprocess.check_call(["pgrep","nova-compute"])
except subprocess.CalledProcessError:
- print "Skipping as nova-compute does not appear to be running"
+ print("Skipping as nova-compute does not appear to be running")
return
_dump_cmd("kill -s USR2 `pgrep nova-compute`")
- print "guru meditation report in nova-compute log"
+ print("guru meditation report in nova-compute log")
def main():
opts = get_options()
fname = filename(opts.dir, opts.name)
- print "World dumping... see %s for details" % fname
+ print("World dumping... see %s for details" % fname)
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
with open(fname, 'w') as f:
os.dup2(f.fileno(), sys.stdout.fileno())