]> git.proxmox.com Git - pve-container.git/log
pve-container.git
4 years agouse CGroup::change_memory_limit
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:32 +0000 (16:37 +0200)]
use CGroup::change_memory_limit

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocgroup: add change_memory_limit
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:31 +0000 (16:37 +0200)]
cgroup: add change_memory_limit

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse CGroup::get_memory_stat
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:30 +0000 (16:37 +0200)]
use CGroup::get_memory_stat

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocgroup: add get_memory_stat
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:29 +0000 (16:37 +0200)]
cgroup: add get_memory_stat

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse CGroup::get_cpu_stat
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:28 +0000 (16:37 +0200)]
use CGroup::get_cpu_stat

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocgroup: add get_cpu_stat
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:27 +0000 (16:37 +0200)]
cgroup: add get_cpu_stat

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse CGroup::get_io_stats
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:26 +0000 (16:37 +0200)]
use CGroup::get_io_stats

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocgroup: add get_io_stats and parse_nested_keyed_file
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:25 +0000 (16:37 +0200)]
cgroup: add get_io_stats and parse_nested_keyed_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdate_lxc_config: cgroupv2 support
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:24 +0000 (16:37 +0200)]
update_lxc_config: cgroupv2 support

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agopct: use CGroup submodule and new CpuSet methods
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:23 +0000 (16:37 +0200)]
pct: use CGroup submodule and new CpuSet methods

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd PVE::LXC::{CGroup, Command} submodules
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:22 +0000 (16:37 +0200)]
add PVE::LXC::{CGroup, Command} submodules

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd Delegate flag to pve-container@.service
Wolfgang Bumiller [Fri, 3 Apr 2020 14:37:21 +0000 (16:37 +0200)]
add Delegate flag to pve-container@.service

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-12
Fabian Grünbichler [Mon, 30 Mar 2020 07:36:07 +0000 (09:36 +0200)]
bump version to 3.0-12

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoImplement volume-related helpers and use new foreach_volume
Fabian Ebner [Thu, 26 Mar 2020 08:09:39 +0000 (09:09 +0100)]
Implement volume-related helpers and use new foreach_volume

Renames mountpoint_names to avoid the need to create a wrapper.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoVZDump: mark template disks as ro
Fabian Grünbichler [Fri, 27 Mar 2020 08:59:17 +0000 (09:59 +0100)]
VZDump: mark template disks as ro

since immutable .raw base volumes cannot be mounted RW.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove_volume: if deleting old volume fails, add it as unused
Fabian Ebner [Mon, 23 Mar 2020 11:18:54 +0000 (12:18 +0100)]
move_volume: if deleting old volume fails, add it as unused

Especially useful when there are linked clones using the volume
that is being moved, but shouldn't hurt otherwise either.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agofix #1904: convert to base image when moving a volume of a template
Fabian Ebner [Mon, 23 Mar 2020 11:18:53 +0000 (12:18 +0100)]
fix #1904: convert to base image when moving a volume of a template

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoRely on template_create to check whether creating a template is possible
Fabian Ebner [Mon, 23 Mar 2020 11:18:52 +0000 (12:18 +0100)]
Rely on template_create to check whether creating a template is possible

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agoFor clone+copy features, make sure a valid format for the target is supported
Fabian Ebner [Mon, 23 Mar 2020 11:18:51 +0000 (12:18 +0100)]
For clone+copy features, make sure a valid format for the target is supported

using the new option valid_target_formats. This is
necessary, because clone_image can result in a qcow2 image
being created (on directory based storages) which is not
valid for LXC.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobump version to 3.0-23
Thomas Lamprecht [Thu, 19 Mar 2020 18:02:54 +0000 (19:02 +0100)]
bump version to 3.0-23

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agolxc_config: mount /sys as mixed for unprivileged by default
Thomas Lamprecht [Wed, 18 Mar 2020 09:46:17 +0000 (10:46 +0100)]
lxc_config: mount /sys as mixed for unprivileged by default

CONTAINER_INTERFACE[0] is something systemd people call their API and
we need to adapt to it a bit, even if it means doing stupid
unnecessary things, as else systemd decides to regress and suddenly
break network stack in CT after an upgrade[1].

This mounts the parent /sys as mixed, which is:
> mount /sys as read-only but with /sys/devices/virtual/net writable.
-- man 5 lxc.container.conf

Allow users to overwrite that with a features knob, as surely some
run into other issues else and manually adding a "lxc.mount.auto"
entry in the container .conf is not an nice user experience for most.

