]> git.proxmox.com Git - pve-container.git/log
pve-container.git
17 months agoenable systemd-networkd per preset in fedora 37+
Wolfgang Bumiller [Fri, 18 Nov 2022 09:36:42 +0000 (10:36 +0100)]
enable systemd-networkd per preset in fedora 37+

While the template has systemd-networkd enabled, the lack of
/etc/machine-id causes systemd to revert to its "preset",
where now in
  /usr/lib/systemd/system-preset/90-default.preset
fedora disables systemd-networkd in favor of NetworkManager.

Without this patch, the first boot of a fresh fedora 37
container would disable networking requiring a
`systemctl enable systemd-networkd` from within the
container once, after which it sticks around (until
/etc/machine-id is deleted).

This patch provides an
`/etc/systemd/system-preset/00-pve.preset` file to keep
systemd-networkd enabled via the `template_fixup` hook.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
17 months agobump version to 4.3-4
Thomas Lamprecht [Thu, 17 Nov 2022 12:47:39 +0000 (13:47 +0100)]
bump version to 4.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigrate: print mapped volume in error
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:39 +0000 (14:33 +0100)]
migrate: print mapped volume in error

since that is the ID on the target node..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agopct: add 'remote-migrate' command
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:38 +0000 (14:33 +0100)]
pct: add 'remote-migrate' command

works the same as `qm remote-migrate`, with the addition of `--restart`
and `--timeout` parameters.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agomigration: add remote migration
Fabian Grünbichler [Thu, 17 Nov 2022 13:33:37 +0000 (14:33 +0100)]
migration: add remote migration

modelled after the VM migration, but folded into a single commit since
the actual migration changes are a lot smaller here.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agod/control: bump versioned dependency for guest-common
Thomas Lamprecht [Thu, 17 Nov 2022 12:18:21 +0000 (13:18 +0100)]
d/control: bump versioned dependency for guest-common

to ensure the tag helper is available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocheck_ct_modify_config_perm: check for tags permissions with 'assert_tag_permissions'
Dominik Csapak [Wed, 16 Nov 2022 15:48:02 +0000 (16:48 +0100)]
check_ct_modify_config_perm: check for tags permissions with 'assert_tag_permissions'

from GuestHelpers. This function checks all necessary permissions and
raises an exception if the user does not have the correct ones.

This is necessary for the new 'privileged' tags and 'user-tag-access'
permissions to work.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agobetter parsing for lxc networking mtu setting
Daniel Tschlatscher [Thu, 3 Nov 2022 15:38:10 +0000 (16:38 +0100)]
better parsing for lxc networking mtu setting

This patch reworks some mtu settings for LXC containers in the backend
Namely, introducing an absolute maximum for the MTU field of 65535 and
asserting that the MTU setting isn't bigger than the bridge's MTU size

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
17 months agobump version to 4.3-3
Thomas Lamprecht [Wed, 16 Nov 2022 16:51:14 +0000 (17:51 +0100)]
bump version to 4.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agosetup: relax matching when detecting systemd version
Thomas Lamprecht [Wed, 16 Nov 2022 16:48:07 +0000 (17:48 +0100)]
setup: relax matching when detecting systemd version

As this did not detect the version from Arch Linux, which is, for
example:

> required from libsystemd-shared-251.7-4.so:

Accept dot and minus as separator for the extra/patch/distro level of
the version and allow arbitrary many such tuple parts.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 4.3-2
Thomas Lamprecht [Wed, 16 Nov 2022 15:53:31 +0000 (16:53 +0100)]
bump version to 4.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agosetup: get init path: switch to resolving link recursively
Thomas Lamprecht [Wed, 16 Nov 2022 15:46:37 +0000 (16:46 +0100)]
setup: get init path: switch to resolving link recursively

some distros like CentOS use a relative symlink for init, e.g.,
/sbin/init -> ../lib/systemd/systemd

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agosetup base: add ct_readlink_recursive
Thomas Lamprecht [Wed, 16 Nov 2022 15:45:56 +0000 (16:45 +0100)]
setup base: add ct_readlink_recursive

