All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@vates.tech>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Luca Fancellu <luca.fancellu@arm.com>,
	Jan Beulich <jbeulich@suse.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [OSSTEST PATCH] preseed_base: Use "keep" NIC NamePolicy when "force-mac-address"
Date: Wed, 31 Jul 2024 14:08:10 +0000	[thread overview]
Message-ID: <ZqpFSCzWTMl8gxBS@l14> (raw)
In-Reply-To: <bb768c00-0a91-4e47-91b4-21ec31a71f13@citrix.com>

On Tue, Jun 18, 2024 at 12:04:05PM +0100, Andrew Cooper wrote:
> On 18/06/2024 10:44 am, Anthony PERARD wrote:
> > On Mon, Jun 17, 2024 at 04:34:09PM +0100, Andrew Cooper wrote:
> >> On 17/06/2024 3:40 pm, Anthony PERARD wrote:
> >>> diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
> >>> index 3545f3fd..d974fea5 100644
> >>> --- a/Osstest/Debian.pm
> >>> +++ b/Osstest/Debian.pm
> >>> @@ -972,7 +972,19 @@ END
> >>>          # is going to be added to dom0's initrd, which is used by some guests
> >>>          # (created with ts-debian-install).
> >>>          preseed_hook_installscript($ho, $sfx,
> >>> -            '/usr/lib/base-installer.d/', '05ifnamepolicy', <<'END');
> >>> +            '/usr/lib/base-installer.d/', '05ifnamepolicy',
> >>> +            $ho->{Flags}{'force-mac-address'} ? <<'END' : <<'END');
> >> The conditional looks suspicious if both options are <<'END'.
> > That works fine, this pattern is already used in few places in osstest,
> > like here:
> > https://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=ts-host-install;h=0b6aaeeae228551064618abfa624321992a2eb2d;hb=HEAD#l240
> >     >  $ho->{Flags}{'force-mac-address'} ? <<END : <<END);
> >
> > Or even here:
> > https://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=ts-xen-build;h=c294a51eafc26e53b5417529b943224902870acf;hb=HEAD#l173
> >     > buildcmd_stamped_logged(600, 'xen', 'configure', <<END,<<END,<<END);
> >
> >> Doesn't this just write 70-eth-keep-policy.link unconditionally?
> > I've check that, on a different host, and the "mac" name policy is used
> > as expected, so the file "70-eth-keep-policy.link" isn't created on that
> > host.
>
> This is horrifying.  Given a construct which specifically lets you
> choose a semantically meaningful name, using END for all options is rude.
>
> Despite the pre-existing antipatterns, it would be better to turn this
> one into:
>
> $ho->{Flags}{'force-mac-address'} ? <<'END_KEEP' : <<'END_MAC');

I've push the patch with this change.

Cheers,

--

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech



      reply	other threads:[~2024-07-31 14:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 14:40 [OSSTEST PATCH] preseed_base: Use "keep" NIC NamePolicy when "force-mac-address" Anthony PERARD
2024-06-17 15:34 ` Andrew Cooper
2024-06-18  9:44   ` Anthony PERARD
2024-06-18 11:04     ` Andrew Cooper
2024-07-31 14:08       ` Anthony PERARD [this message]

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=ZqpFSCzWTMl8gxBS@l14 \
    --to=anthony.perard@vates.tech \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=luca.fancellu@arm.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.