Fixes the system regression in up to date Arch installations
introduced by[2].

[0]: https://systemd.io/CONTAINER_INTERFACE/
[1]: https://github.com/systemd/systemd/issues/15101#issuecomment-598607582
[2]: https://github.com/systemd/systemd/commit/bf331d87171b7750d1c72ab0b140a240c0cf32c3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-22
Thomas Lamprecht [Mon, 16 Mar 2020 08:09:49 +0000 (09:09 +0100)]
bump version to 3.0-22

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoallow restoring non-volume backups again
Fabian Grünbichler [Mon, 16 Mar 2020 07:52:46 +0000 (08:52 +0100)]
allow restoring non-volume backups again

this got broken with PBS integration patches

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agosetup: warn on unknown os-release ID
Thomas Lamprecht [Thu, 12 Mar 2020 12:40:57 +0000 (13:40 +0100)]
setup: warn on unknown os-release ID

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2580: api/delete: drop CT from HA resources if purge is set
Thomas Lamprecht [Thu, 12 Mar 2020 12:15:53 +0000 (13:15 +0100)]
fix #2580: api/delete: drop CT from HA resources if purge is set

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup whitespace and style fixes
Thomas Lamprecht [Tue, 10 Mar 2020 18:40:16 +0000 (19:40 +0100)]
followup whitespace and style fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agolxc: add sdn veth_create|plug
Alexandre Derumier [Mon, 9 Mar 2020 09:24:30 +0000 (10:24 +0100)]
lxc: add sdn veth_create|plug

4 years agod/control: bump versioned dependency for libpve-guest-common-perl (>= 3.0-4)
Thomas Lamprecht [Tue, 10 Mar 2020 13:31:18 +0000 (14:31 +0100)]
d/control: bump versioned dependency for libpve-guest-common-perl (>= 3.0-4)

For the moved definedness-safe comparison methods

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofollowup: do not import unused methods~
Thomas Lamprecht [Tue, 10 Mar 2020 13:30:13 +0000 (14:30 +0100)]
followup: do not import unused methods~

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agouse helper functions from GuestHelpers
Oguz Bektas [Wed, 19 Feb 2020 16:07:57 +0000 (17:07 +0100)]
use helper functions from GuestHelpers

remove safe_string_ne and safe_num_ne code which is now shared in
GuestHelpers. also change all the calls.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoFix mounting ZFS snapshots whose dataset is not mounted below '/'
Fabian Ebner [Tue, 18 Feb 2020 11:31:22 +0000 (12:31 +0100)]
Fix mounting ZFS snapshots whose dataset is not mounted below '/'

Trying to back up a container with a ZFS dataset with non-standard mount
would fail, see [0].

This also removes the near-dead code
$name .= "\@$snapname";
when snapname is false-y, but defined and turns
the check for $snapname into one for definedness.

[0]: https://forum.proxmox.com/threads/lxc-backup-fails-unable-to-open-the-dataset-vzdump.64944/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agobump version to 3.0-21
Thomas Lamprecht [Tue, 3 Mar 2020 11:00:57 +0000 (12:00 +0100)]
bump version to 3.0-21

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2611: use correct operation in get_bandwidth_limit
Stefan Reiter [Tue, 25 Feb 2020 15:32:02 +0000 (16:32 +0100)]
fix #2611: use correct operation in get_bandwidth_limit

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agovzdump: add support for proxmox backup server
Dietmar Maurer [Tue, 25 Feb 2020 09:43:44 +0000 (10:43 +0100)]
vzdump: add support for proxmox backup server

4 years agosetup/ubuntu: add upcoming 20.04 focal release
Thomas Lamprecht [Fri, 21 Feb 2020 12:07:56 +0000 (13:07 +0100)]
setup/ubuntu: add upcoming 20.04 focal release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosetup/ubuntu: note LTS versions
Thomas Lamprecht [Fri, 21 Feb 2020 12:07:32 +0000 (13:07 +0100)]
setup/ubuntu: note LTS versions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 3.0-20
Thomas Lamprecht [Thu, 20 Feb 2020 12:59:07 +0000 (13:59 +0100)]
bump version to 3.0-20

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobackup: improve module usage sorting and code readability
Thomas Lamprecht [Wed, 19 Feb 2020 16:42:45 +0000 (17:42 +0100)]
backup: improve module usage sorting and code readability

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobackup prepare: remove useless "activate volumes"
Thomas Lamprecht [Wed, 19 Feb 2020 16:41:49 +0000 (17:41 +0100)]
backup prepare: remove useless "activate volumes"

