SysFSTools: get name from mediated device types

Some vendors also provide a 'name' file here for the type, which, in case of
NVIDIA, is the official name for the vGPU type in their documentation,
so extract and return it too (if it exists).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-08-12 11:29:48 +02:00 committed by Wolfgang Bumiller
parent 2e8331ba22
commit 0fbcf73656

View File

@ -172,11 +172,16 @@ sub get_mdev_types {
my $available = int(file_read_firstline("$type_path/available_instances")); my $available = int(file_read_firstline("$type_path/available_instances"));
my $description = PVE::Tools::file_get_contents("$type_path/description"); my $description = PVE::Tools::file_get_contents("$type_path/description");
push @$types, { my $entry = {
type => $type, type => $type,
description => $description, description => $description,
available => $available, available => $available,
}; };
my $name = file_read_firstline("$type_path/name");
$entry->{name} = $name if defined($name);
push @$types, $entry;
}); });
return $types; return $types;