The fix introduced in 5b5db0e67 fixed the scenario where pins were
already applied, but broke the case where they weren't yet applied,
since now not-yet-applied pins would get overwritten again on
subsequent invocations of the pinning tool.

Move the check for the same name to the update_etc_network_interfaces
call, where it is actually required - instead of filtering already in
the resolve_pinned function, which is also used in the generate body
to filter eligible links for pinning.

Fixes: 5b5db0e67
Signed-off-by: Stefan Hanreich <s.hanre...@proxmox.com>
---
 PVE/CLI/proxmox_network_interface_pinning.pm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/PVE/CLI/proxmox_network_interface_pinning.pm 
b/PVE/CLI/proxmox_network_interface_pinning.pm
index 42f53575c..30815d3a1 100644
--- a/PVE/CLI/proxmox_network_interface_pinning.pm
+++ b/PVE/CLI/proxmox_network_interface_pinning.pm
@@ -62,7 +62,7 @@ my sub update_etc_network_interfaces {
         for my $iface_name (keys $old_ifaces->%*) {
             my $iface = $old_ifaces->{$iface_name};
 
-            if ($existing_pins->{$iface_name}) {
+            if ($existing_pins->{$iface_name} && $existing_pins->{$iface_name} 
ne $iface_name) {
                 # reading the interfaces file adds active interfaces to the
                 # configuration - we do not want to include already pinned
                 # interfaces in the new configuration when writing the new
@@ -311,8 +311,7 @@ sub resolve_pinned {
             next;
         }
 
-        $resolved->{ $mac_lookup{$mac} } = $pinned->{$mac}
-            if $mac_lookup{$mac} ne $pinned->{$mac};
+        $resolved->{ $mac_lookup{$mac} } = $pinned->{$mac};
     }
 
     return $resolved;
-- 
2.39.5


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to