As the actual stop of the CT happened after VZDump called the prepare
step, the volume activation was undone again.
commit 00cc04160351f0034c5349d208e59a5f46d8ee33 improved that by
doing the activate now in the archive step when colleting the
moutpoints to backup, so drop it here for good.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2598: activate volumes before mounting in stop mode backup
Oguz Bektas [Tue, 18 Feb 2020 13:38:52 +0000 (14:38 +0100)]
fix #2598: activate volumes before mounting in stop mode backup

'stop' mode deactivates the volumes (relevant for LVM backend), and
they're not reactivated before trying to mount them for backup.

reactivating the volumes before the mount in 'stop' mode backup solves
the issue.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapply_pending: do cleanup pending between, not during, change/delete loop
Oguz Bektas [Wed, 5 Feb 2020 14:03:29 +0000 (15:03 +0100)]
apply_pending: do cleanup pending between, not during, change/delete loop

instead of calling it while iterating, inbetween the loops is a
better place in terms of similarity with qemu-server side, while also
fixing the bug that Dominik found[0]:

> when setting a netX option that is semantically the same as the one
> already set but in a different order, e.g.:
>
> in config:
> net0: name=eth0,bridge=vmbr0,hwaddr=AA:AA:AA:AA:AA:AA,type=veth
> setting via api:
> net0: bridge=vmbr0,name=eth0,hwaddr=AA:AA:AA:AA:AA:AA,type=veth
>
> the code tries to 'hot-apply' the change (which is no change
> really) where the api line then gets parsed and printed which
> results in the same string already in the config
>
> then we do a 'cleanup_pending' which removes it from pending, since
> the config already contains the exact same options, but then we
> overwrite the config from pending (which is empty) resulting in an
> invalid config line:
> --8<--
> net0:
> -->8--

Avoid this by only calling the cleanup pending change outside the
loop, it makes no sense to loop over the whole config on each pending
property change and pending delete.

