Remove usage of neutron-debug since it has been removed
The neutron-debug command was deprecated and finally removed, so tools/ping_neutron.sh can no longer rely on it to create a probe namespace. Instead, just try and use any namespace with the network ID in it, since it's either the DHCP (ML2/OVS) or Metadata (OVN) namespace, which should work just as well. As this code is rarely (never?) used, this best-effort attempt is good enough. Change-Id: I98c992a2a774ef1fb22cee2e90ee342ab2d537ac Depends-on: https://review.opendev.org/c/openstack/neutron/+/883081
This commit is contained in:
parent
34afa91fc9
commit
6764eab264
18
lib/neutron
18
lib/neutron
@ -1112,24 +1112,6 @@ function _neutron_setup_interface_driver {
|
|||||||
# Functions for Neutron Exercises
|
# Functions for Neutron Exercises
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
|
|
||||||
function delete_probe {
|
|
||||||
local from_net="$1"
|
|
||||||
net_id=`_get_net_id $from_net`
|
|
||||||
probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
|
|
||||||
neutron-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
|
|
||||||
}
|
|
||||||
|
|
||||||
function _get_net_id {
|
|
||||||
openstack --os-cloud devstack-admin --os-region-name="$REGION_NAME" --os-project-name admin --os-username admin --os-password $ADMIN_PASSWORD network list | grep $1 | awk '{print $2}'
|
|
||||||
}
|
|
||||||
|
|
||||||
function _get_probe_cmd_prefix {
|
|
||||||
local from_net="$1"
|
|
||||||
net_id=`_get_net_id $from_net`
|
|
||||||
probe_id=`neutron-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}' | head -n 1`
|
|
||||||
echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ssh check
|
# ssh check
|
||||||
function _ssh_check_neutron {
|
function _ssh_check_neutron {
|
||||||
local from_net=$1
|
local from_net=$1
|
||||||
|
@ -30,7 +30,8 @@ ping_neutron.sh <net_name> [ping args]
|
|||||||
|
|
||||||
This provides a wrapper to ping neutron guests that are on isolated
|
This provides a wrapper to ping neutron guests that are on isolated
|
||||||
tenant networks that the caller can't normally reach. It does so by
|
tenant networks that the caller can't normally reach. It does so by
|
||||||
creating a network namespace probe.
|
using either the DHCP or Metadata network namespace to support both
|
||||||
|
ML2/OVS and OVN.
|
||||||
|
|
||||||
It takes arguments like ping, except the first arg must be the network
|
It takes arguments like ping, except the first arg must be the network
|
||||||
name.
|
name.
|
||||||
@ -44,6 +45,12 @@ EOF
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# BUG: with duplicate network names, this fails pretty hard since it
|
||||||
|
# will just pick the first match.
|
||||||
|
function _get_net_id {
|
||||||
|
openstack --os-cloud devstack-admin --os-region-name="$REGION_NAME" --os-project-name admin --os-username admin --os-password $ADMIN_PASSWORD network list | grep $1 | head -n 1 | awk '{print $2}'
|
||||||
|
}
|
||||||
|
|
||||||
NET_NAME=$1
|
NET_NAME=$1
|
||||||
|
|
||||||
if [[ -z "$NET_NAME" ]]; then
|
if [[ -z "$NET_NAME" ]]; then
|
||||||
@ -53,12 +60,11 @@ fi
|
|||||||
|
|
||||||
REMAINING_ARGS="${@:2}"
|
REMAINING_ARGS="${@:2}"
|
||||||
|
|
||||||
# BUG: with duplicate network names, this fails pretty hard.
|
NET_ID=`_get_net_id $NET_NAME`
|
||||||
NET_ID=$(openstack network show -f value -c id "$NET_NAME")
|
NET_NS=$(ip netns list | grep "$NET_ID" | head -n 1)
|
||||||
PROBE_ID=$(neutron-debug probe-list -c id -c network_id | grep "$NET_ID" | awk '{print $2}' | head -n 1)
|
|
||||||
|
|
||||||
# This runs a command inside the specific netns
|
# This runs a command inside the specific netns
|
||||||
NET_NS_CMD="ip netns exec qprobe-$PROBE_ID"
|
NET_NS_CMD="ip netns exec $NET_NS"
|
||||||
|
|
||||||
PING_CMD="sudo $NET_NS_CMD ping $REMAINING_ARGS"
|
PING_CMD="sudo $NET_NS_CMD ping $REMAINING_ARGS"
|
||||||
echo "Running $PING_CMD"
|
echo "Running $PING_CMD"
|
||||||
|
Loading…
Reference in New Issue
Block a user