[pve-devel] [PATCH container] config: remove apply_pending_device_passthrough helper

Filip Schauer f.schauer at proxmox.com
Wed Jul 30 14:34:45 CEST 2025


This simplifies the code and avoids unnecessary parsing and
re-serializing of the identical device passthrough object.

Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
---
 src/PVE/LXC/Config.pm | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index de963bc..5d7edc4 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1618,8 +1618,8 @@ sub vmconfig_hotplug_pending {
                     die "skip\n"; # don't try to hotplug over existing dev
                 }
 
-                $class->apply_pending_device_passthrough($vmid, $conf, $opt, 1);
-                $value = $conf->{pending}->{$opt};
+                my $dev = $class->parse_device($value);
+                PVE::LXC::device_passthrough_hotplug($vmid, $conf, $dev);
             } else {
                 die "skip\n"; # skip non-hotpluggable
             }
@@ -1739,18 +1739,6 @@ my $rescan_volume = sub {
     warn "Could not rescan volume size - $@\n" if $@;
 };
 
-sub apply_pending_device_passthrough {
-    my ($class, $vmid, $conf, $opt, $running) = @_;
-
-    my $dev = $class->parse_device($conf->{pending}->{$opt});
-    my $old = $conf->{$opt};
-    if ($running) {
-        die "skip\n" if defined($old); # TODO: editing a device passthrough
-        PVE::LXC::device_passthrough_hotplug($vmid, $conf, $dev);
-        $conf->{pending}->{$opt} = $class->print_device($dev);
-    }
-}
-
 sub apply_pending_mountpoint {
     my ($class, $vmid, $conf, $opt, $storecfg, $running) = @_;
 
-- 
2.47.2





More information about the pve-devel mailing list