useful if one needs to deal with relative + maybe nested links

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 4.3-1
Thomas Lamprecht [Sun, 13 Nov 2022 14:38:28 +0000 (15:38 +0100)]
bump version to 4.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoubuntu: update comment for 23.04, code name is now known
Thomas Lamprecht [Sun, 13 Nov 2022 14:37:21 +0000 (15:37 +0100)]
ubuntu: update comment for 23.04, code name is now known

Lunar Lobster it is

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofedora: support 37 and add pre-liminary support for 38
Thomas Lamprecht [Sun, 13 Nov 2022 14:36:52 +0000 (15:36 +0100)]
fedora: support 37 and add pre-liminary support for 38

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodevuan: add preliminary support for Devuan 12 Daedalus
Thomas Lamprecht [Sun, 13 Nov 2022 14:36:30 +0000 (15:36 +0100)]
devuan: add preliminary support for Devuan 12 Daedalus

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigrate: avoid early line break in comment
Thomas Lamprecht [Sun, 13 Nov 2022 14:24:32 +0000 (15:24 +0100)]
migrate: avoid early line break in comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agomigrate: split and sort used perl modules
Thomas Lamprecht [Sun, 13 Nov 2022 14:24:00 +0000 (15:24 +0100)]
migrate: split and sort used perl modules

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agonet : add support for bridge disable mac learning
Alexandre Derumier [Wed, 24 Aug 2022 16:26:41 +0000 (18:26 +0200)]
net : add support for bridge disable mac learning

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
 [ T: adapt to iface learning-disable being now auto-detected ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofix #3606: drop --inplace from suspend backups
Fabian Grünbichler [Wed, 8 Sep 2021 10:04:27 +0000 (12:04 +0200)]
fix #3606: drop --inplace from suspend backups

for bullseye-based systems, the 'fs.protected_regular'[0] sysctl is set
to '2' by default[1] (as opposed to the old value of '0'). this breaks
rsync's `--inplace` mode for such protected files, since opening them
with O_CREAT is not even possible for the root user anymore.

one example in the wild are debian (-based) containers using PHP, where
the session dir '/var/lib/php/sessions' is sticky, world-writable, owned
by root and contains sessions files usually owned by www-data. if any of
these session files are modified between the first and second rsync run,
the second run and thus the backup will fail.

the downside of this change is that containers with large files that are
updated between the first and second run will now see more (temp) space
usage - but suspend mode is not space efficient anyway and such setups
should consider switching to snapshot mode anyway.

additionaly, this commit drops the now no longer needed $first parameter
previously used to decide between different parameters for first and
second rsync run.

0: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=30aba6656f61ed44cba445a3c0d38b296fa9e8f5
1: https://salsa.debian.org/debian/procps/-/commit/299f4a1a10810e2995e666374b880b543af8e8e4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
17 months agosetup: init checking: small code/whitespace cleanups
Thomas Lamprecht [Tue, 8 Nov 2022 17:20:24 +0000 (18:20 +0100)]
setup: init checking: small code/whitespace cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agofix #4192: revamp check for systemd version
Leo Nunner [Thu, 15 Sep 2022 11:52:28 +0000 (13:52 +0200)]
fix #4192: revamp check for systemd version

Instead of iterating through several folders, it might just be easier to
check the objdump output of /sbin/init and getting the version from there.
Resolving the /sbin/init symlink happens inside the chroot, but the
objdump from the host system is used, as to not run any untrusted
executables.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
17 months agofix #4228: add start parameter to rollback endpoint for automatic restarting of CT
Stefan Hanreich [Wed, 14 Sep 2022 08:30:52 +0000 (10:30 +0200)]
fix #4228: add start parameter to rollback endpoint for automatic restarting of CT

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
17 months agod/control: bump versioned dependecy for libpve-common-perl
Thomas Lamprecht [Tue, 8 Nov 2022 15:12:27 +0000 (16:12 +0100)]
d/control: bump versioned dependecy for libpve-common-perl

for newly added PVE::CGRoup::clamp_cpu_shares

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoapi: create/update vm: clamp cpu unit value
Fiona Ebner [Fri, 7 Oct 2022 12:41:47 +0000 (14:41 +0200)]
api: create/update vm: clamp cpu unit value

While the clamping already happens before setting the actual
cpu.weight lxc config key, it can be done here too, to avoid writing
new out-of-range values into the config.

Can't use a validator enforcing this, because existing out-of-range
values should not become errors on parsing the config.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agochange cpu shares: drop superfluous parameter
Fiona Ebner [Fri, 7 Oct 2022 12:41:46 +0000 (14:41 +0200)]
change cpu shares: drop superfluous parameter

See the related commit in pve-common.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoconfig: replace mentions of "VM" with "container"
Fiona Ebner [Fri, 7 Oct 2022 12:41:45 +0000 (14:41 +0200)]
config: replace mentions of "VM" with "container"

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agouse helper from common for cpu units/shares
Fiona Ebner [Fri, 7 Oct 2022 12:41:44 +0000 (14:41 +0200)]
use helper from common for cpu units/shares

to make behavior more consistent with what we do for VMs. The helper
will clamp the value as needed, rather than dying.

Allows starting existing containers with an out-of-range (for the
relevant cgroup version) value. It's also possible to end up with
out-of-range values via update/create API.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoconfig: cpuunits: update default description
Fiona Ebner [Fri, 7 Oct 2022 12:41:43 +0000 (14:41 +0200)]
config: cpuunits: update default description

to reflect that it depends on the cgroup version.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agochange cpu shares: hard-code cgroupv1 default parameter
Fiona Ebner [Fri, 7 Oct 2022 12:41:42 +0000 (14:41 +0200)]
change cpu shares: hard-code cgroupv1 default parameter

so that the description of the default can be changed to reflect that
it depends on cgroup version.

Not strictly necessary, because the function currently will ignore the
value anyways. But certainly more future-proof then starting to pass
something invalid.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agoconfig: cpuunits: drop description for outdated special value
Fiona Ebner [Fri, 7 Oct 2022 12:41:41 +0000 (14:41 +0200)]
config: cpuunits: drop description for outdated special value

It won't work on hosts using cgroup v2. And there's one place where
$conf->{cpuunits} || 1024 is used, so zero would be overwritten there.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agobump version to 4.2-3
Thomas Lamprecht [Fri, 21 Oct 2022 13:25:04 +0000 (15:25 +0200)]
bump version to 4.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agolxc: fix perl-prototyep of mountpoint_hotplug
Thomas Lamprecht [Fri, 21 Oct 2022 13:20:34 +0000 (15:20 +0200)]
lxc: fix perl-prototyep of mountpoint_hotplug

The original commit b2de4c048ee50094593f4f8ffd18b6c346f7157a
copy-pasta'd the wrong prototype, missing two scalar $ arguments.

Until recently perl did not care as those things are only checked
_somewhat_ on "compile" (module load) times, and the one (single?)
call site in PVE::LXC::Config missed the `use PVE::LXC` statement,
and so the module-load did not see the wrong prototype and thus did
not cared, on runtime all is different anyway (what a mess).

The recent commit 11066f6bfdca5225a6f872d5664e6637ccb58dd6 added that
use statement and made package compilation implode, almost like
spooky actions in the time-space distance...

Fixes: b2de4c048ee50094593f4f8ffd18b6c346f7157a
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agotrack ubuntu 22.10 kinetic support
Thomas Lamprecht [Fri, 21 Oct 2022 12:58:13 +0000 (14:58 +0200)]
track ubuntu 22.10 kinetic support

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoconfig: style fixup for long method call
Thomas Lamprecht [Fri, 21 Oct 2022 12:55:36 +0000 (14:55 +0200)]
config: style fixup for long method call

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoconfig: small code/whitespace cleanups
Thomas Lamprecht [Wed, 19 Oct 2022 05:37:40 +0000 (07:37 +0200)]
config: small code/whitespace cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoconfig: add missing use statement for PVE::LXC
Thomas Lamprecht [Wed, 19 Oct 2022 05:36:30 +0000 (07:36 +0200)]
config: add missing use statement for PVE::LXC

worked anyway as in most cases we have that module already loaded by
something else, but its cleaner to actually encode the module
dependencies..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agoapply pending mountpoint: also hotplug non-volume mount points
Fiona Ebner [Mon, 8 Aug 2022 12:36:42 +0000 (14:36 +0200)]
apply pending mountpoint: also hotplug non-volume mount points

Previously, bind and device mount points were applied to the
configuration, but not actually hot-plugged/mounted, causing a
mismatch for running containers.

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

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
21 months agofix #4164: use DHCP=yes instead of DHCP=both in systemd-networkd config
Oguz Bektas [Tue, 19 Jul 2022 11:24:56 +0000 (13:24 +0200)]
fix #4164: use DHCP=yes instead of DHCP=both in systemd-networkd config

"both" option is deprecated, this gets rid of the warning in the journal

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
[Note: 'yes' was introduced with v219 in 2015, deprecated with v242]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
21 months agobump version to 4.2-2
Wolfgang Bumiller [Tue, 5 Jul 2022 07:26:12 +0000 (09:26 +0200)]
bump version to 4.2-2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
21 months agofix: cloning a locked container creates an empty config
Daniel Tschlatscher [Fri, 17 Jun 2022 10:40:01 +0000 (12:40 +0200)]
fix: cloning a locked container creates an empty config

When an attempt was made to clone a locked container the API would
correctly present the error 'CT is locked (disk)' but create the
config files for the new container anyway.

There was also a potential problem when the config of the new ct would
already be present and the creation of the container failed. In this
case the config of the new CT would be incorrectly removed.
The config locks for the new and the old configs should now be
correctly released depending on from which call a problem originates.

Futhermore, I moved some related function calls into the eval block to
avoid similar problems with leftover config files in the future.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
22 months agomove_volume: call deactivate volume for the old volid in any case
Dominik Csapak [Wed, 4 May 2022 08:15:02 +0000 (10:15 +0200)]
move_volume: call deactivate volume for the old volid in any case

not only when we want to remove it. Otherwise, if the old volume is
mapped (e.g. ceph krbd), we don't unmap it when we're finished.

We have to save if we deactivated successfully before attempting to
remove it. If it was not removed (either because we could not
deactivate, or the remove failed), we add it back as unused.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
22 months agofix #4088: ignore systemd minor version for detection
Fabian Grünbichler [Mon, 30 May 2022 09:10:13 +0000 (11:10 +0200)]
fix #4088: ignore systemd minor version for detection

else for containers with distros frequently updating to new upstream
versions the systemd version might be mis-detected.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
23 months agobump version to 4.2-1
Thomas Lamprecht [Wed, 4 May 2022 06:36:43 +0000 (08:36 +0200)]
bump version to 4.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agoprestart & poststop hook: init REST environment, e.g. for storage activation
Dominik Csapak [Tue, 3 May 2022 09:42:26 +0000 (11:42 +0200)]
prestart & poststop hook: init REST environment, e.g. for storage activation

Initialize the basic CLI REST environment which is expected on some
PVE methods we may rely on.

This became a specific problem recently when adding better support
for external and/or multiple ceph RBD clusters on a PVE system in
commit cfe46e2d4a97a83f1bbe6ad656e6416399309ba2 from pve-storage,
which added a PVE::Rados call to get the underlying cluster FSID
required to build the /dev-mapped RBD path, and PVE::Rados
requires a initialized RPC/REST environment.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agoRevert "lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment"
Thomas Lamprecht [Wed, 4 May 2022 06:27:21 +0000 (08:27 +0200)]
Revert "lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment"

bogus revert to add more meta info to the comment (sorry about that)

This reverts commit a75f83225dd6f4641451a24b18326069ef01f129.

23 months agolxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment
Dominik Csapak [Tue, 3 May 2022 09:42:26 +0000 (11:42 +0200)]
lxc-pve-{prestart, poststop}-hook: initialize RESTEnvironment

else some operations will fail, e.g. using an guest disk on an
external ceph-cluster

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 4.1-5
Thomas Lamprecht [Wed, 27 Apr 2022 17:01:37 +0000 (19:01 +0200)]
bump version to 4.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoSetup: Allow hostname configuration on NixOS
Harikrishnan R via pve-devel [Fri, 18 Mar 2022 10:21:13 +0000 (15:51 +0530)]
Setup: Allow hostname configuration on NixOS

While NixOS generally overrides any static contents in /etc/hostname
with the hostname defined in `networking.hostname`, it can use the
contents of `/etc/hostname` provided by PVE if this option is not
set.

Signed-off-by: Harikrishnan R <rharikrishnan95@gmail.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosupport Fedora 36
Thomas Lamprecht [Wed, 27 Apr 2022 12:22:46 +0000 (14:22 +0200)]
support Fedora 36

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoparse pct config: remove "\s*" from multi-line comment regex
Stefan Sterz [Thu, 24 Feb 2022 14:21:50 +0000 (15:21 +0100)]
parse pct config: remove "\s*" from multi-line comment regex

To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 years agoapi: reassign volume: allow to reassign to self
Thomas Lamprecht [Fri, 15 Apr 2022 12:02:00 +0000 (14:02 +0200)]
api: reassign volume: allow to reassign to self

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: vol rename: refactorings
Thomas Lamprecht [Thu, 7 Apr 2022 17:03:45 +0000 (19:03 +0200)]
api: vol rename: refactorings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: create/modify: add content type checks
Fabian Ebner [Wed, 30 Mar 2022 10:24:36 +0000 (12:24 +0200)]
api: create/modify: add content type checks

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3960: properly set owner in CT setup
Fabian Grünbichler [Mon, 28 Mar 2022 08:06:28 +0000 (10:06 +0200)]
fix #3960: properly set owner in CT setup

there were two helpers that were not handling this correctly:

ct_make_path

since this never gets called with $opts, and there also is no 'owner'
and 'group' in $self, the previous logic could never work, sometimes
leaving nobody:nogroup files around for unprivileged containers.

since only the centos and suse plugins use this helper, the issue was
fairly limited.

ct_symlink

could create symlinks owned by nobody:nogroup. since symlinks are
created 777 by default, this just meant they were not modifiable inside
the container, but reading/dereferencing was no problem so it went
unnoticed so far.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #3917: Ignore fstrim failure in pct fstrim
Markus Frank [Fri, 11 Mar 2022 11:59:57 +0000 (12:59 +0100)]
fix #3917: Ignore fstrim failure in pct fstrim

With "noerr => 1" the function does not abort, when one of the
mountpoints is not fstrim compatible like zfs (has its own trim).
I do not think it is necessary to warn or error, because fstrim
tells when something is not trimmable and aborts.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
2 years agoapi: snapshot delete: prefix lock-fail error
Fabian Grünbichler [Tue, 15 Mar 2022 12:29:24 +0000 (13:29 +0100)]
api: snapshot delete: prefix lock-fail error

otherwise users might get confused if they just get a message about a
migrate lock not being available..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agovzdump: failed snapshot removal is non-fatal
Fabian Grünbichler [Tue, 15 Mar 2022 12:10:13 +0000 (13:10 +0100)]
vzdump: failed snapshot removal is non-fatal

make it more explicit (the whole call to the plugin's cleanup sub is
wrapped in an eval + warn anyway), so that future extensions can be
added after this point if they don't rely on snapshot removal being
successful.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #3424: api: snapshot delete: wait for active replication
Fabian Ebner [Wed, 23 Feb 2022 12:03:58 +0000 (13:03 +0100)]
fix #3424: api: snapshot delete: wait for active replication

A to-be-deleted snapshot might be actively used by replication,
resulting in a not (or only partially) removed snapshot and locked
(snapshot-delete) container. Simply wait a few seconds for any ongoing
replication.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopartially fix #3424: vzdump: cleanup: wait for active replication
Fabian Ebner [Wed, 23 Feb 2022 12:03:57 +0000 (13:03 +0100)]
partially fix #3424: vzdump: cleanup: wait for active replication

As replication and backup can happen at the same time, the vzdump
snapshot might be actively used by replication when backup tries
to cleanup, resulting in a not (or only partially) removed snapshot
and locked (snapshot-delete) container.

Wait up to 10 minutes for any ongoing replication. If replication
doesn't finish in time, the fact that there is no attempt to remove
the snapshot means that there's no risk for the container to end up in
a locked state. And the beginning of the next backup will force remove
the left-over snapshot, which will very likely succeed even at the
storage layer, because the replication really should be done by then
(subsequent replications shouldn't matter as they don't need to
re-transfer the vzdump snapshot).

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: print volume: support printing unused volume
Fabian Ebner [Thu, 3 Mar 2022 12:31:20 +0000 (13:31 +0100)]
config: print volume: support printing unused volume

In particular, fixes migration with an unused disk, where calling
update_volume_ids() failed previously.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agomigrate: also set targetsid for unreferenced disks
Fabian Ebner [Thu, 3 Mar 2022 12:31:19 +0000 (13:31 +0100)]
migrate: also set targetsid for unreferenced disks

It's expected to be set further below. Reported in the community
forum: https://forum.proxmox.com/threads/105685

Fixes: e90ddc4 ("fix #1532: add target-storage support to migration")
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agoSetup: add NixOS support
Harikrishnan R via pve-devel [Tue, 15 Feb 2022 17:28:46 +0000 (22:58 +0530)]
Setup: add NixOS support

Distro detection is done heuristically through the presence of a
`/nix/store` folder.

NixOS typically uses a script-based network configuration system that
isn't easy to configure from the outside, while the configuration
snippets would be simple to generate, bringing them in effect isn't.

LXC templates generated for proxmox are instead expected to use
systemd-networkd.

Signed-off-by: Harikrishnan R <rharikrishnan95@gmail.com>
 [ Thomas: update/reword commit ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 4.1-4
Thomas Lamprecht [Fri, 11 Feb 2022 15:19:00 +0000 (16:19 +0100)]
bump version to 4.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agomigrate: allow renaming of volumes
Fabian Grünbichler [Fri, 11 Feb 2022 10:29:45 +0000 (11:29 +0100)]
migrate: allow renaming of volumes

the config is now updated anyway because of target-storage support, so
volume renaming is both 'free' and improves the chances of migration
with and without changing storages actually works successfully.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomigrate: improve target storage checks
Fabian Grünbichler [Fri, 11 Feb 2022 10:29:44 +0000 (11:29 +0100)]
migrate: improve target storage checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/changelog: fix typo
Fabian Grünbichler [Fri, 11 Feb 2022 09:02:38 +0000 (10:02 +0100)]
d/changelog: fix typo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoapi: small code/style cleanup
Thomas Lamprecht [Fri, 11 Feb 2022 07:37:22 +0000 (08:37 +0100)]
api: small code/style cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3635: fix overly-strict pool permission check on create
Dominik Csapak [Fri, 22 Oct 2021 06:44:13 +0000 (08:44 +0200)]
fix #3635: fix overly-strict pool permission check on create

we do not need Permissions.Modify on the pool as the actual required
check for 'VM.Allocate' for that pool is already handled below, so
remove it like we did in qemu-server 4fc5242 ("fix pool permission
checks on create")

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: bump versioned dependency of libpve-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:42:21 +0000 (18:42 +0100)]
d/control: bump versioned dependency of libpve-common-perl

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: add strict parser
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:32 +0000 (14:07 +0100)]
config: add strict parser

as safeguard when migrating across clusters, which might have different
versions installed.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agofix #1532: add target-storage support to migration
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:31 +0000 (14:07 +0100)]
fix #1532: add target-storage support to migration

