]> git.proxmox.com Git - pve-container.git/log
pve-container.git
2 years agobump version to 3.3-6 stable-6
Fabian Grünbichler [Thu, 8 Jul 2021 10:28:51 +0000 (12:28 +0200)]
bump version to 3.3-6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoconfig: sync ACL checks with qemu-server
Fabian Grünbichler [Thu, 8 Jul 2021 09:23:55 +0000 (11:23 +0200)]
config: sync ACL checks with qemu-server

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 3.3-5
Thomas Lamprecht [Tue, 20 Apr 2021 12:13:40 +0000 (14:13 +0200)]
bump version to 3.3-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: fedora: allow upcomming Fedora 34
Thomas Lamprecht [Mon, 19 Apr 2021 16:24:10 +0000 (18:24 +0200)]
setup: fedora: allow upcomming Fedora 34

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: fedora: code cleanup, reuse variable
Thomas Lamprecht [Mon, 19 Apr 2021 16:23:45 +0000 (18:23 +0200)]
setup: fedora: code cleanup, reuse variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoschema: mention special syntax for allocating a new volume
Fabian Ebner [Tue, 2 Mar 2021 12:02:05 +0000 (13:02 +0100)]
schema: mention special syntax for allocating a new volume

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: bump pve-storage dependency for new vdisk param
Thomas Lamprecht [Sun, 18 Apr 2021 16:05:07 +0000 (18:05 +0200)]
d/control: bump pve-storage dependency for new vdisk param

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofilter by content type when using vdisk_list
Fabian Ebner [Mon, 22 Mar 2021 14:32:42 +0000 (15:32 +0100)]
filter by content type when using vdisk_list

except for migration, where it would be subtly backwards-incompatible.

Also allows to get rid of the existing filtering hack in rescan().

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agopct: fix edge case for 'pct push' with root uid/gid
Oguz Bektas [Tue, 6 Apr 2021 11:56:16 +0000 (13:56 +0200)]
pct: fix edge case for 'pct push' with root uid/gid

we should check if the variable is defined in the end (because root
uid:gid is 0:0, this causes perl to get confused and die, eventhough the
uid:gid was obtained correctly)

reported here:
https://forum.proxmox.com/threads/pct-push-fails-to-get-uid-gid.87065/

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agovmstatus: make lock property optional again
Fabian Ebner [Thu, 11 Mar 2021 10:26:50 +0000 (11:26 +0100)]
vmstatus: make lock property optional again

Commit d02262048cbbe91ca8b12f98e3dc7bbab28e4c64 made the property de-facto
non-optional. Partially revert this and instead adapt the printing, making the
behavior match the API description again. The conditional assignment is
already there further down the vmstatus function.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoconfig: parse: also allow empty values
Fabian Ebner [Thu, 11 Mar 2021 10:26:49 +0000 (11:26 +0100)]
config: parse: also allow empty values

because they are valid for '-list' formats and it makes the behavior match with
what we do for VM configs. The new pattern is the same that is used for VM
configs. Because it is a non-greedy pattern, trailing whitespaces will not be
included in the value anymore. This /should/ cause no problems and the '\s*$'
at the end suggests that that is how it was intended in the first place.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoimprove code readability
Thomas Lamprecht [Thu, 25 Feb 2021 14:26:32 +0000 (15:26 +0100)]
improve code readability

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3313: restore: keep unprivileged status from archive config
Oguz Bektas [Thu, 25 Feb 2021 14:11:16 +0000 (15:11 +0100)]
fix #3313: restore: keep unprivileged status from archive config

Since pct defaults to privileged containers, it restores the
container as privileged when `--unprivileged 1` is not passed.
Instead we should check the old configuration and retrieve it from
there.

This way, when one creates an unprivileged container, it will be
still be unprivileged after restore, if not overwritten by API
arguments.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobackup: keep CT template status for non-root restores
Oguz Bektas [Thu, 25 Feb 2021 14:11:17 +0000 (15:11 +0100)]
backup: keep CT template status for non-root restores

but still keep the lxc.* parameters limited to root, as originally
intended.

