public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: Wolfgang Bumiller <w.bumiller@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v2 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug()
Date: Mon, 20 Feb 2023 12:17:19 +0100	[thread overview]
Message-ID: <20230220111719.kovqzf7khvckcsa6@maui.proxmox.com> (raw)
In-Reply-To: <20230217143424.6pp3dao2t3ho6uhu@fwblub>

Thanks for the review!

On Fri, Feb 17, 2023 at 03:34:24PM +0100, Wolfgang Bumiller wrote:
> On Wed, Feb 15, 2023 at 03:02:43PM +0100, Christoph Heiss wrote:
> > This pattern is used in multiple places, thus extract it into a
> > subroutine on its own.
> >
> > No functional changes.
> >
> > Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
> > ---
> > Might not be the best place for net_tap_plug(), putting this logic
> > inside PVE::Network would probably make more sense. But that would
> > entail a (bigger) refactoring, since it then also must be done for all
> > other tap_*() and veth_*() subroutines (and maybe some other things?)
> > for consistency..
> > In any case, that definitely would be too much for this series. I can do
> > that, but I'd do it as a follow-up series.
> >
> > Changes v1 -> v2:
> >  * New patch
> >
> >  src/PVE/LXC.pm  | 28 ++++++++++++++++------------
> >  src/lxcnetaddbr | 15 ++-------------
> >  2 files changed, 18 insertions(+), 25 deletions(-)
> >
> > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> > index 345e343..0de5ba3 100644
> > --- a/src/PVE/LXC.pm
> > +++ b/src/PVE/LXC.pm
> > @@ -917,6 +917,18 @@ sub vm_stop_cleanup {
> >      warn $@ if $@; # avoid errors - just warn
> >  }
> >
> > +sub net_tap_plug {
> > +    if ($have_sdn) {
> > +	my ($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts) = @_;
>
> ^ please don't do this conditional on `$have_sdn`. This just makes it
> harder to figure out how to use the function later (ie. quicker to write
> this one time now at the cost of reduced maintainability in the future).
>
> I'd much rather additionally have a prototype on the sub which may even
> declare the $opts parameter explicitly as being optional like so:
>
>     sub net_tap_plug : prototype($$$$$$;$) {
>         my ($iface, $bridge, $tag, $firewall, $trunks, $rate, $opts) = @_;
>         ...
Ack, will change that for v2. Wasn't sure about prototypes in Perl yet,
good time for me to read up on them a bit. Thanks again!

>
> Apart from that, the refactoring makes sense.




  reply	other threads:[~2023-02-20 11:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 14:02 [pve-devel] [PATCH v2 container/manager 0/4] fix #3413: Add `Disconnect` option for LXC networks Christoph Heiss
2023-02-15 14:02 ` [pve-devel] [PATCH v2 container 1/4] lxc: Fix some trailing whitespace Christoph Heiss
2023-02-17 14:22   ` Wolfgang Bumiller
2023-02-20 11:13     ` Christoph Heiss
2023-02-15 14:02 ` [pve-devel] [PATCH v2 container 2/4] lxc: Avoid open-coding normal vs SDN-specific tap_plug() Christoph Heiss
2023-02-17 14:34   ` Wolfgang Bumiller
2023-02-20 11:17     ` Christoph Heiss [this message]
2023-02-15 14:02 ` [pve-devel] [PATCH v2 container 3/4] lxc: Add `link-down` config to allow setting interfaces as disconnected Christoph Heiss
2023-02-17 14:51   ` Wolfgang Bumiller
2023-02-17 16:38     ` Thomas Lamprecht
2023-02-20 11:51       ` Christoph Heiss
2023-02-20 12:33         ` Wolfgang Bumiller
2023-02-20 12:37           ` Thomas Lamprecht
2023-02-15 14:02 ` [pve-devel] [PATCH v2 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=20230220111719.kovqzf7khvckcsa6@maui.proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=w.bumiller@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