[pve-devel] [PATCH qemu-server v4 01/12] usb: mapping: move implementation of find_on_current_node here

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Jul 4 13:29:14 CEST 2024


Am 06/06/2024 um 11:22 schrieb Dominik Csapak:
> this was the only user, and it's easy enough
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> no changes
>  PVE/QemuServer/USB.pm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
> index 49957444..ecd0361d 100644
> --- a/PVE/QemuServer/USB.pm
> +++ b/PVE/QemuServer/USB.pm
> @@ -5,6 +5,7 @@ use warnings;
>  use PVE::QemuServer::PCI qw(print_pci_addr);
>  use PVE::QemuServer::Machine;
>  use PVE::QemuServer::Helpers qw(min_version windows_version);
> +use PVE::INotify;
>  use PVE::JSONSchema;
>  use PVE::Mapping::USB;
>  use base 'Exporter';
> @@ -91,7 +92,9 @@ sub parse_usb_device {
>  	    $res->{spice} = 1;
>  	}
>      } elsif (defined($mapping)) {
> -	my $devices = PVE::Mapping::USB::find_on_current_node($mapping);
> +	my $config = PVE::Mapping::USB::config();
> +	my $node = PVE::INotify::nodename();
> +	my $devices = PVE::Mapping::USB::get_node_mapping($config, $mapping, $node);
>  	die "USB device mapping not found for '$mapping'\n" if !$devices || !scalar($devices->@*);
>  	die "More than one USB mapping per host not supported\n" if scalar($devices->@*) > 1;

fine by me, but above could be still in a separate (private) method here in
this module, reducing the noise a bit here.

Same for the PCI one.

>  	eval {





More information about the pve-devel mailing list