re-using helpers that already exist for qemu-server. this is a
pre-requisite for extending remote migration support to containers.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/control: bump (build-)dependency of libpve-guest-common-perl
Thomas Lamprecht [Wed, 9 Feb 2022 17:37:26 +0000 (18:37 +0100)]
d/control: bump (build-)dependency of libpve-guest-common-perl

to get new helpers for snapshot and also migrate stuff (latter is
used in future patches).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosnapshot: implement __snapshot_activate_storages
Fabian Ebner [Thu, 13 Jan 2022 11:04:05 +0000 (12:04 +0100)]
snapshot: implement __snapshot_activate_storages

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: parse_volume: don't die when noerr is set
Fabian Ebner [Thu, 13 Jan 2022 11:04:04 +0000 (12:04 +0100)]
config: parse_volume: don't die when noerr is set

AFAICT, the only existing callers using noerr=1 are in
__snapshot_delete_remove_drive, and in AbstractConfig's
foreach_volume_full. The former should not be affected, as unknown
keys should never make their way in there. For the latter, it makes
iterating with
    $opts = { extra_keys => ['vmstate'] }
possible while being agnostic of guest type. Previously, it would die
for LXC configs, but now the unknown key is simply skipped there.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: snapshot_delete_remove_drive: check for parsed value
Fabian Ebner [Thu, 13 Jan 2022 11:04:03 +0000 (12:04 +0100)]
config: snapshot_delete_remove_drive: check for parsed value

