]> git.proxmox.com Git - pve-container.git/log
pve-container.git
5 days agotests: add expected output for systemd network config master
Thomas Lamprecht [Thu, 12 Sep 2024 11:04:11 +0000 (13:04 +0200)]
tests: add expected output for systemd network config

this also fixes an issue where the missing /etc/systemd/network base
directory would cause the test to fail.
This was masked here on my development setup due to having an empty
directory left over from trying things, and git doesn't care about
empty directories at all..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 days agosetup tests: check /etc/systemd/network/eth0.network
Thomas Lamprecht [Thu, 12 Sep 2024 11:02:58 +0000 (13:02 +0200)]
setup tests: check /etc/systemd/network/eth0.network

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 days agosetup tests: trivial whitespace cleanup
Thomas Lamprecht [Thu, 12 Sep 2024 11:02:26 +0000 (13:02 +0200)]
setup tests: trivial whitespace cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 days agolintian: ignore source-is-missing for tiny ELF file used for arch detection test
Thomas Lamprecht [Thu, 12 Sep 2024 10:55:22 +0000 (12:55 +0200)]
lintian: ignore source-is-missing for tiny ELF file used for arch detection test

Fixes: 7117c8e ("tests: setup fedora: add fake /bin/sh to test
 architecture detection")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agobump version to 5.2.0
Thomas Lamprecht [Tue, 10 Sep 2024 14:47:08 +0000 (16:47 +0200)]
bump version to 5.2.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agoapi: autocomplete rootdir storages for create, move-volume and clone
Daniel Kral [Tue, 10 Sep 2024 11:23:42 +0000 (13:23 +0200)]
api: autocomplete rootdir storages for create, move-volume and clone

Adds a helper subroutine for enumerating storages that are enabled and
have the content type `rootdir` set, therefore supporting container
directories.

The autocompletion is added to the clone command and changed for the
create and move-volume commands, which previously suggested any storage
device. This is misleading as these commands will fail for any storage
that is not configured to store container directories.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
7 days agolxc config generation: opinionated style/code clean-up
Thomas Lamprecht [Tue, 10 Sep 2024 14:29:31 +0000 (16:29 +0200)]
lxc config generation: opinionated style/code clean-up

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agoadd deny-write option for device passthrough
Filip Schauer [Mon, 9 Sep 2024 12:50:46 +0000 (14:50 +0200)]
add deny-write option for device passthrough

Add the deny-write options for device passthrough, to restrict container
access to devices.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
7 days agobackup: warn that tar does not honor exclusion pattern with a trailing slash
Fiona Ebner [Fri, 31 May 2024 10:07:52 +0000 (12:07 +0200)]
backup: warn that tar does not honor exclusion pattern with a trailing slash

As reported in the community forum [0], for tar, an exclusion pattern
with a trailing slash will not match a folder with that name. For
rsync and proxmox-backup-client however, such a pattern will exclude
a directory with that name, but not a file.

rsync is used for 'suspend' mode backup and tar is used for all
non-PBS backups to create the archive. So currently, in the presence
of an exclusion pattern with a trailing slash, there is inconsistency
between different backup modes (because for 'suspend' mode, rsync will
already do the exclusion too) as well as between PBS and non-PBS
backups.

There doesn't seem to be a straight-forward way to align the behavior
for tar with command-line options exactly. The trailing slash can't be
removed from the pattern, because that would also match files.
Matching with
> some/pattern/*
> some/pattern/.*
rather than
> some/pattern/
gets pretty close, which was suggested by Dominik. Just the empty
directory is still included.

In any case, modifying current behavior would be a breaking change, so
actually aligning the exclusion (more closely) is better done in the
next major release.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
7 days agotests: setup fedora: add fake /bin/sh to test architecture detection
Thomas Lamprecht [Tue, 10 Sep 2024 14:11:03 +0000 (16:11 +0200)]
tests: setup fedora: add fake /bin/sh to test architecture detection

Just use the first 20 bytes of an amd64 ELF header as our detection
mechanism checks exactly those for the machine byte

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agotests: add setup test for fedora 41
Thomas Lamprecht [Tue, 10 Sep 2024 14:10:30 +0000 (16:10 +0200)]
tests: add setup test for fedora 41

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agofedora setup: drop checking for to new version
Thomas Lamprecht [Tue, 10 Sep 2024 13:31:30 +0000 (15:31 +0200)]
fedora setup: drop checking for to new version

If a version is really not supported nothing should eat the users data
but rather just not start.

Plus the churn w.r.t. namespace types and features in the kernel and
how systemd interacts with those has slowed quite a bit down nowadays.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 days agofix #5666: fix quota regression due to device passthrough
Filip Schauer [Tue, 27 Aug 2024 11:46:43 +0000 (13:46 +0200)]
fix #5666: fix quota regression due to device passthrough

This commit fixes a regression introduced by
commit ce1976b85361 ("Add device passthrough")

Prior to the addition of device passthrough, the `lxc-pve-autodev-hook`
would invoke `PVE::LXC::Tools::for_current_devices` only once. If the
device list was empty, `exit 0` would be called and the
`lxc-pve-autodev-hook` would exit.

However, with the new device passthrough logic, when no devices were
passed through, the `exit` call would be encountered prematurely.
This would prevent the subsequent iteration over passthrough mounts from
occurring.

This commit resolves the issue by replacing the premature `exit` call
with a `return` statement, ensuring the `lxc-pve-autodev-hook` continues
executing and processes the passthrough mounts as expected.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
11 days agofix #5674: add missing 'proxyto' for LXC interfaces API
Fabian Grünbichler [Mon, 2 Sep 2024 12:25:36 +0000 (14:25 +0200)]
fix #5674: add missing 'proxyto' for LXC interfaces API

else this API endpoint would only work when connected to the node where the
container is currently running.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
11 days agoMerge remote-tracking branch 'origin/master'
Thomas Lamprecht [Fri, 6 Sep 2024 17:11:05 +0000 (19:11 +0200)]
Merge remote-tracking branch 'origin/master'

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 months agoapi: lxc: add 'interfaces' endpoint to the index
Johannes Cornelis Draaijer via pve-devel [Thu, 18 Apr 2024 20:49:32 +0000 (22:49 +0200)]
api: lxc: add 'interfaces' endpoint to the index

Signed-off-by: Johannes Cornelis Draaijer <jcdra1@gmail.com>
3 months agobump version to 5.1.12
Thomas Lamprecht [Tue, 18 Jun 2024 07:18:03 +0000 (09:18 +0200)]
bump version to 5.1.12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agod/control: relax versioned dependency for backup client again
Thomas Lamprecht [Tue, 18 Jun 2024 07:13:35 +0000 (09:13 +0200)]
d/control: relax versioned dependency for backup client again

This is for the experimental new `pbs-change-detection-mode` feature,
and due to some uncoordinated moving of updates this causes fallout on
upgrade.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 months agobackup: log errors from rsync
Fiona Ebner [Mon, 6 May 2024 12:40:43 +0000 (14:40 +0200)]
backup: log errors from rsync

Commit 5582b0c ("vzdump: rsync: make less verbose") talks about making
the output less verbose, but it likely did not intended to get rid of
the error messages from rsync, but only the uninteresting messages to
stdout.

The currently used log function is only matching the total
transferred and ignores everything else. Split it into an output and
error function and log all error messages from rsync.

Excerpt from the output with the patch:

> INFO: starting first sync /proc/55667/root/ to /mnt/tmp/vzdumptmp62235_113/
> ERROR: rsync: [sender] send_files failed to open "/proc/55667/root/foo/file": Input/output error (5)
> ERROR: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
> ERROR: Backup of VM 113 failed - command 'rsync --stats -h -X -A --numeric-ids -aH --delete --no-whole-file --sparse --one-file-system --relative '--exclude=/tmp/?*' '--exclude=/var/tmp/?*' '--exclude=/var/run/?*.pid' /proc/55667/root//./ /proc/55667/root//./foo /mnt/tmp/vzdumptmp62235_113/' failed: exit code 23
> INFO: Failed at 2024-05-06 14:21:58
> INFO: Backup job finished with errors

Without the patch, the first two error messages with the root cause of
the issue would not be shown, confusing users and leaving developers
in the dark when trying to help.

Examples from the forum:
https://forum.proxmox.com/threads/146415/post-660946
https://forum.proxmox.com/threads/101810/
https://forum.proxmox.com/threads/101560/
https://forum.proxmox.com/threads/79572/post-352377

Fixes: 5582b0c ("vzdump: rsync: make less verbose")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
3 months agobump version to 5.1.11
Fabian Grünbichler [Mon, 10 Jun 2024 11:58:56 +0000 (13:58 +0200)]
bump version to 5.1.11

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agod/control: bump pve-guest-common and proxmox-backup-client
Fabian Grünbichler [Mon, 10 Jun 2024 11:57:37 +0000 (13:57 +0200)]
d/control: bump pve-guest-common and proxmox-backup-client

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 months agovzdump: conditionally set PBS change detection mode option
Christian Ebner [Mon, 10 Jun 2024 09:57:44 +0000 (11:57 +0200)]
vzdump: conditionally set PBS change detection mode option

Allows to switch the backup clients change detection mode based on
the option set in the backup jobs configuration for backup jobs with
Proxmox Backup Server target.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
4 months agod/control: bump versioned dependency for guest-common
Thomas Lamprecht [Wed, 15 May 2024 17:25:53 +0000 (19:25 +0200)]
d/control: bump versioned dependency for guest-common

To ensure schema is correct for being validated properly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 months agoremote migration: enable schema validation
Fabian Grünbichler [Wed, 15 May 2024 10:10:06 +0000 (12:10 +0200)]
remote migration: enable schema validation

by wrapping the properties from the command definition to get an
actual schema definition.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 months agobump version to 5.1.10
Thomas Lamprecht [Thu, 2 May 2024 12:37:13 +0000 (14:37 +0200)]
bump version to 5.1.10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 months agosetup: unlink default netplan configuration even with Ubuntu >= 23.04
Fiona Ebner [Tue, 30 Apr 2024 14:42:48 +0000 (16:42 +0200)]
setup: unlink default netplan configuration even with Ubuntu >= 23.04

It seems like commit 02d9462 ("setup: enable systemd-networkd via
preset for ubuntu 23.04+") also resulted in the default netplan
configuration no longer being unlinked. That should still happen, even
if systemd-networkd is now enabled via preset. Otherwise, the network
configuration created by Proxmox VE is not ordered before the one
generated by netplan and thus not applied by systemd-networkd.

Reported in the community forum:
https://forum.proxmox.com/threads/145848/post-658058

Fixes: 02d9462 ("setup: enable systemd-networkd via preset for ubuntu 23.04+")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
4 months agosetup: support Ubuntu 24.04 Noble
Fiona Ebner [Tue, 30 Apr 2024 14:42:47 +0000 (16:42 +0200)]
setup: support Ubuntu 24.04 Noble

Minimally tested, that an upgrade from an existing 23.04 container
works, there still is network and no obviously bad messages in the
container's journal.

Reported in the community forum:
https://forum.proxmox.com/threads/145848/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
4 months agofix #5414: use proper percentages in `pct df`
Fabian Grünbichler [Thu, 25 Apr 2024 07:40:13 +0000 (09:40 +0200)]
fix #5414: use proper percentages in `pct df`

while some people write percentages as 0.XX , putting a % next to that is just
confusing. also, combined with the format modifier this would be rather lossy,
and also not match regular `df` output..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 months agobump version to 5.0.11
Thomas Lamprecht [Wed, 24 Apr 2024 12:28:04 +0000 (14:28 +0200)]
bump version to 5.0.11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 months agoapi: fix regression with locking start-after-create
Thomas Lamprecht [Wed, 24 Apr 2024 12:21:20 +0000 (14:21 +0200)]
api: fix regression with locking start-after-create

The API now correctly forks first a worker and then locks the config
in for the actual creation, but this broke the start-after-create
feature, as that also locks the config.

Use the same approach like in qemu-server and just do the start after
the create, outside of the lock.

While this has a small race window where another API call could lock
the newly created CT again, we never really guaranteed that the start
after create param is guaranteed atomic.

Even if we want to guarantee that someday, we can still do so, but
this is a good stop-gap until then and worked fine for VMs since its
introduction.

Fixes: 7a73568 ("api: status: move config locking from API handler into worker")
Reported-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Tested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
4 months agobump version to 5.0.10
Thomas Lamprecht [Fri, 19 Apr 2024 18:33:07 +0000 (20:33 +0200)]
bump version to 5.0.10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 months agofirewall: add handling for new nft firewall
Stefan Hanreich [Fri, 19 Apr 2024 09:42:35 +0000 (11:42 +0200)]
firewall: add handling for new nft firewall

When the nftables firewall is enabled, we do not need to create
firewall bridges.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
 [ TL: use a more meaningful variable name and add a comment ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agoapi: stop: reword overrule-shutdown parameter description
Friedrich Weber [Thu, 18 Apr 2024 13:46:36 +0000 (15:46 +0200)]
api: stop: reword overrule-shutdown parameter description

The previous wording made it sound like all "visible" tasks were
aborted, which is not the case: A user with Sys.Audit but without
Sys.Modify may see a task that was started by a different user, but
overrule-shutdown would not abort the task.

Change wording to better reflect that not all visible tasks may be
aborted.

Also, add a full-stop that was previously missing.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
5 months agovolume mount: make adding noacl more efficient
Thomas Lamprecht [Thu, 18 Apr 2024 13:48:46 +0000 (15:48 +0200)]
volume mount: make adding noacl more efficient

Move this special case handling inside the code branch where we
already got the format available to avoid calling parse_volname twice.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agod/control: record build-dependency for dh-apparmor
Thomas Lamprecht [Thu, 18 Apr 2024 13:41:46 +0000 (15:41 +0200)]
d/control: record build-dependency for dh-apparmor

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agoformat disk: set FS root uid/gid for passed through /dev/ volumes
Thomas Lamprecht [Thu, 18 Apr 2024 13:19:36 +0000 (15:19 +0200)]
format disk: set FS root uid/gid for passed through /dev/ volumes

When calling mkfs one must pass the root uid/gid parameter along side
as they are used unconditionally, but this wasn't done for the edge
case where a block device from the host was used as volume for the CT,
causing an undef warning.

Note that this code branch is not reachable currently, but that might
change. For now add a FIXME comment to mark this for removal, as we
probably do not want to format devices from /dev/ in any way (and no
user reported that this was broken, so use case seems to be
non-existent).

Fixes: d216e89 ("unprivileged: remove bad chown -R call")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agotree-wide: style fixes for root uid/gid variable name
Thomas Lamprecht [Thu, 18 Apr 2024 13:17:49 +0000 (15:17 +0200)]
tree-wide: style fixes for root uid/gid variable name

no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agovolume mount: code clean-up & reduction
Thomas Lamprecht [Thu, 18 Apr 2024 12:55:15 +0000 (14:55 +0200)]
volume mount: code clean-up & reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agofix #4846: Avoid the outdated noacl mount option on ext4
Filip Schauer [Wed, 17 Apr 2024 14:35:53 +0000 (16:35 +0200)]
fix #4846: Avoid the outdated noacl mount option on ext4

Do not use the 'noacl' mount option when mounting a container disk with
an ext4 file system. The option was deprecated in kernel commit
f70486055ee3 ("ext4: try to deprecate noacl and noxattr_user mount
options") (v3.4) as it no other filesystem exposed disabling ACL as
mount option, and then finally got removed in commit 2d544ec923db ("ext4:
remove deprecated noacl/nouser_xattr options") (v6.1).

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agod/control: bump versioned dependencies for libpve-guest-common-perl
Thomas Lamprecht [Wed, 17 Apr 2024 15:42:54 +0000 (17:42 +0200)]
d/control: bump versioned dependencies for libpve-guest-common-perl

to ensure that the new abort_guest_tasks helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agofix #4474: lxc api: add overrule-shutdown parameter to stop endpoint
Friedrich Weber [Fri, 12 Apr 2024 14:15:50 +0000 (16:15 +0200)]
fix #4474: lxc api: add overrule-shutdown parameter to stop endpoint

The new `overrule-shutdown` parameter is boolean and defaults to 0. If
it is 1, all active `vzshutdown` tasks for the same CT (which are
visible to the user/token) are aborted before attempting to stop the
CT.

Passing `overrule-shutdown=1` is forbidden for HA resources.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
5 months agoconfig: add missing use statement for LXC::Tools module
Fiona Ebner [Tue, 16 Apr 2024 10:50:41 +0000 (12:50 +0200)]
config: add missing use statement for LXC::Tools module

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agofix invalid device passthrough being added to config
Filip Schauer [Tue, 16 Apr 2024 09:27:17 +0000 (11:27 +0200)]
fix invalid device passthrough being added to config

Fix a bug that allows a device passthrough entry to be added to the
config despite the device path not pointing to a device. Previously,
adding an invalid device passthrough entry would throw an error, but the
entry would still be added to the config. This is fixed by moving the
respective checks from update_lxc_config to update_pct_config, which is
run before the entry is written to the config file.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
[FE: drop hunk for use statements left-over from earlier version]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agopct: fsck: add missing call to activate volume
Fiona Ebner [Fri, 12 Apr 2024 11:08:14 +0000 (13:08 +0200)]
pct: fsck: add missing call to activate volume

Otherwise, running pct fsck for e.g. an LVM volume after shutting down
a container would fail.

The container is not running, so the volume should be deactivated
afterwards.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agopct: fsck: also unmap when fsck command failed
Fiona Ebner [Fri, 12 Apr 2024 11:08:13 +0000 (13:08 +0200)]
pct: fsck: also unmap when fsck command failed

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agomountpoint mount: activate PVE-managed volumes during preparation
Fiona Ebner [Fri, 12 Apr 2024 11:08:12 +0000 (13:08 +0200)]
mountpoint mount: activate PVE-managed volumes during preparation

Otherwise it was not possible to hotplug a volume that was previously
deactivated and requires activation, e.g. an LVM LV that was detached
after shutting down the container couldn't be hotplugged anymore
later.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agoconfig list helper: fix return type of vmid for container index API enpoint
Fiona Ebner [Tue, 5 Dec 2023 11:35:32 +0000 (12:35 +0100)]
config list helper: fix return type of vmid for container index API enpoint

The schema declares it to be an integer. Done in the config_list()
helper, to ensure consistency for the following existing code in
vmstatus():

> my $list = $opt_vmid ? { $opt_vmid => { type => 'lxc', vmid => int($opt_vmid) }} : config_list();

Should not cause any issues for other callers of the helper.

Reported in the community forum:
https://forum.proxmox.com/threads/137628/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agofix undef warning when apparmor changeprofile fails
Filip Schauer [Tue, 9 Apr 2024 09:26:23 +0000 (11:26 +0200)]
fix undef warning when apparmor changeprofile fails

Fix a "Use of uninitialized value in numeric ne (!=)" warning when
syswrite returns undef when trying to change the apparmor profile.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
5 months agofix #5160: fix move_mount regression for mount point hotplug
Filip Schauer [Tue, 9 Apr 2024 09:26:22 +0000 (11:26 +0200)]
fix #5160: fix move_mount regression for mount point hotplug

Set up an Apparmor profile to allow moving mounts for mount point
hotplug.

This fixes a regression caused by
kernel commit 157a3537d6 ("apparmor: Fix regression in mount mediation")

The commit introduced move_mount mediation, which now requires
move_mount to be allowed in the Apparmor profile. Although it is allowed
for most paths in the /usr/bin/lxc-start profile, move_mount is called
with a file descriptor instead of a path in mountpoint_insert_staged,
thus it is not affected by the allow rules in
/etc/apparmor.d/abstractions/lxc/container-base.

To fix this, introduce a new Apparmor profile to allow move_mount on
every mount, specifically for mount point hotplug.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
5 months agoapi: status: move config locking from API handler into worker
Friedrich Weber [Tue, 30 Jan 2024 17:10:53 +0000 (18:10 +0100)]
api: status: move config locking from API handler into worker

Previously, container start/stop/shutdown/suspend would try to acquire
the config lock in the API handler prior to forking a worker. If the
lock was currently held elsewhere, this would block the API handler
and thus the pvedaemon worker thread until the 10s timeout expired (or
the lock could be acquired).

To avoid blocking the API handler, immediately fork off a worker
process and try to acquire the config lock in that worker.

Patch best viewed with `git show -w`.

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
6 months agobump version to 5.0.9
Thomas Lamprecht [Fri, 15 Mar 2024 09:24:41 +0000 (10:24 +0100)]
bump version to 5.0.9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agopct: drop completion helper for target storage on remote-migration
Thomas Lamprecht [Fri, 15 Mar 2024 09:23:01 +0000 (10:23 +0100)]
pct: drop completion helper for target storage on remote-migration

not much use to complete local storages here

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agopct: avoid use of qemu-server completion method
Thomas Lamprecht [Fri, 15 Mar 2024 09:18:03 +0000 (10:18 +0100)]
pct: avoid use of qemu-server completion method

Didn't matter functionality wise, as VMIDs are agnostic to the actual
guest type, but ugly and making it harder to bootstrap.

Worked by luck only if QemuServer got loaded already.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 months agoapi: lxc: add missing use statement for UNIX Sockets module
Thomas Lamprecht [Fri, 8 Mar 2024 13:44:39 +0000 (14:44 +0100)]
api: lxc: add missing use statement for UNIX Sockets module

worked by luck as this was already loaded by some of our dependencies
already.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agopct: add keep-env option to the 'enter' and 'exec' command
Folke Gleumes [Fri, 9 Feb 2024 13:17:09 +0000 (14:17 +0100)]
pct: add keep-env option to the 'enter' and 'exec' command

The keep-env option allows the user to define if the current
environment should be kept when running 'pct enter/exec'. pct will now
always set '--keep-env' or '--clear-env' when calling lxc-attach to
anticipate the upcoming change in default behavior.

Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
 [ TL: fix some extra whitespace, extend subject slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 months agofix #5194: pct: delete environment variables set by pve
Folke Gleumes [Mon, 29 Jan 2024 15:43:17 +0000 (16:43 +0100)]
fix #5194: pct: delete environment variables set by pve

proxmox-perl-rs set's SSL_CERT_{DIR,FILE}, which can break ssl in
containers if their certificate store can't be found in the same spot.
This patch explicitly unsets those variables before starting the
container.

Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
8 months agoconfig: schema: remove duplicate attribute assignment for mpX
Filip Schauer [Tue, 3 Oct 2023 12:46:41 +0000 (14:46 +0200)]
config: schema: remove duplicate attribute assignment for mpX

The 'optional' attribute is already set just above this hunk.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
[FE: expand commit title/message]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
9 months agobump version to 5.0.8
Thomas Lamprecht [Wed, 22 Nov 2023 13:11:58 +0000 (14:11 +0100)]
bump version to 5.0.8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosdn: fix wrong vmid parameter in prestart-hook
Stefan Hanreich [Tue, 21 Nov 2023 17:50:16 +0000 (18:50 +0100)]
sdn: fix wrong vmid parameter in prestart-hook

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
9 months agosdn: pass vmid and hostname to add_dhcp_mapping
Stefan Lendl [Tue, 21 Nov 2023 14:55:55 +0000 (15:55 +0100)]
sdn: pass vmid and hostname to add_dhcp_mapping

If no DHCP mapping was found in IPAM it will request a new IP.
In order to register an IPAM mapping it requires these values.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
9 months agobump version to 5.0.7
Wolfgang Bumiller [Tue, 21 Nov 2023 14:45:09 +0000 (15:45 +0100)]
bump version to 5.0.7

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agod/control: recommend libpve-network-perl >= 0.8.3
Wolfgang Bumiller [Tue, 21 Nov 2023 13:46:03 +0000 (14:46 +0100)]
d/control: recommend libpve-network-perl >= 0.8.3

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agoadd missing 'have_sdn' guards
Wolfgang Bumiller [Tue, 21 Nov 2023 11:50:12 +0000 (12:50 +0100)]
add missing 'have_sdn' guards

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agoMerge branch 'sdn/dhcp-support'
Wolfgang Bumiller [Tue, 21 Nov 2023 12:18:37 +0000 (13:18 +0100)]
Merge branch 'sdn/dhcp-support'

9 months agobump pve-common dep to 8.1.0
Wolfgang Bumiller [Tue, 21 Nov 2023 12:17:44 +0000 (13:17 +0100)]
bump pve-common dep to 8.1.0

required for the previous commit (device passthrough)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agocreate: Do not call create_ifaces_ipams_ips
Stefan Hanreich [Mon, 20 Nov 2023 19:19:54 +0000 (20:19 +0100)]
create: Do not call create_ifaces_ipams_ips

Since create_vm already calls update_pct_config, which in turn calls
vmconfig_apply_pending we do not need to explicitly create the IPAM
entries when creating a container from scratch.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
9 months agoconfig: Use LXC Config instead of QemuServer for parsing net
Stefan Hanreich [Mon, 20 Nov 2023 19:19:53 +0000 (20:19 +0100)]
config: Use LXC Config instead of QemuServer for parsing net

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
9 months agonetwork: Do not always reserve new IP in IPAM
Stefan Hanreich [Mon, 20 Nov 2023 19:19:52 +0000 (20:19 +0100)]
network: Do not always reserve new IP in IPAM

Currently when updating the network configuration of a container, SDN
would always create a new entry in the IPAM. Only create a new entry
when the bridge or MAC changes or the NIC is completely new.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
9 months agohotplug network: Only change IPAM when MAC or bridge changes
Stefan Hanreich [Mon, 20 Nov 2023 19:19:51 +0000 (20:19 +0100)]
hotplug network: Only change IPAM when MAC or bridge changes

Currently a new IPAM entry is created everytime a NIC config changes.
When editing properties other than MAC or Bridge this could lead to
duplicated entries in the IPAM. Only reserve a new IP when the bridge
or MAC changes or the NIC is completely new.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
9 months agolxc-pve-prestart-hook : add_dhcp_mapping
Alexandre Derumier [Fri, 17 Nov 2023 11:40:10 +0000 (12:40 +0100)]
lxc-pve-prestart-hook : add_dhcp_mapping

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agovm_apply_pending: add|del ips from ipam for offline changes
Alexandre Derumier [Fri, 17 Nov 2023 11:40:09 +0000 (12:40 +0100)]
vm_apply_pending: add|del ips from ipam for offline changes

Co-Authored-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agovm_clone : create ips in ipams
Alexandre Derumier [Fri, 17 Nov 2023 11:40:08 +0000 (12:40 +0100)]
vm_clone : create ips in ipams

also delete ips in case of failure

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agovm_create|restore: create ips in ipam
Alexandre Derumier [Fri, 17 Nov 2023 11:40:07 +0000 (12:40 +0100)]
vm_create|restore: create ips in ipam

also delete ips on create failure

Co-Authored-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agovm_destroy: remove ips from ipam for all interfaces
Alexandre Derumier [Fri, 17 Nov 2023 11:40:06 +0000 (12:40 +0100)]
vm_destroy: remove ips from ipam for all interfaces

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agonic hotplug : add|del ips in ipam
Alexandre Derumier [Fri, 17 Nov 2023 11:40:05 +0000 (12:40 +0100)]
nic hotplug : add|del ips in ipam

Co-Authored-by: Stefan Hanreich <s.hanreich@proxmox.com>
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
9 months agoAdd device passthrough
Filip Schauer [Fri, 17 Nov 2023 10:28:16 +0000 (11:28 +0100)]
Add device passthrough

Add a dev[n] argument to the container config to pass devices through to
a container. A device can be passed by its path. Additionally the access
mode, uid and gid can be specified through their respective properties.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
9 months agobump version to 5.0.6
Thomas Lamprecht [Sun, 19 Nov 2023 18:29:08 +0000 (19:29 +0100)]
bump version to 5.0.6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agotest: add coverage for presets in CentOS 8 setup test
Thomas Lamprecht [Sun, 19 Nov 2023 18:39:08 +0000 (19:39 +0100)]
test: add coverage for presets in CentOS 8 setup test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agotest: use sane indentation for files to check in setup test
Thomas Lamprecht [Sun, 19 Nov 2023 18:46:41 +0000 (19:46 +0100)]
test: use sane indentation for files to check in setup test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosetup centos: set default systemd preset for CentOS 8 or newer
Thomas Lamprecht [Sun, 19 Nov 2023 18:23:55 +0000 (19:23 +0100)]
setup centos: set default systemd preset for CentOS 8 or newer

Those should be able to cope with our defaults, like enabling
container-getty@ instead of getty@, well

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosetup base: comment breakage potential if used with ancient distros
Thomas Lamprecht [Sun, 19 Nov 2023 18:22:51 +0000 (19:22 +0100)]
setup base: comment breakage potential if used with ancient distros

it isn't for now, but might be in the future

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosetup: handle getty services also via systemd-preset
Thomas Lamprecht [Sun, 19 Nov 2023 18:10:34 +0000 (19:10 +0100)]
setup: handle getty services also via systemd-preset

fixes an issue where the first boot of a Fedora 39 CT had no
container-getty due to the default prefixes enabling the getty@
service instead, only on second boot (where presets aren't applied
anymore) our TTY handling actually was in effect and worked.

Note that preset aren't bothered by a service not existing, but still,
for older distro releases disabling getty@ could lead to problem, for
now we call this only for modern distro releases any way, and it also
only affects newly created CTs.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosetup base: disable sysfs debug mounts via systemd presets
Thomas Lamprecht [Sun, 19 Nov 2023 16:42:38 +0000 (17:42 +0100)]
setup base: disable sysfs debug mounts via systemd presets

they will fail and are not really useful in the container, at least
not as default.
Just disable via the preset mechanism, so any user can easily start
that mount if it'd make sense for their use case.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agosetup debian, centos: fixup comment typo/line-length
Thomas Lamprecht [Sun, 19 Nov 2023 16:53:15 +0000 (17:53 +0100)]
setup debian, centos: fixup comment typo/line-length

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agoMerge branch 'c.heiss/nixos/fix-arch-detection'
Wolfgang Bumiller [Fri, 17 Nov 2023 15:44:45 +0000 (16:44 +0100)]
Merge branch 'c.heiss/nixos/fix-arch-detection'

resolved conflict with b58ba5d4494c ("drop old mount code")

10 months agosetup: fix architecture detection for NixOS containers
Christoph Heiss [Mon, 25 Sep 2023 11:38:49 +0000 (13:38 +0200)]
setup: fix architecture detection for NixOS containers

NixOS is special and deviates in many places from a "standard" Linux
system. In this case, /bin/sh does not exist in the filesystem, before
the initial activation (aka. first boot) - which creates a symlink at
/bin/sh.

Due to the currently existing fallback code, only an error message is
logged and the architecture is defaulted to x86_64. Still, this is not
something users might expect.

Thus try a bit harder to detect the architecture for NixOS containers by
inspecting the init script, which contains a shebang-line with the full
path to the system shell.

This moves the architecture detection code to the end of the container
creation lifecycle, so that it can be implemented as a plugin
subroutine. Therefore this mechanism is now generic enough that it can
be adapted to other container OS's in the future if needed. AFAICS
`arch` is only used when writing the actual LXC config, so determining
it later during creation does not change anything.

detect_architecture() has been made a bit more generic; the LXC-specific
error was moved out of this function, as well as the chroot(). Ensuring
that it is executed from the correct rootdir/chroot should be handled by
the caller.

Tested by creating a NixOS and a Debian container (to verify that
nothing regressed) and checking if the warning "Architecure detection
failed: [..]" no longer appears for the NixOS CT and if  `arch` in the
CT config is correct. Also tested restoring both containers from a local
and a PBS backup, as well as migrating both container.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
10 months agogitignore: add build artefacts to ignore list
Stefan Lendl [Fri, 17 Nov 2023 14:30:44 +0000 (15:30 +0100)]
gitignore: add build artefacts to ignore list

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
 [ TL: fix subject & more specific glob ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agoapi: network: get interfaces from containers
Leo Nunner [Thu, 15 Jun 2023 09:43:31 +0000 (11:43 +0200)]
api: network: get interfaces from containers

Adds an 'interfaces' endpoint in the API
(/nodes/{node}/lxc/{vmid}/interfaces'), which returns a list of
interface names, together with a MAC, IPv4 and IPv6 address. This list
may be expanded in the future. Note that this is only returned for
*running* containers, stopped containers simply return an empty list.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
10 months agoadd_bridge_fbd: remove unused firewall param
Alexandre Derumier [Tue, 26 Sep 2023 07:39:38 +0000 (09:39 +0200)]
add_bridge_fbd: remove unused firewall param

11 months agoMerge remote-tracking branch 'origin/master'
Thomas Lamprecht [Wed, 11 Oct 2023 12:06:33 +0000 (14:06 +0200)]
Merge remote-tracking branch 'origin/master'

11 months agodrop old mount code
Wolfgang Bumiller [Tue, 31 May 2022 11:52:27 +0000 (13:52 +0200)]
drop old mount code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
12 months agobump version to 5.0.5
Thomas Lamprecht [Mon, 18 Sep 2023 14:52:09 +0000 (16:52 +0200)]
bump version to 5.0.5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
12 months agofix #3069: vzdump: add 'pbs-entries-max' parameter
Alexander Zeidler [Fri, 28 Jul 2023 13:28:56 +0000 (15:28 +0200)]
fix #3069: vzdump: add 'pbs-entries-max' parameter

configuring pbs-entries-max can avoid failing backups due to a high
amount of files in folders where a folder exclusion is not possible

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
12 months agofix #3460: restore: honor '--ignore-unpack-errors' flag for pbs
Max Carrara [Mon, 17 Jul 2023 08:04:10 +0000 (10:04 +0200)]
fix #3460: restore: honor '--ignore-unpack-errors' flag for pbs

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
12 months agod/control: require pbs client 3.0.2-1
Wolfgang Bumiller [Wed, 23 Aug 2023 08:04:38 +0000 (10:04 +0200)]
d/control: require pbs client 3.0.2-1

for the `--ignore-extract-device-errors` flag

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoconfig permission check: also check access for currently configured bridge
Fiona Ebner [Mon, 17 Jul 2023 07:15:17 +0000 (09:15 +0200)]
config permission check: also check access for currently configured bridge

Relevant when modifying or removing an existing network device.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
14 months agofix #4765: pct: do not report cpu usage
Maximiliano Sandoval [Thu, 29 Jun 2023 11:34:23 +0000 (13:34 +0200)]
fix #4765: pct: do not report cpu usage

When running `pct status VMID` the variable
$last_proc_vmid_stat->{$vmid} is not set and pct reports no cpu usage.

For consistency with the qt command we do not print the cpu usage.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
14 months agobump version to 5.0.4
Thomas Lamprecht [Sat, 24 Jun 2023 13:08:41 +0000 (15:08 +0200)]
bump version to 5.0.4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agosetup: fedora: fix wrong systemd-networkd preset
Stoiko Ivanov [Fri, 23 Jun 2023 17:19:37 +0000 (19:19 +0200)]
setup: fedora: fix wrong systemd-networkd preset

The refactoring of the systemd-preset handling inadvertently changed
the preset for Fedora >= 37 to disabled in e11806e ("add
setup_systemd_preset helper, disable networkd for debian 12+")

Reported in our community forum:
https://forum.proxmox.com/threads/129395/

Tested with a Fedora 38 container on PVE 8.0

Fixes: e11806e0de064e6570d40e7c04bc4656687b2c62
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
14 months agobump version to 5.0.3
Thomas Lamprecht [Wed, 21 Jun 2023 11:06:01 +0000 (13:06 +0200)]
bump version to 5.0.3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>