Skip to content

Commit

Permalink
add more checks
Browse files Browse the repository at this point in the history
Signed-off-by: Joji Mekkattuparamban <[email protected]>
  • Loading branch information
jojimt committed Jun 27, 2024
1 parent 3c58080 commit 5ac3d7d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions assets/state-vfio-manager/0400_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,23 @@ data:
get_graphics_aux_dev() {
local gpu=$1
aux_dev="NONE"
device_class_file=$(readlink -f "/sys/bus/pci/devices/$gpu/class")
device_class=$(cat "$device_class_file")
if [ "$device_class" == "0x030000" ]; then
if ls "/sys/bus/pci/devices/$gpu" | grep consumer >& /dev/null; then
aux_dev=$(ls "/sys/bus/pci/devices/$gpu" | grep consumer | awk -Fconsumer:pci: '{print $2}')
if [ "$device_class" == "" ]; then
echo "NONE"
return
fi
if ls "/sys/bus/pci/devices/$aux_dev/" >& /dev/null; then
echo "$aux_dev"
return
fi
fi
fi
echo "$aux_dev"
echo "NONE"
}
bind_device() {
Expand Down

0 comments on commit 5ac3d7d

Please sign in to comment.