public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] applied: [PATCH v3 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug()
Date: Wed, 22 Feb 2023 10:34:24 +0100	[thread overview]
Message-ID: <20230222093424.lq22u6pzpvw4sq5y@maui.proxmox.com> (raw)
In-Reply-To: <57862005-fc5b-e180-c228-165289067254@proxmox.com>

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.




  reply	other threads:[~2023-02-22  9:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21  8:05 [pve-devel] [PATCH v3 container/manager 0/4] fix #3413: Add `Disconnect` option for LXC networks Christoph Heiss
2023-02-21  8:05 ` [pve-devel] [PATCH v3 container 1/4] lxc: Fix some trailing whitespace Christoph Heiss
2023-02-21 16:59   ` [pve-devel] applied: " Thomas Lamprecht
2023-02-21  8:05 ` [pve-devel] [PATCH v3 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug() Christoph Heiss
2023-02-21 17:07   ` [pve-devel] applied: " Thomas Lamprecht
2023-02-22  9:34     ` Christoph Heiss [this message]
2023-02-21  8:05 ` [pve-devel] [PATCH v3 container 3/4] lxc: Add `link_down` config to allow setting interfaces as disconnected Christoph Heiss
2023-02-21 17:25   ` Thomas Lamprecht
2023-02-22  9:51     ` Christoph Heiss
2023-02-21  8:05 ` [pve-devel] [PATCH v3 manager 4/4] lxc: Add `Disconnect` option for network interfaces Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230222093424.lq22u6pzpvw4sq5y@maui.proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal