mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-01 15:18:29 +00:00
pci: use local helper to generated generate_mdev_uuid
avoid (API) leaking qemu-server specific stuff into pve-common Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
82712fcd3c
commit
e2b42bee6d
@ -224,6 +224,11 @@ sub get_pci_addr_map {
|
|||||||
return $pci_addr_map;
|
return $pci_addr_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my sub generate_mdev_uuid {
|
||||||
|
my ($vmid, $index) = @_;
|
||||||
|
return sprintf("%08d-0000-0000-0000-%012d", $index, $vmid);
|
||||||
|
}
|
||||||
|
|
||||||
my $get_addr_mapping_from_id = sub {
|
my $get_addr_mapping_from_id = sub {
|
||||||
my ($map, $id) = @_;
|
my ($map, $id) = @_;
|
||||||
|
|
||||||
@ -426,7 +431,7 @@ sub print_hostpci_devices {
|
|||||||
my $sysfspath;
|
my $sysfspath;
|
||||||
if ($d->{mdev} && scalar(@$pcidevices) == 1) {
|
if ($d->{mdev} && scalar(@$pcidevices) == 1) {
|
||||||
my $pci_id = $pcidevices->[0]->{id};
|
my $pci_id = $pcidevices->[0]->{id};
|
||||||
my $uuid = PVE::SysFSTools::generate_mdev_uuid($vmid, $i);
|
my $uuid = generate_mdev_uuid($vmid, $i);
|
||||||
$sysfspath = "/sys/bus/pci/devices/$pci_id/$uuid";
|
$sysfspath = "/sys/bus/pci/devices/$pci_id/$uuid";
|
||||||
} elsif ($d->{mdev}) {
|
} elsif ($d->{mdev}) {
|
||||||
warn "ignoring mediated device '$id' with multifunction device\n";
|
warn "ignoring mediated device '$id' with multifunction device\n";
|
||||||
@ -469,7 +474,7 @@ sub prepare_pci_device {
|
|||||||
die "no pci device info for device '$pciid'\n" if !$info;
|
die "no pci device info for device '$pciid'\n" if !$info;
|
||||||
|
|
||||||
if ($mdev) {
|
if ($mdev) {
|
||||||
my $uuid = PVE::SysFSTools::generate_mdev_uuid($vmid, $index);
|
my $uuid = generate_mdev_uuid($vmid, $index);
|
||||||
PVE::SysFSTools::pci_create_mdev_device($pciid, $uuid, $mdev);
|
PVE::SysFSTools::pci_create_mdev_device($pciid, $uuid, $mdev);
|
||||||
} else {
|
} else {
|
||||||
die "can't unbind/bind PCI group to VFIO '$pciid'\n"
|
die "can't unbind/bind PCI group to VFIO '$pciid'\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user