parse_volume is called with noerr=1, so this might be undef instead
of the hash we expect.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 4.1-3
Thomas Lamprecht [Tue, 7 Dec 2021 18:11:03 +0000 (19:11 +0100)]
bump version to 4.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosetup: support upcomming Ubuntu 22.04 Jammy Jellyfish
Thomas Lamprecht [Tue, 7 Dec 2021 18:10:39 +0000 (19:10 +0100)]
setup: support upcomming Ubuntu 22.04 Jammy Jellyfish

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: allow 'lazytime' mount option for containers
Oguz Bektas [Wed, 1 Dec 2021 15:17:56 +0000 (16:17 +0100)]
config: allow 'lazytime' mount option for containers

worked fine here in ubuntu container.

root@CT1022:/# mount | grep lazy
/var/lib/pve/local-btrfs/images/1022/vm-1022-disk-0/disk.raw on /     type ext4 (rw,relatime,lazytime)
/var/lib/pve/local-btrfs/images/1022/vm-1022-disk-0/disk.raw on /snap type ext4 (rw,relatime,lazytime)

requested in community forum [0]

[0]: https://forum.proxmox.com/threads/100454/

Tested-by: Dylan Whyte <d.whyte@proxmox.com>
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agobump version to 4.1-2
Thomas Lamprecht [Fri, 12 Nov 2021 18:21:25 +0000 (19:21 +0100)]
bump version to 4.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: add alpine 3.13 test for network config
Thomas Lamprecht [Fri, 12 Nov 2021 18:16:53 +0000 (19:16 +0100)]
tests: add alpine 3.13 test for network config

