From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1F1C393BB7 for ; Wed, 22 Feb 2023 10:34:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EDA72CF2E for ; Wed, 22 Feb 2023 10:34:26 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 22 Feb 2023 10:34:26 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0C01E480B5 for ; Wed, 22 Feb 2023 10:34:26 +0100 (CET) Date: Wed, 22 Feb 2023 10:34:24 +0100 From: Christoph Heiss To: Thomas Lamprecht Cc: Proxmox VE development discussion Message-ID: <20230222093424.lq22u6pzpvw4sq5y@maui.proxmox.com> References: <20230221080550.43336-1-c.heiss@proxmox.com> <20230221080550.43336-3-c.heiss@proxmox.com> <57862005-fc5b-e180-c228-165289067254@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57862005-fc5b-e180-c228-165289067254@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.103 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] applied: [PATCH v3 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug() X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2023 09:34:57 -0000 Thanks! On Tue, Feb 21, 2023 at 06:07:20PM +0100, Thomas Lamprecht wrote: > Am 21/02/2023 um 09:05 schrieb Christoph Heiss: > > [..] > > > > applied, thanks! But I got some feedback/question inline affecting patch 3/4 > > > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > > index cbbb82d..d419124 100644 > > --- a/src/PVE/LXC.pm > > +++ b/src/PVE/LXC.pm > > @@ -918,6 +918,18 @@ sub vm_stop_cleanup { > > warn $@ if $@; # avoid errors - just warn > > } > > > > +sub net_tap_plug : prototype($$$$$$;$) { > > + my ($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts) = @_; > > IMO having more than ~5 parameter is most of the time a code smell, and sure while we > ain't in rust where we can ensure some sane API and existence of struct/trait members > or methods it's not really that better to expand everything, as scalar on it's own is > way to broad anyway to guarantee anything relevant on calling. I agree, it indeed is not all that sane. Plus it really clutters up all the callsites. > > So, maybe we could change this to take > > sub net_tap_plug : prototype($$;$) { > my ($iface, $net, $old_net) = @_; > > as then we might even pull in the whole link_down logic separation in here and avoid > duplicating that then again (after just cleaning something similar like that up here). > > What do you think? Sounds like a very reasonable idea, especially being able to de-duplicate the whole link_down logic later on. I didn't even notice that I was basically introducing the same pattern again that I cleaned up .. I'll rework this a send a re-spin of patch 3/4 soon.