[0]: https://pve.proxmox.com/pipermail/pve-devel/2020-February/041573.html

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Tested-By: Dominik Csapak <d.csapak@proxmox.com>
[ Thomas: adapted commit message with some extra info ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoallow reading snapshot config for VM.Audit
Dominik Csapak [Fri, 31 Jan 2020 10:40:52 +0000 (11:40 +0100)]
allow reading snapshot config for VM.Audit

VM.Audit can see the current config and the list of snapshots
already, so there is no real reason to disallow
the config of snapshots

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agod/control: depend on pve-lxc-syscalld
Thomas Lamprecht [Fri, 31 Jan 2020 15:24:30 +0000 (16:24 +0100)]
d/control: depend on pve-lxc-syscalld

It's a really small daemon doing nothing if not in use, and only
requiring < 1M of disk space and ~2M of memory (and one can always
stop the service if not wanted)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoset lxc.seccomp.notify.cookie to the vmid
Wolfgang Bumiller [Thu, 30 Jan 2020 08:27:33 +0000 (09:27 +0100)]
set lxc.seccomp.notify.cookie to the vmid

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomask 'mknod' feature by kernel version
Wolfgang Bumiller [Thu, 30 Jan 2020 08:27:32 +0000 (09:27 +0100)]
mask 'mknod' feature by kernel version

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
[ Thomas: use new helper from common ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd mknod feature flag
Wolfgang Bumiller [Thu, 30 Jan 2020 08:27:30 +0000 (09:27 +0100)]
add mknod feature flag

This causes char and blockdev mknod() and mknodat() calls to
be forwarded to the seccomp proxy, so unprivileged
containers can finally create /dev/null by themselves.

For now this is experimental and therefore added to
`features`. Ideally, if this works as intended, we can make
it the default in pve 7.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-19
Thomas Lamprecht [Mon, 27 Jan 2020 17:54:11 +0000 (18:54 +0100)]
bump version to 3.0-19

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2568: hotplug: fix typo 'cpu.shares'
Oguz Bektas [Mon, 27 Jan 2020 17:44:00 +0000 (18:44 +0100)]
fix #2568: hotplug: fix typo 'cpu.shares'

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofix #2560: adapt some sysctl values for high CT counts
Thomas Lamprecht [Thu, 23 Jan 2020 09:09:27 +0000 (10:09 +0100)]
fix #2560: adapt some sysctl values for high CT counts

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoWhitespace cleanup
Aaron Lauterer [Thu, 16 Jan 2020 13:00:31 +0000 (14:00 +0100)]
Whitespace cleanup

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agofsck: do is-CT-running check earlier
Thomas Lamprecht [Tue, 21 Jan 2020 07:55:04 +0000 (08:55 +0100)]
fsck: do is-CT-running check earlier

besides the fact that it makes sense to check that early it avoids
also uncleaned side-effect, like a mapped RBD volume which did not
get unmapped again due to this check dying.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoFix: fsck: rbd volume not mapped
Alwin Antreich [Fri, 17 Jan 2020 13:25:04 +0000 (14:25 +0100)]
Fix: fsck: rbd volume not mapped

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
4 years agosetup: allow centos to version 9
Oguz Bektas [Mon, 20 Jan 2020 14:24:39 +0000 (15:24 +0100)]
setup: allow centos to version 9

so that we handle all the point releases between 8-9

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agobump version to 3.0-18
Wolfgang Bumiller [Mon, 20 Jan 2020 08:30:47 +0000 (09:30 +0100)]
bump version to 3.0-18

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoRevert "vmstatus: Align name if not set in config to VMs"
Wolfgang Bumiller [Mon, 20 Jan 2020 08:29:13 +0000 (09:29 +0100)]
Revert "vmstatus: Align name if not set in config to VMs"

This reverts commit 3e5b8644ca54eb42c7c739aafdbffe7cf270ca09.

4 years agobump version to 3.0-17
Wolfgang Bumiller [Mon, 20 Jan 2020 07:52:03 +0000 (08:52 +0100)]
bump version to 3.0-17

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agovmstatus: Align name if not set in config to VMs
Aaron Lauterer [Thu, 16 Jan 2020 13:35:58 +0000 (14:35 +0100)]
vmstatus: Align name if not set in config to VMs

VMs have a space in between VM and the VMID.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosetup: allow centos 8.1
Oguz Bektas [Fri, 17 Jan 2020 12:43:45 +0000 (13:43 +0100)]
setup: allow centos 8.1

[0]: https://forum.proxmox.com/threads/centos-8-1-lxc-unsupported-centos-release.63530/

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-16
Wolfgang Bumiller [Thu, 2 Jan 2020 08:39:15 +0000 (09:39 +0100)]
bump version to 3.0-16

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoprestart-hook: fix starting via lxc-start
Wolfgang Bumiller [Thu, 2 Jan 2020 08:36:05 +0000 (09:36 +0100)]
prestart-hook: fix starting via lxc-start

When starting via 'lxc-start' from the CLI the prestart hook
ended up mounting relative to the current working dir, so
the container refused to start and we created a bunch of
useless `var` directories.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agouse DHCP=no for network units
Wolfgang Bumiller [Thu, 2 Jan 2020 08:18:00 +0000 (09:18 +0100)]
use DHCP=no for network units

Newer systemd complains about 'none':

    systemd-networkd[54]: /etc/systemd/network/eth0.network:8: DHCP=none is deprecated, please use DHCP=no instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-15
Thomas Lamprecht [Mon, 16 Dec 2019 15:04:43 +0000 (16:04 +0100)]
bump version to 3.0-15

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAlways determine the size of the volume in volume_rescan
Fabian Ebner [Tue, 3 Dec 2019 08:31:28 +0000 (09:31 +0100)]
Always determine the size of the volume in volume_rescan

Otherwise there is an issue when resizing a volume with pending changes:
1. Have a running container with a mount point
2. Edit the mount point and change the path
3. Resize the mount point
4. Reboot the container
Result: the old size is written to the config.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofix #2512: post-stop: unmount stage mps before cleanup
Wolfgang Bumiller [Thu, 12 Dec 2019 10:36:05 +0000 (11:36 +0100)]
fix #2512: post-stop: unmount stage mps before cleanup

With staged mount points we now have mount points also
mounted in our staging temp directory, and we keep them
there in order to prevent hotplugged mounts (which can be
unmounted by the container) to disconnect from their loop
devices, so we need to clean those up as well before we can
run any cleanups.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomountpoint_stage: add another comment about keeping the mount points active
Wolfgang Bumiller [Thu, 12 Dec 2019 10:36:04 +0000 (11:36 +0100)]
mountpoint_stage: add another comment about keeping the mount points active

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agopost-stop-hook: unmount before deactivating storages
Wolfgang Bumiller [Thu, 12 Dec 2019 10:36:03 +0000 (11:36 +0100)]
post-stop-hook: unmount before deactivating storages

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-14
Thomas Lamprecht [Tue, 26 Nov 2019 17:27:45 +0000 (18:27 +0100)]
bump version to 3.0-14

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix bindmounting with staged mount points
Wolfgang Bumiller [Tue, 26 Nov 2019 08:03:07 +0000 (09:03 +0100)]
fix bindmounting with staged mount points

We still passed the target mount path to bindmount() causing
bindmount_verify() to fail. Fix this by assuming '/' as the
in-container target mount path when staging, as we mount
onto the $rootdir instead.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-13
Thomas Lamprecht [Fri, 22 Nov 2019 08:52:58 +0000 (09:52 +0100)]
bump version to 3.0-13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agostop/reboot: handle pending changes errors as non-fatal
Thomas Lamprecht [Fri, 22 Nov 2019 08:50:52 +0000 (09:50 +0100)]
stop/reboot: handle pending changes errors as non-fatal

Note them in the log, but do not die - the pending changes should be
kept if the did not apply and we do not want to cancel a reboot.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapply pending changes in lxc poststop hook
Oguz Bektas [Thu, 21 Nov 2019 16:48:06 +0000 (17:48 +0100)]
apply pending changes in lxc poststop hook

apply pending changes after container is stopped (via API or systemctl), and
update lxc config.

also affects reboots from inside the container. (but in that case we don't try
to update_lxc_config again if pending changes were already applied and lxc config
was updated)

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoRevert "apply pending changes in lxc prestart hook"
Wolfgang Bumiller [Thu, 21 Nov 2019 08:03:44 +0000 (09:03 +0100)]
Revert "apply pending changes in lxc prestart hook"

This reverts commit 5a98fd2b573e96e1af37402211ba2a07abb489ca.

The prestart hook is executed by lxc, that is *after* it
loaded the config, so any pending changes which involve
updates to /var/lib/lxc/$vmid/config won't have any actual
effect: seccomp profile, apparmor profile changes, cgroup
related settings, newly added network devices, ...

4 years agobump version to 3.0-12
Thomas Lamprecht [Wed, 20 Nov 2019 18:27:39 +0000 (19:27 +0100)]
bump version to 3.0-12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapply pending changes in lxc prestart hook
Oguz Bektas [Wed, 20 Nov 2019 14:49:39 +0000 (15:49 +0100)]
apply pending changes in lxc prestart hook

this allows pending changes to be applied when a reboot is issued inside
the container.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoimplement container reboot
Oguz Bektas [Wed, 20 Nov 2019 14:49:38 +0000 (15:49 +0100)]
implement container reboot

* add helper function vm_reboot
* add vm_reboot api call
* add 'pct reboot'

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoadd 'tags' option
Dominik Csapak [Thu, 31 Oct 2019 12:36:26 +0000 (13:36 +0100)]
add 'tags' option

this is useful as meta information for e.g., provisioning or config
management systems

adding the info also to the 'status' api call to make it easier to show
it in the gui

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agod/control: bump versioned dependency on pve-common
Thomas Lamprecht [Wed, 20 Nov 2019 17:58:23 +0000 (18:58 +0100)]
d/control: bump versioned dependency on pve-common

to ensure we have the new kernel mount API helpers and constants
available..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agouse lxc-start apparmor profile for mount hotplugging
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:07 +0000 (08:31 +0100)]
use lxc-start apparmor profile for mount hotplugging

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoimplement mountpoint hotplugging
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:06 +0000 (08:31 +0100)]
implement mountpoint hotplugging

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoconfig: apply_pending_mountpoint helper
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:05 +0000 (08:31 +0100)]
config: apply_pending_mountpoint helper

