public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH container] setup: Fix architecture detection for NixOS containers
Date: Tue, 22 Aug 2023 14:35:58 +0200	[thread overview]
Message-ID: <gufttiwlx7gp37k3ysrv2jvpn5cbao3plvu7crcquh4jxkvin4@nitzsuhrqxrl> (raw)
In-Reply-To: <324817da-4c12-a98b-62af-eb9333729edc@proxmox.com>


Thanks for the review!

On Mon, Aug 21, 2023 at 02:50:28PM +0200, Fiona Ebner wrote:
>
> Am 28.02.23 um 11:59 schrieb Christoph Heiss:
> > diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
> > index 891231f..4346c5e 100644
> > --- a/src/PVE/LXC/Setup.pm
> > +++ b/src/PVE/LXC/Setup.pm
> > @@ -131,6 +131,20 @@ sub new {
> >  	$plugin->{rootgid} = $rootgid;
> >      }
> >
> > +    # if arch is unset, we try to autodetect it
> > +    if (!defined($conf->{arch})) {
> > +	my $arch = eval { $self->protected_call(sub { $plugin->detect_architecture() }) };
> > +
>
> The error from the eval should be logged here.
Ack, will do.

>
> > +	if (!defined($arch)) {
> > +	    $arch = 'amd64';
> > +	    print "Falling back to $arch.\nUse `pct set VMID --arch ARCH` to change.\n";
> > +	} else {
> > +	    print "Detected container architecture: $arch\n";
> > +	}
> > +
>
> (...)
>
> > diff --git a/src/PVE/LXC/Setup/NixOS.pm b/src/PVE/LXC/Setup/NixOS.pm
> > index 845d2d5..4f7b93e 100644
> > --- a/src/PVE/LXC/Setup/NixOS.pm
> > +++ b/src/PVE/LXC/Setup/NixOS.pm
> > @@ -5,6 +5,7 @@ use warnings;
> >
> >  use File::Path 'make_path';
> >
> > +use PVE::LXC::Setup;
>
> This is a cyclic include, please let us avoid those. We could either use
> a new helper module for the detect_architecture() helper or otherwise
> move it to pve-guest-common or even pve-common. The detection itself is
> pretty generic after all.
I will probably go this route and simply move it to another module in
pve-container. As long as it is not needed anywhere else, I think it is
sensible to letting it stay close it is only user.

>
> An alternative to that would be to just add a function get_elf_fn() to
> the plugin interface and change the existing detect_architecture() to
> use that.
>
> >  use PVE::LXC::Setup::Base;
> >
> >  use base qw(PVE::LXC::Setup::Base);




      reply	other threads:[~2023-08-22 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-28 10:59 Christoph Heiss
2023-07-03 10:00 ` Christoph Heiss
2023-08-21 12:50 ` Fiona Ebner
2023-08-22 12:35   ` Christoph Heiss [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=gufttiwlx7gp37k3ysrv2jvpn5cbao3plvu7crcquh4jxkvin4@nitzsuhrqxrl \
    --to=c.heiss@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.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