Patrick East 781abe4833 Add some Fibre Channel helper scripts
Credit for these should go to Ramy Asselin. I borrowed the original
versions of these and modified them a bit to work in my system. The
largest change was in the invoke-cf-passthrough function which now is a
standalone script that looks for environment variables for some
parameters. In addition instead of using the gateway x.x.x.1 address to
connect to a hypervisor it will check nova for the host and then connect
with its hostname. This allows it to work for systems using neutron that
cannot ssh through the gateway address. In addition it will try to add
all fc pci devices and not stop after one success. This means if you
are set up for multipathing on the host with multiple hba’s each one
will get passed through to the test node.

The general flow of how to use these is to run the setup script on a
nodepool provider first. Then as part of the jenkins job (or nodepool
ready script) run the passthrough script. At some point in the
process you need to install the fc driver, this should work fine either
as part of the image build process or any point before doing the
passthrough.

Co-Authored-by: Ramy Asselin ramy.asselin@hp.com

Change-Id: Ieba77e99f9d2949f92060483deb58975324e770c
2015-05-13 17:52:53 -07:00

38 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# Copyright (C) 2015 Hewlett-Packard Development Company, L.P.
# Copyright (C) 2015 Pure Storage, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
# Run this as root on the OpenStack provider to setup the fc_pci_device
# environment variable needed for FC CI testing.
#
# If needed it will add an entry to /etc/profile.d/ with the variable.
if [[ -z $fc_pci_device ]]; then
# Get all 'online' fc_host
# Don't override any pre-set values because the device may not be "Online"
# on subsequent runs
HOST=$(sudo systool -c fc_host -A port_state | grep -B1 -m 1 "Online")
if [[ -z $HOST ]]; then
echo "Error, unable to find a FC Host that is 'Online'. You can add the 'fc_pci_device' variable manually to vars.sh"
else
fc_pci_device=$(systool -c fc_host -v | grep -B12 "Online" | grep "Class Device path" | cut -d / -f 6 | tr '\n' ' ')
echo "Auto-detected FC PCI DEVICE: $fc_pci_device"
fi
echo export $fc_pci_device >> /etc/profile.d/fc_devices.sh
fi