Merge "Refactor init functions to simplify Grenade upgrades"
diff --git a/functions b/functions
index 3f26b7f..79c82a4 100644
--- a/functions
+++ b/functions
@@ -738,26 +738,31 @@
# Helper to launch a service in a named screen
# screen_it service "command-line"
function screen_it {
- NL=`echo -ne '\015'`
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
+ SCREEN_DEV=`trueorfalse True $SCREEN_DEV`
if is_service_enabled $1; then
# Append the service to the screen rc file
screen_rc "$1" "$2"
screen -S $SCREEN_NAME -X screen -t $1
- # sleep to allow bash to be ready to be send the command - we are
- # creating a new window in screen and then sends characters, so if
- # bash isn't running by the time we send the command, nothing happens
- sleep 1.5
+ if [[ "$SCREEN_DEV" = "True" ]]; then
+ # sleep to allow bash to be ready to be send the command - we are
+ # creating a new window in screen and then sends characters, so if
+ # bash isn't running by the time we send the command, nothing happens
+ sleep 1.5
- if [[ -n ${SCREEN_LOGDIR} ]]; then
- screen -S $SCREEN_NAME -p $1 -X logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log
- screen -S $SCREEN_NAME -p $1 -X log on
- ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
+ if [[ -n ${SCREEN_LOGDIR} ]]; then
+ screen -S $SCREEN_NAME -p $1 -X logfile ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log
+ screen -S $SCREEN_NAME -p $1 -X log on
+ ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
+ fi
+ NL=`echo -ne '\015'`
+ screen -S $SCREEN_NAME -p $1 -X stuff "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\"$NL"
+ else
+ screen -S $SCREEN_NAME -p $1 -X exec /bin/bash -c "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\""
fi
- screen -S $SCREEN_NAME -p $1 -X stuff "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\"$NL"
fi
}
diff --git a/lib/baremetal b/lib/baremetal
index 7c31d1f..2659386 100644
--- a/lib/baremetal
+++ b/lib/baremetal
@@ -400,15 +400,10 @@
}
function clear_baremetal_of_all_nodes() {
- list=$(nova-baremetal-manage node list | tail -n +2 | awk '{print $1}' )
+ list=$(nova baremetal-node-list | awk -F '| ' 'NR>3 {print $2}' )
for node in $list
do
- nova-baremetal-manage node delete $node
- done
- list=$(nova-baremetal-manage interface list | tail -n +2 | awk '{print $1}' )
- for iface in $list
- do
- nova-baremetal-manage interface delete $iface
+ nova baremetal-node-delete $node
done
}
@@ -420,16 +415,18 @@
mac_1=${1:-$BM_FIRST_MAC}
mac_2=${2:-$BM_SECOND_MAC}
- id=$(nova-baremetal-manage node create \
- --host=$BM_HOSTNAME --prov_mac=$mac_1 \
- --cpus=$BM_FLAVOR_CPU --memory_mb=$BM_FLAVOR_RAM \
- --local_gb=$BM_FLAVOR_ROOT_DISK --terminal_port=0 \
- --pm_address=$BM_PM_ADDR --pm_user=$BM_PM_USER --pm_password=$BM_PM_PASS \
- )
+ id=$(nova baremetal-node-create \
+ --pm_address="$BM_PM_ADDR" \
+ --pm_user="$BM_PM_USER" \
+ --pm_password="$BM_PM_PASS" \
+ "$BM_HOSTNAME" \
+ "$BM_FLAVOR_CPU" \
+ "$BM_FLAVOR_RAM" \
+ "$BM_FLAVOR_ROOT_DISK" \
+ "$mac_1" \
+ | grep ' id ' | get_field 2 )
[ $? -eq 0 ] || [ "$id" ] || die "Error adding baremetal node"
- id2=$(nova-baremetal-manage interface create \
- --node_id=$id --mac_address=$mac_2 --datapath_id=0 --port_no=0 \
- )
+ id2=$(nova baremetal-add-interface "$id" "$mac_2" )
[ $? -eq 0 ] || [ "$id2" ] || die "Error adding interface to barmetal node $id"
}
diff --git a/lib/nova b/lib/nova
index e359719..849ec57 100644
--- a/lib/nova
+++ b/lib/nova
@@ -166,20 +166,13 @@
# Get the sample configuration file in place
cp $NOVA_DIR/etc/nova/api-paste.ini $NOVA_CONF_DIR
- # Rewrite the authtoken configuration for our Keystone service.
- # This is a bit defensive to allow the sample file some variance.
- sed -e "
- /^admin_token/i admin_tenant_name = $SERVICE_TENANT_NAME
- /admin_tenant_name/s/^.*$/admin_tenant_name = $SERVICE_TENANT_NAME/;
- /admin_user/s/^.*$/admin_user = nova/;
- /admin_password/s/^.*$/admin_password = $SERVICE_PASSWORD/;
- s,%SERVICE_TENANT_NAME%,$SERVICE_TENANT_NAME,g;
- s,%SERVICE_TOKEN%,$SERVICE_TOKEN,g;
- " -i $NOVA_API_PASTE_INI
iniset $NOVA_API_PASTE_INI filter:authtoken auth_host $SERVICE_HOST
if is_service_enabled tls-proxy; then
iniset $NOVA_API_PASTE_INI filter:authtoken auth_protocol $SERVICE_PROTOCOL
fi
+ iniset $NOVA_API_PASTE_INI filter:authtoken admin_tenant_name $SERVICE_TENANT_NAME
+ iniset $NOVA_API_PASTE_INI filter:authtoken admin_user nova
+ iniset $NOVA_API_PASTE_INI filter:authtoken admin_password $SERVICE_PASSWORD
fi
iniset $NOVA_API_PASTE_INI filter:authtoken signing_dir $NOVA_AUTH_CACHE_DIR
diff --git a/lib/quantum b/lib/quantum
index d5733b3..f3a3ec4 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -270,8 +270,19 @@
# Create a small network
# Since quantum command is executed in admin context at this point,
# ``--tenant_id`` needs to be specified.
- NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
- SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+ if is_baremetal; then
+ sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
+ for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
+ sudo ip addr del $IP dev $PUBLIC_INTERFACE
+ sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
+ done
+ NET_ID=$(quantum net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2)
+ SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+ sudo ifconfig $OVS_PHYSICAL_BRIDGE up
+ else
+ NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
+ SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+ fi
if is_service_enabled q-l3; then
# Create a router, and add the private subnet as one of its interfaces
@@ -507,7 +518,11 @@
iniset $QUANTUM_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
- _quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken
+ _quantum_setup_keystone $QUANTUM_CONF keystone_authtoken
+ # Comment out keystone authtoken configuration in api-paste.ini
+ # It is required to avoid any breakage in Quantum where the sample
+ # api-paste.ini has authtoken configurations.
+ _quantum_commentout_keystone_authtoken $Q_API_PASTE_FILE filter:authtoken
# Configure plugin
quantum_plugin_configure_service
@@ -573,6 +588,21 @@
rm -f $QUANTUM_AUTH_CACHE_DIR/*
}
+function _quantum_commentout_keystone_authtoken() {
+ local conf_file=$1
+ local section=$2
+
+ inicomment $conf_file $section auth_host
+ inicomment $conf_file $section auth_port
+ inicomment $conf_file $section auth_protocol
+ inicomment $conf_file $section auth_url
+
+ inicomment $conf_file $section admin_tenant_name
+ inicomment $conf_file $section admin_user
+ inicomment $conf_file $section admin_password
+ inicomment $conf_file $section signing_dir
+}
+
function _quantum_setup_interface_driver() {
quantum_plugin_setup_interface_driver $1
}
diff --git a/lib/quantum_plugins/brocade b/lib/quantum_plugins/brocade
new file mode 100644
index 0000000..c372c19
--- /dev/null
+++ b/lib/quantum_plugins/brocade
@@ -0,0 +1,49 @@
+# Brocade Quantum Plugin
+# ----------------------
+
+# Save trace setting
+BRCD_XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+function is_quantum_ovs_base_plugin() {
+ return 1
+}
+
+function quantum_plugin_create_nova_conf() {
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"}
+}
+
+function quantum_plugin_install_agent_packages() {
+ install_package bridge-utils
+}
+
+function quantum_plugin_configure_common() {
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/brocade
+ Q_PLUGIN_CONF_FILENAME=brocade.ini
+ Q_DB_NAME="brcd_quantum"
+ Q_PLUGIN_CLASS="quantum.plugins.brocade.QuantumPlugin.BrocadePluginV2"
+}
+
+function quantum_plugin_configure_debug_command() {
+ :
+}
+
+function quantum_plugin_configure_dhcp_agent() {
+ :
+}
+
+function quantum_plugin_configure_l3_agent() {
+ :
+}
+
+function quantum_plugin_configure_plugin_agent() {
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent"
+}
+
+function quantum_plugin_setup_interface_driver() {
+ local conf_file=$1
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
+}
+
+# Restore xtrace
+$BRCD_XTRACE
diff --git a/lib/quantum_plugins/openvswitch b/lib/quantum_plugins/openvswitch
index 12bc244..181e7e7 100644
--- a/lib/quantum_plugins/openvswitch
+++ b/lib/quantum_plugins/openvswitch
@@ -75,7 +75,7 @@
# Nova will always be installed along with quantum for a domU
# devstack install, so it should be safe to rely on nova.conf
# for xenapi configuration.
- Q_RR_DOM0_COMMAND="$QUANTUM_DIR/bin/quantum-rootwrap-dom0 $NOVA_CONF"
+ Q_RR_DOM0_COMMAND="$QUANTUM_DIR/bin/quantum-rootwrap-xen-dom0 $NOVA_CONF"
# Under XS/XCP, the ovs agent needs to target the dom0
# integration bridge. This is enabled by using a root wrapper
# that executes commands on dom0 via a XenAPI plugin.
diff --git a/lib/tempest b/lib/tempest
index cb172a8..e43f6d7 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -205,13 +205,7 @@
iniset $TEMPEST_CONF identity admin_password "$password"
# Compute
- iniset $TEMPEST_CONF compute password "$password" # DEPRECATED
- iniset $TEMPEST_CONF compute alt_username $ALT_USERNAME # DEPRECATED
- iniset $TEMPEST_CONF compute alt_password "$password" # DEPRECATED
- iniset $TEMPEST_CONF compute alt_tenant_name $ALT_TENANT_NAME # DEPRECATED
- iniset $TEMPEST_CONF compute resize_available False
iniset $TEMPEST_CONF compute change_password_available False
- iniset $TEMPEST_CONF compute compute_log_level ERROR
# Note(nati) current tempest don't create network for each tenant
# so reuse same tenant for now
if is_service_enabled quantum; then
@@ -232,10 +226,6 @@
iniset $TEMPEST_CONF compute flavor_ref_alt $flavor_ref_alt
iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False}
iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
- iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR # DEPRECATED
- iniset $TEMPEST_CONF compute bin_dir $NOVA_BIN_DIR # DEPRECATED
- iniset $TEMPEST_CONF compute path_to_private_key $TEMPEST_DIR/id_rsa # DEPRECATED
- iniset $TEMPEST_CONF compute db_uri $BASE_SQL_CONN/nova # DEPRECATED
# Whitebox
iniset $TEMPEST_CONF whitebox source_dir $NOVA_SOURCE_DIR
@@ -246,21 +236,11 @@
iniset $TEMPEST_CONF whitebox db_uri $BASE_SQL_CONN/nova
- # image
- iniset $TEMPEST_CONF image password "$password" # DEPRECATED
-
- # identity-admin
- iniset $TEMPEST_CONF "identity-admin" password "$password" # DEPRECATED
-
# compute admin
iniset $TEMPEST_CONF "compute-admin" password "$password" # DEPRECATED
- # network admin
- iniset $TEMPEST_CONF "network-admin" password "$password" # DEPRECATED
-
# network
iniset $TEMPEST_CONF network api_version 2.0
- iniset $TEMPEST_CONF network password "$password" # DEPRECATED
iniset $TEMPEST_CONF network tenant_networks_reachable "$tenant_networks_reachable"
iniset $TEMPEST_CONF network public_network_id "$public_network_id"
iniset $TEMPEST_CONF network public_router_id "$public_router_id"
diff --git a/stack.sh b/stack.sh
index c1525bd..0f009fc 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1059,9 +1059,7 @@
elif [ "$VIRT_DRIVER" = 'openvz' ]; then
echo_summary "Using OpenVZ virtualization driver"
- # TODO(deva): OpenVZ driver does not yet work if compute_driver is set here.
- # Replace connection_type when this is fixed.
- # iniset $NOVA_CONF DEFAULT compute_driver "openvz.connection.OpenVzConnection"
+ iniset $NOVA_CONF DEFAULT compute_driver "openvz.driver.OpenVzDriver"
iniset $NOVA_CONF DEFAULT connection_type "openvz"
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER"
diff --git a/stackrc b/stackrc
index 789fc82..91f4e2b 100644
--- a/stackrc
+++ b/stackrc
@@ -29,6 +29,13 @@
# Set the default Nova APIs to enable
NOVA_ENABLED_APIS=ec2,osapi_compute,metadata
+# Whether to use 'dev mode' for screen windows. Dev mode works by
+# stuffing text into the screen windows so that a developer can use
+# ctrl-c, up-arrow, enter to restart the service. Starting services
+# this way is slightly unreliable, and a bit slower, so this can
+# be disabled for automated testing by setting this value to false.
+SCREEN_DEV=True
+
# Repositories
# ------------