for reuse in hotplug code

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoprestart-hook: use staged mountpoints on newer kernels
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:04 +0000 (08:31 +0100)]
prestart-hook: use staged mountpoints on newer kernels

This way we operate on defined paths in the monitor
namespace (/run/pve/mountpoint/{rootfs,mp0,mp1,...}) while
performing the mount, and can use `move_mount()` without
passing the MOVE_MOUNT_T_SYMLINKS flag when putting the
hierarchy in place.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd mount stage directory helpers
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:03 +0000 (08:31 +0100)]
add mount stage directory helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd get_container_namespace helper
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:02 +0000 (08:31 +0100)]
add get_container_namespace helper

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosplit open_namespace out of enter_namespace
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:01 +0000 (08:31 +0100)]
split open_namespace out of enter_namespace

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd open_pid_fd, open_lxc_pid, open_ppid helpers
Wolfgang Bumiller [Wed, 20 Nov 2019 07:31:00 +0000 (08:31 +0100)]
add open_pid_fd, open_lxc_pid, open_ppid helpers

Getting a pid and acting on it is always a race, so add
safer helpers for this.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd mountpoint_insert_staged helper
Wolfgang Bumiller [Wed, 20 Nov 2019 07:30:59 +0000 (08:30 +0100)]
add mountpoint_insert_staged helper