just to be sure and to check both new and old..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotests: add alpine 3.8 test for network config
Thomas Lamprecht [Fri, 12 Nov 2021 18:13:25 +0000 (19:13 +0100)]
tests: add alpine 3.8 test for network config

this would fail without the previous patch..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3721: better version check to avoid false positive on can-CIDR check
Thomas Lamprecht [Fri, 12 Nov 2021 18:14:27 +0000 (19:14 +0100)]
fix #3721: better version check to avoid false positive on can-CIDR check

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agotest: add debian 11 to test network/interfaces CIDR notation
Thomas Lamprecht [Fri, 12 Nov 2021 18:05:51 +0000 (19:05 +0100)]
test: add debian 11 to test network/interfaces CIDR notation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoreassign mp: fix permission checks
Fabian Grünbichler [Wed, 10 Nov 2021 10:55:38 +0000 (11:55 +0100)]
reassign mp: fix permission checks

with `storage` being optional (and not allowed for reassign operations),
the ACL path in the schema can end up as `/storage/-`, which is wrong.
replace it with an explicit check:

- target `storage` for move mp
- storage from source disk for reassign mp (we only rename here, but
  it's still a new volume on that storage after all)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoreassign mp: various improvements
Fabian Grünbichler [Wed, 10 Nov 2021 10:54:21 +0000 (11:54 +0100)]
reassign mp: various improvements

mainly style, some additional checks

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoapi: move-volume: cleanup very long lines
Aaron Lauterer [Tue, 9 Nov 2021 14:55:40 +0000 (15:55 +0100)]
api: move-volume: cleanup very long lines

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoapi: move-volume: add move to another container
Aaron Lauterer [Tue, 9 Nov 2021 14:55:39 +0000 (15:55 +0100)]
api: move-volume: add move to another container

The goal of this is to expand the move-volume API endpoint to make it
possible to move a container volume / mountpoint to another container.

For unused volumes, the API parameters have been changed to allow them
as well. This means, additional checks had to be introduced to avoid
migration of an unusedX volume to another storage. Some follow up work
is needed for that to work properly.

Moving the rootfs from or to another container is prohibited.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoConfig: add valid_volume_keys_with_unused
Aaron Lauterer [Tue, 9 Nov 2021 14:55:38 +0000 (15:55 +0100)]
Config: add valid_volume_keys_with_unused

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agocli: pct: change move_volume to move-volume
Aaron Lauterer [Tue, 9 Nov 2021 14:55:37 +0000 (15:55 +0100)]
cli: pct: change move_volume to move-volume

also add alias to keep move_volume working

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2 years agoconfig: rollback is possible: add blockers parameter
Fabian Ebner [Thu, 12 Aug 2021 11:01:03 +0000 (13:01 +0200)]
config: rollback is possible: add blockers parameter

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 4.1-1
Thomas Lamprecht [Thu, 14 Oct 2021 11:13:13 +0000 (13:13 +0200)]
bump version to 4.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agod/control: bump versioned dependency on libpve-common-perl
Thomas Lamprecht [Thu, 14 Oct 2021 11:07:35 +0000 (13:07 +0200)]
d/control: bump versioned dependency on libpve-common-perl

to ensure we've the new RPCEnv warn helper available added in
pve-common's commit ff79ee6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosetup: support Fedora 35
Thomas Lamprecht [Thu, 14 Oct 2021 10:29:19 +0000 (12:29 +0200)]
setup: support Fedora 35

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agorestore: sanitize config: use new warn() function
Fabian Ebner [Thu, 8 Jul 2021 09:14:56 +0000 (11:14 +0200)]
restore: sanitize config: use new warn() function

to make it more visible that the task finished with warnings.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoclone: code bloat reduction
Thomas Lamprecht [Thu, 14 Oct 2021 09:59:34 +0000 (11:59 +0200)]
clone: code bloat reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoapi: clone_vm: don't include snapshot properties
Oguz Bektas [Wed, 13 Oct 2021 12:31:53 +0000 (14:31 +0200)]
api: clone_vm: don't include snapshot properties

apparently this caused a weird[0] bug... when a container with a snapshot was
cloned, it would take 'parent: foo' from the original container. if you
add a new snapshot 'bar', and then another one 'foo', this causes the
snapshots to become parents of each other (thus not parsed correctly in
the tree view of GUI nor with 'pct listsnapshot CTID')

we also drop these properties for VMs, so it makes sense to do the same
here as well.

[0]: https://forum.proxmox.com/threads/snapshots-of-one-lxc-disappeared.97711/

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agofix #3673: setup: allow ubuntu impish (release 21.10) containers
Oguz Bektas [Tue, 12 Oct 2021 10:32:17 +0000 (12:32 +0200)]
fix #3673: setup: allow ubuntu impish (release 21.10) containers

didn't notice any issue with basic privileged/unprivileged
configurations, so we can just add it here.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosetup: also set contents of /etc/timezone
Fabian Ebner [Thu, 7 Oct 2021 10:48:03 +0000 (12:48 +0200)]
setup: also set contents of /etc/timezone

Some distributions like CentOS 8 and Gentoo don't have the file, so
only update if it already existed.

A slight change in behavior in set_timezone is that the warning will
now trigger if /etc/localtime is a link to $tz_path, but $tz_path does
not exist. Previously, it would return early if the link matched.

Programs that rely on /etc/timezone within the container will now see
the configured timezone too. While that is more correct, it's still a
change that might be unexpected.

Reported in the community forum:
https://forum.proxmox.com/threads/pct-create-command-with-timezone-host-option-fails-to-create-a-container.97538/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>