Move HBA online check

This patch moves the test for the HBA to after it's been
reattached to the host driver.   The current check will always
fail, because it will never see it.

The host driver will never see the HBA until after the virsh reattach
command runs.

Change-Id: I74255576e2b7f31dcb35c87bbf7fc270d6d736b0
This commit is contained in:
Walter A. Boring IV 2015-11-18 10:52:52 -08:00 committed by Walter A. Boring IV (hemna)
parent 912809b0fa
commit f4e427216e

View File

@ -146,22 +146,12 @@ function is_device_online() {
exit_code=1
errexit=$(set +o | grep errexit)
#Ignore errors
# Ignore errors
set +e
let num_attached=0
for pci in $fc_pci_device; do
echo "Trying passthrough for $pci"
is_device_online $pci
online=$?
if [ $online -eq 1 ]; then
echo "Device($pci) is Online"
else
echo "Device($pci) is NOT Online"
# It does no good to passthrough an HBA that isn't Online.
# When an HBA goes into 'Linkdown' or 'Offline' mode, the
# host typically needs to get rebooted.
continue
fi
BUS=$(echo $pci | cut -d : -f2)
SLOT=$(echo $pci | cut -d : -f3 | cut -d . -f1)
FUNCTION=$(echo $pci | cut -d : -f3 | cut -d . -f2)
@ -199,6 +189,20 @@ for pci in $fc_pci_device; do
continue
fi
# Now that the device has been re-attached to it's host device driver
# systool should be able to see it. Make sure it's online.
is_device_online $pci
online=$?
if [ $online -eq 1 ]; then
echo "Device($pci) is Online"
else
echo "Device($pci) is NOT Online"
# It does no good to passthrough an HBA that isn't Online.
# When an HBA goes into 'Linkdown' or 'Offline' mode, the
# host typically needs to get rebooted.
continue
fi
echo $(sudo lspci | grep -i fib)
ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "virsh attach-device $VIRSH_NAME $fcoe"
attach_result=$?