note: $orig_mp_param isn't protected by $is_root, but when it's used we
make another recover_config() call on the archive file

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.3-4
Thomas Lamprecht [Wed, 17 Feb 2021 07:59:36 +0000 (08:59 +0100)]
bump version to 3.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: ostype: add devuan
Thomas Lamprecht [Wed, 17 Feb 2021 07:57:21 +0000 (08:57 +0100)]
api: ostype: add devuan

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: debian: add preliminary support for Debian 12 Bookworm
Thomas Lamprecht [Tue, 9 Feb 2021 09:19:52 +0000 (10:19 +0100)]
setup: debian: add preliminary support for Debian 12 Bookworm

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: debian: use hash map for translating dev versions
Thomas Lamprecht [Tue, 9 Feb 2021 09:18:49 +0000 (10:18 +0100)]
setup: debian: use hash map for translating dev versions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3176: allow development Devuan versions, improve version detection
Thomas Lamprecht [Tue, 9 Feb 2021 09:12:43 +0000 (10:12 +0100)]
fix #3176: allow development Devuan versions, improve version detection

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.3-3
Thomas Lamprecht [Thu, 28 Jan 2021 16:12:52 +0000 (17:12 +0100)]
bump version to 3.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3275: remove old FW config when restoring
Fabian Grünbichler [Thu, 28 Jan 2021 08:25:59 +0000 (09:25 +0100)]
fix #3275: remove old FW config when restoring

otherwise proxmox-backup-client will error and the whole restore will
fail.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agorestore: add more informational messages
Fabian Grünbichler [Wed, 25 Nov 2020 14:07:50 +0000 (15:07 +0100)]
restore: add more informational messages

to provide context for warnings/output created by various sub-operations.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agorestore: pass target vmid to config recovery
Fabian Grünbichler [Wed, 25 Nov 2020 14:07:49 +0000 (15:07 +0100)]
restore: pass target vmid to config recovery

so that we get the correct warning prefix when the config contains bogus lines.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agouse monitor commands to freeze on pure-v2 setups
Wolfgang Bumiller [Mon, 25 Jan 2021 11:05:32 +0000 (12:05 +0100)]
use monitor commands to freeze on pure-v2 setups

even an explicit query for the 'unified' cgroup hierarchy
does not work on lxc when run in a pure v2 environment via
the kernel options

    systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all

so let's use the freeze commands provided by lxc we already
have code for...

See-also: https://forum.proxmox.com/threads/short-read-on-command-socket-error-when-running-backup-of-lxc-containers.82978/

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: destroy: add 'destroy-unreferenced-disks' parameter
Thomas Lamprecht [Mon, 25 Jan 2021 19:20:13 +0000 (20:20 +0100)]
api: destroy: add 'destroy-unreferenced-disks' parameter

Making the CT and VM API more stream lined. But, we do not use the
same dangerous default than the VM API does, as we only have it there
for backward compatibility.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomkfs: make less noisy
Thomas Lamprecht [Mon, 25 Jan 2021 19:15:24 +0000 (20:15 +0100)]
mkfs: make less noisy

Easiest and cleanest would be to pass the -q quiet parameter, but
that drops also possible relevant information when rescuing such a
filesystem (super block backup positions, UUID, ...)

Will let thorugh something like:

> Creating filesystem with 262144 4k blocks and 65536 inodes
> Filesystem UUID: 3a6f3548-baf6-45fa-93d2-b61212668d23
> Superblock backups stored on blocks:
>  32768, 98304, 163840, 229376

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolxc: import run_command and cleanup formatting
Thomas Lamprecht [Mon, 25 Jan 2021 15:51:50 +0000 (16:51 +0100)]
lxc: import run_command and cleanup formatting

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agouse new move_config_to_node method
Fabian Ebner [Tue, 1 Dec 2020 12:06:58 +0000 (13:06 +0100)]
use new move_config_to_node method

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.3-2
Thomas Lamprecht [Wed, 9 Dec 2020 11:49:36 +0000 (12:49 +0100)]
bump version to 3.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorestore: fix fw.conf restore for PBS
Fabian Grünbichler [Mon, 7 Dec 2020 08:18:49 +0000 (09:18 +0100)]
restore: fix fw.conf restore for PBS

