1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F 5885: Select vGPU profile (#2169)

This commit is contained in:
Alejandro Huertas Herrero 2022-06-21 17:15:44 +02:00 committed by GitHub
parent e72a9b0ea7
commit c096e95bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -147,6 +147,15 @@ devices.each do |dev|
# name, in this way Sunstone shows a better name
values << pval('DEVICE_NAME',
"#{dev[:vendor_name]} #{dev[:device_name]}")
# Get profiles
addr = "0000:#{dev[:bus]}:#{dev[:slot]}.#{dev[:function]}"
profiles = `ls /sys/class/mdev_bus/#{addr}/mdev_supported_types`
profiles = profiles.split("\n")
# Comma separated value with different profiles
values << pval('PROFILES', profiles.join(','))
else
values << pval('DEVICE_NAME', dev[:device_name])
end

View File

@ -40,6 +40,7 @@ function get_mdev_path() {
bus=$(get_xpath_val "$pci" "/PCI/BUS")
slot=$(get_xpath_val "$pci" "/PCI/SLOT")
func=$(get_xpath_val "$pci" "/PCI/FUNCTION")
profile=$(get_xpath_val "$pci" "/PCI/PROFILE")
# Generate mdev path
mdev="/sys/class/mdev_bus/$domain:$bus:$slot.$func"
@ -50,10 +51,12 @@ function get_mdev_path() {
exit 1
fi
# TODO: give the user the ability to choose this
device="$(ls "$mdev/mdev_supported_types" | head -n1)"
if [ -z "$profile" ]
then
profile="$(ls "$mdev/mdev_supported_types" | head -n1)"
fi
echo "$mdev/mdev_supported_types/$device/"
echo "$mdev/mdev_supported_types/$profile/"
}
# ------------------------------------------------------------------------------