Reattach the PCI device to host driver
This patch adds the ability to do a virsh nodedev-reattach of the PCI device. This detaches the PCI device from the pci-stub to it's original host driver (lpfc) in the hope that it does a reset of the device upon reattach. Change-Id: Ib44a35820015b98e13beb628d1625a33eeafc96b
This commit is contained in:
parent
dcd9605f5e
commit
a019f0f571
@ -33,6 +33,7 @@ ALLOWED_CMDS="
|
||||
^source keystonerc_jenkins \&\& nova list$
|
||||
^source keystonerc_jenkins \&\& nova show [a-f0-9]+-[a-f0-9]+-[a-f0-9]+-[a-f0-9]+-[a-f0-9]+$
|
||||
^virsh nodedev-dettach pci_0000_[02][51]_00_[23]$
|
||||
^virsh nodedev-reattach pci_0000_[02][51]_00_[23]$
|
||||
^scp -t /tmp/$
|
||||
^virsh attach-device instance-[0-9a-f]* /tmp/tmp.*_fcoe.xml$
|
||||
^echo \\\$fc_pci_device$"
|
||||
|
@ -143,6 +143,8 @@ for pci in $fc_pci_device; do
|
||||
fcoe=`mktemp --suffix=_fcoe.xml`
|
||||
echo $XML > $fcoe
|
||||
|
||||
fc_virsh_device="pci_0000_${BUS}_${SLOT}_${FUNCTION}"
|
||||
|
||||
scp -i $PROVIDER_KEY $fcoe $PROVIDER_USER@$HYPERVISOR:/tmp/
|
||||
|
||||
# Run passthrough and clean up.
|
||||
@ -150,12 +152,23 @@ for pci in $fc_pci_device; do
|
||||
# will need to do this cleanup at the end of the job and not *before* attaching
|
||||
# since we won't know which ones are still in use
|
||||
echo $(sudo lspci | grep -i fib)
|
||||
ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "virsh nodedev-dettach pci_0000_${BUS}_${SLOT}_${FUNCTION}"
|
||||
ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "virsh nodedev-dettach $fc_virsh_device"
|
||||
|
||||
detach_result=$?
|
||||
echo "Detach result: $detach_result"
|
||||
if [[ $detach_result -ne 0 ]]; then
|
||||
echo "Detach failed. Trying next device..."
|
||||
echo "Detach failed ($detach_result). Trying next device..."
|
||||
continue
|
||||
fi
|
||||
|
||||
# Reattach the device to the host.
|
||||
# This will hopefully reset the device
|
||||
echo $(sudo lspci | grep -i fib)
|
||||
ssh -i $PROVIDER_KEY $PROVIDER_USER@$HYPERVISOR "virsh nodedev-reattach $fc_virsh_device"
|
||||
reattach_result=$?
|
||||
echo "reattach result: $reattach_result"
|
||||
if [[ $reattach_result -ne 0 ]]; then
|
||||
echo "Reattach failed ($reattach_result). Trying next device..."
|
||||
continue
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user