the 'files' command returns a list of hashes, and the filename is
'fw.conf.blob' not 'fw.conf'.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 3.3-1
Thomas Lamprecht [Wed, 25 Nov 2020 12:58:46 +0000 (13:58 +0100)]
bump version to 3.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: pass along exclude patterns to proxmox-backup-client
Fabian Ebner [Fri, 20 Nov 2020 14:50:45 +0000 (15:50 +0100)]
vzdump: pass along exclude patterns to proxmox-backup-client

to make the behavior consistent across modes.

Previously vzdump's exclude-path option only had an effect for suspend mode
backups, as then the exclusion already happens when rsync copies the data
during an earlier stage in the backup.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: allow relative exclude patterns for snapshot and stop mode
Fabian Ebner [Fri, 20 Nov 2020 14:50:44 +0000 (15:50 +0100)]
vzdump: allow relative exclude patterns for snapshot and stop mode

to make the behavior consistent across modes.

For suspend mode, relative patterns worked for a long time, because the
exclusion already happens when rsync copies the data during an earlier stage of
the backup.

For the other two methods, the way the patterns are passed to tar (after the
'--anchored' option and prefixed with a dot) meant that relative patterns
had no effect previously.

Users which have a relative exclude path by accident (if it's not by accident
then this fixes the behavior) and did not use suspend mode (if they did use
suspend mode, they hopefully would have noticed the unintended exclusion then)
will be affected by this change.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: turn findexcl into its own variable
Fabian Ebner [Fri, 20 Nov 2020 14:50:43 +0000 (15:50 +0100)]
vzdump: turn findexcl into its own variable

for easier readability.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agodeactivate volumes after storage_migrate
Fabian Ebner [Fri, 6 Nov 2020 14:30:57 +0000 (15:30 +0100)]
deactivate volumes after storage_migrate

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agofix #3140: allow iface suffix on link local dns address
Wolfgang Bumiller [Tue, 24 Nov 2020 12:19:45 +0000 (13:19 +0100)]
fix #3140: allow iface suffix on link local dns address

Allows nameserver entries of the form `fe80::1%eth2`

Note that previously the schema allowed domain names here as
well, while only allowing IPs in the hotplug's verification
code.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agouse PVE::CGroup
Alexandre Derumier [Fri, 30 Oct 2020 09:42:27 +0000 (10:42 +0100)]
use PVE::CGroup

3 years agoCgroups: use base PVE::CGroup and keep specific lxc code
Alexandre Derumier [Fri, 30 Oct 2020 09:42:26 +0000 (10:42 +0100)]
Cgroups: use base PVE::CGroup and keep specific lxc code

3 years agod/rules: do not try to start or enable system-pve\x2dcontainer.slice
Thomas Lamprecht [Tue, 24 Nov 2020 09:11:50 +0000 (10:11 +0100)]
d/rules: do not try to start or enable system-pve\x2dcontainer.slice

Yes, we need *all* those flags for the installsystemd debhelper to do
nothing.

That is not required and logs errors during package upgrade, like:
> system-pve\x2dcontainer.slice is a disabled or a static unit,
> not starting it.

Completes the fix of commit 41d3078b34c08dc0d66a2c0215f2a598a05fcb6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.2-4
Thomas Lamprecht [Mon, 23 Nov 2020 18:48:21 +0000 (19:48 +0100)]
bump version to 3.2-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3161: snapshot creation: only check volumes for fsfreeze
Stoiko Ivanov [Mon, 23 Nov 2020 10:12:29 +0000 (11:12 +0100)]
fix #3161: snapshot creation: only check volumes for fsfreeze

When considering mountpoints for running 'fsfreeze' before snapshot
creation, commit 8463099d99273561c46398bf02206b4d9d431bc5 did not
only consider volumes created by our storage-stack, but also
bindmounts and devmounts (directly mounting a blockdevice).

This led to PVE::Storage::parse_volume_id failing on those
mountpoints.

