From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH container 2/2] setup: add helper to disable static units when fixing up templates
Date: Fri, 8 Nov 2024 14:47:44 +0100 (CET) [thread overview]
Message-ID: <858958319.548.1731073664495@webmail.proxmox.com> (raw)
In-Reply-To: <d5199932-43a1-401e-8eed-63925f168eeb@proxmox.com>
> Thomas Lamprecht <t.lamprecht@proxmox.com> hat am 08.11.2024 14:40 CET geschrieben:
>
>
> Am 08/11/2024 um 14:18 schrieb Fabian Grünbichler:
> > modelled after setup_systemd_preset, which unfortunately doesn't work for
> > static units, since those are skipped by `systemctl preset-all` which runs on
> > first boot.
> >
> > our Debian-based templates already come with those masking symlinks in place.
>
> yeah, I added symlinking those units to /dev/null in the DAB and AAB
> image builders, but thanks for providing the generic way.
I didn't check all distros, there might be others that would also benefit (or at least, become a bit less noisy). But given that this is mainly to cleanup the container journal/systemctl status, it's not super important.
> >
> > Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> > ---
> >
> > Notes:
> > noticed while testing the openEuler template
> >
> > src/PVE/LXC/Setup/Base.pm | 23 +++++++++++++++++++++++
> > src/PVE/LXC/Setup/CentOS.pm | 2 ++
> > src/PVE/LXC/Setup/OpenEuler.pm | 1 +
> > 3 files changed, 26 insertions(+)
> >
> > diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
> > index 084b039..decd62a 100644
> > --- a/src/PVE/LXC/Setup/Base.pm
> > +++ b/src/PVE/LXC/Setup/Base.pm
> > @@ -352,6 +352,29 @@ sub setup_systemd_preset {
> > );
> > }
> >
> > +# some units cannot be disabled via presets because they are static
> > +# this helper can be called as part of template_fixup to explicitly mask them instead
> > +sub setup_systemd_disable_static_units {
> > + my ($self, $extra_units) = @_;
> > +
> > + # some don't make sense in CTs, child-plugins can add extra units via $extra_preset
> > + my $units = [
> > + 'sys-kernel-config.mount',
> > + 'sys-kernel-debug.mount',
> > + ];
> > +
> > + if (defined($extra_units)) {
> > + for my $unit (@$extra_units) {
> > + push @$units, $unit;
> > + }
> > + }
> > +
>
> would apply this with the following squashed in as there's no need for
> allocations/copies here, if you have no objection?
yes, fine by me :)
> diff --git a/src/PVE/LXC/Setup/Base.pm b/src/PVE/LXC/Setup/Base.pm
> index decd62a..bb084af 100644
> --- a/src/PVE/LXC/Setup/Base.pm
> +++ b/src/PVE/LXC/Setup/Base.pm
> @@ -363,13 +363,7 @@ sub setup_systemd_disable_static_units {
> 'sys-kernel-debug.mount',
> ];
>
> - if (defined($extra_units)) {
> - for my $unit (@$extra_units) {
> - push @$units, $unit;
> - }
> - }
> -
> - for my $unit (@$units) {
> + for my $unit ($units->@*, $extra_units->@*) {
> $self->ct_symlink('/dev/null', "/etc/systemd/system/$unit")
> if !$self->ct_file_exists("/etc/systemd/system/$unit");
> }
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-11-08 13:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-08 13:18 [pve-devel] [PATCH container 1/2] fix #5720: add setup support for openEuler Fabian Grünbichler
2024-11-08 13:18 ` [pve-devel] [PATCH container 2/2] setup: add helper to disable static units when fixing up templates Fabian Grünbichler
2024-11-08 13:40 ` Thomas Lamprecht
2024-11-08 13:47 ` Fabian Grünbichler [this message]
2024-11-08 13:53 ` [pve-devel] applied-series: [PATCH container 1/2] fix #5720: add setup support for openEuler Thomas Lamprecht
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=858958319.548.1731073664495@webmail.proxmox.com \
--to=f.gruenbichler@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 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.