This takes care of creating the directories on the fly
before issuing the move_mount() syscall.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoimplement "staged mountpoints"
Wolfgang Bumiller [Wed, 20 Nov 2019 07:30:58 +0000 (08:30 +0100)]
implement "staged mountpoints"

Staging a mount point requires the new kernel mount API and
will mount the volume at a fixed path, then use open_tree()
to "pick it up" into a file descriptor.

For most of our volumes we wouldn't need the temp directory,
but some things cannot be handled with _only_ the new API
(like single-step read-only bind mounts). Additionally, the
'mount' command figures out file systems automatically and
has a bunch of helpers we'd need to reimplement, so instead,
go through our usual mount code and then pick up the result.

This can then be used to implement mount point hotplugging,
as with the open file descriptor we can move into the
container's namespace and issue a `move_mount()` to put the
mount point in place in the running container.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosplit walk_tree_nofollow to allow a start fd
Wolfgang Bumiller [Wed, 20 Nov 2019 07:30:57 +0000 (08:30 +0100)]
split walk_tree_nofollow to allow a start fd

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: add can_use_new_mount_api helper
Wolfgang Bumiller [Wed, 20 Nov 2019 07:30:56 +0000 (08:30 +0100)]
tools: add can_use_new_mount_api helper

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-11
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:26 +0000 (11:28 +0100)]
bump version to 3.0-11

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agouse PVE::RRD for RRD data
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:25 +0000 (11:28 +0100)]
use PVE::RRD for RRD data

refactored from PVE::Cluster. same code, same semantics, different file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::DataCenterConfig
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:24 +0000 (11:28 +0100)]
use PVE::DataCenterConfig

to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: bump version dependency to ha-manager
Thomas Lamprecht [Thu, 14 Nov 2019 13:44:11 +0000 (14:44 +0100)]
d/control: bump version dependency to ha-manager

so that we have the new "ha-manager crm-command" available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoUse crm-command stop to allow shutdown with timeout and hard stop for HA
Fabian Ebner [Thu, 14 Nov 2019 11:23:57 +0000 (12:23 +0100)]
Use crm-command stop to allow shutdown with timeout and hard stop for HA

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agovm_stop_cleanup: return early to avoid unecessary indentation levels
Thomas Lamprecht [Thu, 14 Nov 2019 13:35:01 +0000 (14:35 +0100)]
vm_stop_cleanup: return early to avoid unecessary indentation levels

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodestroy_lxc_container: drop unused outcommented code
Thomas Lamprecht [Thu, 14 Nov 2019 13:34:34 +0000 (14:34 +0100)]
destroy_lxc_container: drop unused outcommented code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotest: add 'use PVE::LXC::Config' to setup test
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:49 +0000 (13:36 +0100)]
test: add 'use PVE::LXC::Config' to setup test

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agotest: mock PVE::Cluster in setup tests
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:48 +0000 (13:36 +0100)]
test: mock PVE::Cluster in setup tests

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agofix #2456 setting bind-mount through API/CLI is broken
Wolfgang Link [Thu, 7 Nov 2019 06:51:07 +0000 (07:51 +0100)]
fix #2456 setting bind-mount through API/CLI is broken

Content-type check is only valid for mp from type 'volume'.
The Content-type check is correct for rootfs and mount points.

4 years agofix #2453: actually reflect random MAC address selection in config
Oguz Bektas [Wed, 6 Nov 2019 14:58:55 +0000 (15:58 +0100)]
fix #2453: actually reflect random MAC address selection in config

When creating/changing the network interface of a container, the
parse_lxc_network can have side-effects, e.g., it adds a new random
MAC hwaddr if the netX format-string did not had any. Thus, we need
to call print_lxc_network again in order to have the correct,
up-to-date, property string in the config file.

Apparently this was a regression introduced with the pending changes
series.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>