Since the fsfreeze call is best-effort and only run for specific
storageplugins, we can simply skip non-volume mountpoints, when
gathering the list of volumes to call fsfreeze on.

Tested with a container with a bind mount.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Tested-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: Devuan: add support for Chimaera
Thomas Lamprecht [Tue, 17 Nov 2020 07:51:25 +0000 (08:51 +0100)]
setup: Devuan: add support for Chimaera

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: Devuan: add support for Beowulf
Thomas Lamprecht [Tue, 17 Nov 2020 07:47:15 +0000 (08:47 +0100)]
setup: Devuan: add support for Beowulf

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.2-3
Thomas Lamprecht [Mon, 16 Nov 2020 15:41:31 +0000 (16:41 +0100)]
bump version to 3.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosupport new known Ubuntu releases
Thomas Lamprecht [Mon, 16 Nov 2020 15:17:59 +0000 (16:17 +0100)]
support new known Ubuntu releases

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadapt to new storage_migrate activation behavior
Fabian Ebner [Fri, 6 Nov 2020 14:30:56 +0000 (15:30 +0100)]
adapt to new storage_migrate activation behavior

Every local volume is migrated via storage_migrate and activated there,
so there is no need to do it in prepare() anymore.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agod/control: bump versioned dependency of pve-storage
Thomas Lamprecht [Tue, 10 Nov 2020 18:14:26 +0000 (19:14 +0100)]
d/control: bump versioned dependency of pve-storage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosnapshot creation: fsfreeze mountpoints, if needed
Stoiko Ivanov [Fri, 6 Nov 2020 14:19:42 +0000 (15:19 +0100)]
snapshot creation: fsfreeze mountpoints, if needed

fixes #2991, #2528.

creating a snapshot with rbd, after the syncfs finished successfully does not
guarantee that the snapshot has the state of the filesystem after syncfs.

suggestion taken from #2528 (running fsfreeze -f/-u before snapshotting on
the mountpoints)

added helper PVE::Storage::volume_snapshot_needs_fsfreeze, to indicate
which volumes need to be frozen/thawed. (and mocked it in the tests here).

Added the freeze to sync_container_namespace, since it needs to run inside the
container's mount namespace.

unfreezing happens in a sub of its own.

tests in #2991 seem to indicate that this helps to successfully create backups.

needs a versioned dependency bump on pve-storage

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoadd fsfreeze helper:
Stoiko Ivanov [Fri, 6 Nov 2020 14:19:41 +0000 (15:19 +0100)]
add fsfreeze helper:

fsfreeze_mountpoint issues the same ioctls as fsfreeze(8) on the provided
directory (the $thaw parameter deciding between '--freeze' and '--unfreeze')

This is used for container backups on RBD, where snapshots on containers,
which are heavy on IO, are not mountable readonly, because the ext4 is not
consistent.

Needed to fix #2991 and #2528.

The ioctl numbers were found via strace -X verbose (and verified with the
kernel documentation).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoallow fedora 33 container
Oguz Bektas [Mon, 9 Nov 2020 12:23:33 +0000 (13:23 +0100)]
allow fedora 33 container

used template for testing:
https://uk.images.linuxcontainers.org/images/fedora/33/amd64/default/20201108_20:33/rootfs.tar.xz

unprivileged container - everything works as expected
privileged container - needs 'nesting=1' for network connection to work

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agovzdump: clearer log message when removing temp. snapshot again
Thomas Lamprecht [Sun, 1 Nov 2020 19:19:49 +0000 (20:19 +0100)]
vzdump: clearer log message when removing temp. snapshot again

the original sounded a tad dangerous..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup: description wording
Thomas Lamprecht [Thu, 29 Oct 2020 12:14:37 +0000 (13:14 +0100)]
followup: description wording

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopct fstrim: add 'ignore-mountpoints' parameter
Oguz Bektas [Thu, 29 Oct 2020 10:09:21 +0000 (11:09 +0100)]
pct fstrim: add 'ignore-mountpoints' parameter

parameter to ignore mountpoints when doing fstrim on a container

