diff --git a/provisioning_scripts/fibre_channel/invoke_fc_passthrough.sh b/provisioning_scripts/fibre_channel/invoke_fc_passthrough.sh index 1f43e21..5a532af 100644 --- a/provisioning_scripts/fibre_channel/invoke_fc_passthrough.sh +++ b/provisioning_scripts/fibre_channel/invoke_fc_passthrough.sh @@ -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=$?