root@pve:~# pct fstrim 123
/var/lib/lxc/123/rootfs/: 338.7 MiB (355094528 bytes) trimmed
/var/lib/lxc/123/rootfs/test: 8.9 GiB (9576009728 bytes) trimmed
root@pve:~# pct fstrim 123 --ignore-mountpoints
/var/lib/lxc/123/rootfs/: 338.7 MiB (355094528 bytes) trimmed

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoSPAM: [PATCH v2 container 1/1] Fix numbering scheme detection for CentOS Stream releases.
Achim Dreyer [Sat, 17 Oct 2020 13:45:56 +0000 (14:45 +0100)]
SPAM: [PATCH v2 container 1/1] Fix numbering scheme detection for CentOS Stream releases.

Signed-off-by: Achim Dreyer <ml11045@adreyer.com>
3 years agobump version to 3.2-2
Thomas Lamprecht [Tue, 22 Sep 2020 08:55:29 +0000 (10:55 +0200)]
bump version to 3.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosync_container_namespace: skip virtual filesystems
Stoiko Ivanov [Fri, 18 Sep 2020 12:16:21 +0000 (14:16 +0200)]
sync_container_namespace: skip virtual filesystems

skip additional virtual filesystems.

the list is taken from a running debian container's /proc/mounts

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agofix #3016: clone: do not copy snapshot config
Fabian Grünbichler [Tue, 22 Sep 2020 06:32:39 +0000 (08:32 +0200)]
fix #3016: clone: do not copy snapshot config

those entries belong to the source CT, not the target.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agofix #2938: increase limit of max cores from 128 to 8192
Oguz Bektas [Tue, 15 Sep 2020 09:14:06 +0000 (11:14 +0200)]
fix #2938: increase limit of max cores from 128 to 8192

To match the currently used limit from our kernel config

https://git.proxmox.com/?p=mirror_ubuntu-focal-kernel.git;a=blob;f=arch/x86/Kconfig;h=8ef85139553f5a4ad5187375af898266355c4177;hb=b311b46c7d1ab21bf0a11a6fa5bad76f98fb77af#l1014

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.2-1
Thomas Lamprecht [Wed, 9 Sep 2020 19:21:36 +0000 (21:21 +0200)]
bump version to 3.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosetup: heuristically warn if the FS hosting /etc is not mounted
Thomas Lamprecht [Wed, 9 Sep 2020 18:02:25 +0000 (20:02 +0200)]
setup: heuristically warn if the FS hosting /etc is not mounted

Check for the existence of /etc, use -e as it could also be a symlink
(and it's just a heuristic). But only do so if the expected ostype
from the config does not match the detected one, this normally
indicates that we had a "reals" distro running but detected the
fallback "unmanaged". Only warn though, as a hint for the user.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoalpine: setup net: pass whole config to parent method
Thomas Lamprecht [Wed, 9 Sep 2020 17:55:41 +0000 (19:55 +0200)]
alpine: setup net: pass whole config to parent method

We expected the whole $conf to be passed in a call to setup_network,
a bit ago it worked if their where only the netX keys present, for
some plugin that still is the case.
But, in the Debian version, reused by Alpine, we now check if the CT
distro version is recent enough to support (or need) the address in
CIDR format.
So, at least "ostype" needs to be passed to, else we get ugly
warnings in the syslog (or the recently added --debug log CLI switch)

Just pass the whole config, the setup_network method need to cope
with that anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprotected_call: remove left-over rootdir/dev mkdir
Thomas Lamprecht [Wed, 9 Sep 2020 17:31:51 +0000 (19:31 +0200)]
protected_call: remove left-over rootdir/dev mkdir

commit 797e12e8a5df246d8afc53b045e632977cdf0088 got rid of our "just
bind-mount the root /dev to the CT temporarily for some stuff" for
good a while ago (2015), but creating the /dev directory in the CT
root was kept, from what I can tell, by mistake.

This can be a problem if, whyever, the CT rootfs is not mounted, as
we then break a future mount as we create this /dev directory inside
what would be the CTs rootfs mount point. It is then not empty
anymore and a normal mount cannot happen, failing with "directory is
not empty"

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoimplement debug start
Thomas Lamprecht [Wed, 9 Sep 2020 16:10:43 +0000 (18:10 +0200)]
implement debug start

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoct start: track lxc-start stderr and print in error case
Thomas Lamprecht [Wed, 9 Sep 2020 16:24:28 +0000 (18:24 +0200)]
ct start: track lxc-start stderr and print in error case

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomove monitor state closure/logic out of vm_start
Thomas Lamprecht [Wed, 9 Sep 2020 16:19:46 +0000 (18:19 +0200)]
move monitor state closure/logic out of vm_start

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoImprove feedback for startup
Fabian Ebner [Tue, 8 Sep 2020 11:58:43 +0000 (13:58 +0200)]
Improve feedback for startup

Since it was necessary to switch to 'Type=Simple' in the systemd
service, see 545d6f0a13ac2bf3a8d3f224c19c0e0def12116d,
'systemctl start' would not wait for the 'lxc-start' command anymore.
Thus every container start was reported as a success and the 'post-start'
hook would trigger immediately after the 'systemctl start' command.

Use the monitor socket to get the necessary information and detect
startup failure, and only run the 'post-start' hookscript after
the container is effectively running. If something goes wrong
with the monitor socket, for example if lxc-monitord is not running,
fall back to the old behavior.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoAdd module for reading state changes from monitor socket
Fabian Ebner [Tue, 8 Sep 2020 11:58:42 +0000 (13:58 +0200)]
Add module for reading state changes from monitor socket

Will be used to monitor state changes on container startup.

Co-developed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agosetup: add kali-rolling in supported releases
Oguz Bektas [Tue, 1 Sep 2020 10:44:05 +0000 (12:44 +0200)]
setup: add kali-rolling in supported releases

for our setup purposes, it's the same as bullseye since it's following a
rolling release model.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agobump version to 3.1-13
Thomas Lamprecht [Thu, 27 Aug 2020 07:50:00 +0000 (09:50 +0200)]
bump version to 3.1-13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoBump maximum number of container net interfaces from 10 to 32
Stephan Leemburg [Sun, 23 Aug 2020 11:38:02 +0000 (13:38 +0200)]
Bump maximum number of container net interfaces from 10 to 32

Signed-off-by: Stephan Leemburg <stephan.leemburg@it-functions.nl>
3 years agolxc: resize: fix #2790 return message in case of disk already at size
Aaron Lauterer [Wed, 26 Aug 2020 08:51:26 +0000 (10:51 +0200)]
lxc: resize: fix #2790 return message in case of disk already at size

Otherwise the API would return an error message because returning an
empty value is not defined in the API.

By dying we avoid confusions as the return will be an error and not a
successful call which should return a task ID.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agoLog storage_migrate output
Fabian Ebner [Wed, 29 Jul 2020 09:44:17 +0000 (11:44 +0200)]
Log storage_migrate output

and make it more clear where an error within storage_migrate came from.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoUse correct option for storage_migrate
Fabian Ebner [Wed, 29 Jul 2020 09:44:16 +0000 (11:44 +0200)]
Use correct option for storage_migrate

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoMove volume activation to vm_start
Stoiko Ivanov [Tue, 14 Jul 2020 17:50:18 +0000 (19:50 +0200)]
Move volume activation to vm_start

currently all volumes for a container are activated in the pre-start hook,
which runs in a separate mount namespace (lxc.monitor.unshare is set to 1
in our container config). This leads to problems with ZFS:
* if a pool is imported by this call the filesystems are mounted only inside
  the containers mount namespace

by running the volume activation inside vm_start, right before starting the
container via systemctl the volume activation happens before the unshare.

The other site where a container is started via systemctl is in
'pve-container-stop-wrapper' when a container is rebooted from the inside:
By activating the volumes in 'lxc-pve-poststop-hook' we avoid to try starting
a container with an inactive volume (LVM, kRBD), occuring when having a
mp-addtion pending during such a reboot

Starting a container manually using lxc-start is usually done for obtaining
debug-logs (after starting failed with our tooling) - so the potential for
regression in that case should also be small.

The $loopdevlist variable is not used anywhere in our codebase since 2015
(da6298481ea4dfe7d894f42fa105cda015ebe5ce).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 3.1-12
Thomas Lamprecht [Fri, 24 Jul 2020 09:43:08 +0000 (11:43 +0200)]
bump version to 3.1-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: rsync: make less verbose
Thomas Lamprecht [Mon, 13 Jul 2020 16:07:33 +0000 (18:07 +0200)]
vzdump: rsync: make less verbose

most of that info we get is just plain noise, which adds 15 lines per
sync, so 30 total! Instead just pull out the total transfer info,
i.e., the delta which should be full CT size in the first sync and
the dirty delta in the second.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.1-11
Thomas Lamprecht [Mon, 13 Jul 2020 11:32:59 +0000 (13:32 +0200)]
bump version to 3.1-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2820: don't hotplug over existing mpX
Oguz Bektas [Thu, 2 Jul 2020 10:10:23 +0000 (12:10 +0200)]
fix #2820: don't hotplug over existing mpX

check if the given mpX already exists in the config.  if it does, then
skip hotplugging and write the changes to [pve:pending] for the next
reboot of CT.

after rebooting the CT, the preexisting mpX will be added as unused and
the mpX will be mounted.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agosetup/debian: use cidr for buster and newer
Stoiko Ivanov [Fri, 10 Jul 2020 16:43:34 +0000 (18:43 +0200)]
setup/debian: use cidr for buster and newer

starting with version 0.8.35 of ifupdown (shipped currently with buster)
the configuration using a separate 'netmask' line instead of providing the
cidr in the 'address' line of a interface stanza of /etc/network/interfaces
is deprecated.

This means that some software installed on newer debian versions, which
parses /etc/network/interfaces may not support the format currently written
by PVE::LXC::Setup::Debian::setup_network.

This patch changes the content of the generated file to use the newer format
only for newer versions of debian (alpine, older ubuntu versions and devuan
also rely on the sub to generate the network config)

caught by installing proxmox-backup-server on a debian buster container and
getting a parse-error in the network configuration tab in the GUI.

tested by creating a ubuntu-14.04, debian-6, debian-8 and a debian-10
container and checking the resulting /etc/network/interfaces.

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912220

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agovzdump: pbs: set size
Thomas Lamprecht [Fri, 10 Jul 2020 06:01:24 +0000 (08:01 +0200)]
vzdump: pbs: set size

This has not yet been substracted the reused size, we do not yet have
that info yet.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocgroup: get old swap value when hotplugging only memory
Wolfgang Bumiller [Fri, 10 Jul 2020 09:32:41 +0000 (11:32 +0200)]
cgroup: get old swap value when hotplugging only memory

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 3.1-10
Thomas Lamprecht [Thu, 9 Jul 2020 16:12:14 +0000 (18:12 +0200)]
bump version to 3.1-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: fix passing mountpoints for the PBS case
Thomas Lamprecht [Thu, 9 Jul 2020 16:05:20 +0000 (18:05 +0200)]
vzdump: fix passing mountpoints for the PBS case

The stop-mode case only worked by luck as then $snapdir == $rootdir.
But for snapshots we rsync over a clean state to a separate
directory, so this has to be used as base for the backup (just like
tar does).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.1-9
Thomas Lamprecht [Thu, 9 Jul 2020 11:46:12 +0000 (13:46 +0200)]
bump version to 3.1-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #1423: add timezone config option
Oguz Bektas [Thu, 2 Jul 2020 12:49:11 +0000 (14:49 +0200)]
fix #1423: add timezone config option

optionally enabled.

adds the 'timezone' option to config, which takes a valid timezone (i.e.
Europe/Vienna) to set in the container.

if nothing is selected, then it will show as 'container managed' in
GUI, and nothing will be done.

if set to 'host', the /etc/localtime symlink from the host node will be
cached and set in the container rootfs.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoadd reason for mp backup exclusion
Thomas Lamprecht [Wed, 24 Jun 2020 09:12:32 +0000 (11:12 +0200)]
add reason for mp backup exclusion

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup variable name and empty line cleanup
Thomas Lamprecht [Wed, 24 Jun 2020 09:11:38 +0000 (11:11 +0200)]
followup variable name and empty line cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: move include logic for mountpoints to method
Aaron Lauterer [Mon, 22 Jun 2020 14:34:38 +0000 (16:34 +0200)]
vzdump: move include logic for mountpoints to method

Move the logic which mountpoints are included in the backup job to its
own method and adapt the VZDump code accordingly. This makes it possible
to develop other features around backup jobs.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agovzdump: add reason for mountpoint backup inclusion
Aaron Lauterer [Mon, 22 Jun 2020 14:34:37 +0000 (16:34 +0200)]
vzdump: add reason for mountpoint backup inclusion

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
3 years agofix #2778: use vm_start instead of systemctl to start/restart container
Oguz Bektas [Thu, 18 Jun 2020 14:42:55 +0000 (16:42 +0200)]
fix #2778: use vm_start instead of systemctl to start/restart container

when a backup task in 'stop' mode is executed, VZDump calls 'start_vm'
sub instead of 'PVE::LXC::vm_start'.

'start_vm' however does not follow our regular process but instead uses
systemctl to start the container, which results in the guest hookscripts
not being executed in 'pre-start' and 'post-start'.

to call the hooks correctly we can just make use of the
PVE::LXC::vm_start routine which already handles them.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agobump version to 3.1-8
Thomas Lamprecht [Mon, 8 Jun 2020 15:40:26 +0000 (17:40 +0200)]
bump version to 3.1-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolxcnetaddbr: do not use depreacated method
Thomas Lamprecht [Thu, 4 Jun 2020 12:25:47 +0000 (14:25 +0200)]
lxcnetaddbr: do not use depreacated method

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agolxc: fall back to 'unmanaged' when no OS detected
Arnout Engelen [Thu, 28 May 2020 20:18:46 +0000 (20:18 +0000)]
lxc: fall back to 'unmanaged' when no OS detected

This is useful when the uploaded CT does not contain a full OS. When the
autodetection detects an OS, that OS is returned. When it does not
successfully detect a supported OS, but /etc/os-release exists and has an ID
other than 'unmanaged', then the setup fails.

Signed-off-by: Arnout Engelen <arnout@bzzt.net>
3 years agobump version to 3.1-7
Thomas Lamprecht [Thu, 28 May 2020 13:28:24 +0000 (15:28 +0200)]
bump version to 3.1-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup comment cleanup
Thomas Lamprecht [Tue, 26 May 2020 09:04:44 +0000 (11:04 +0200)]
followup comment cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2655: don't forget to setup securetty for centos >= 7
Oguz Bektas [Mon, 25 May 2020 12:32:13 +0000 (14:32 +0200)]
fix #2655: don't forget to setup securetty for centos >= 7

in template_fixup we only call this method for version < 7, but greater
versions also need to allow lxc/tty[N] as secure.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agosetup: Fedora: print which version was detected in error message
Thomas Lamprecht [Thu, 21 May 2020 17:10:27 +0000 (19:10 +0200)]
setup: Fedora: print which version was detected in error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 3.1-6
Thomas Lamprecht [Fri, 15 May 2020 14:21:40 +0000 (16:21 +0200)]
bump version to 3.1-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocgroup: don't dup cgroup.events and don't busy-loop
Wolfgang Bumiller [Fri, 15 May 2020 13:53:22 +0000 (15:53 +0200)]
cgroup: don't dup cgroup.events and don't busy-loop

Events are reported via POLLPRI and POLLERR (priority and
exception flags), not POLLIN (which causes a busy-loop).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoLXC: separate freeze_thaw to explicit freeze and thaw methods
Thomas Lamprecht [Fri, 15 May 2020 13:41:20 +0000 (15:41 +0200)]
LXC: separate freeze_thaw to explicit freeze and thaw methods

as else one needs to always lookup parameter value means freeze and
which one thaw when reading call sites what

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