]> git.proxmox.com Git - pve-container.git/log
pve-container.git
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>
4 years agoconfig: whitelist lxc.hook.version
Wolfgang Bumiller [Tue, 5 Nov 2019 12:58:05 +0000 (13:58 +0100)]
config: whitelist lxc.hook.version

We currently don't depend on a particular version, although
in the future we may want to enforce a minimum (at which
point we'll need more than just a whitelist entry for this,
but right now this will do...)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoautodev hook: use new helpers and whitespace fixup
Wolfgang Bumiller [Tue, 5 Nov 2019 12:58:04 +0000 (13:58 +0100)]
autodev hook: use new helpers and whitespace fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: add device file iterator, and cgroup_do_write
Wolfgang Bumiller [Tue, 5 Nov 2019 12:58:03 +0000 (13:58 +0100)]
tools: add device file iterator, and cgroup_do_write

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agochange hooks to use new helper
Wolfgang Bumiller [Tue, 5 Nov 2019 12:58:02 +0000 (13:58 +0100)]
change hooks to use new helper

We now get rid of all the PVE::CLIHandler baggage which
reduces the code a lot. It is also not compatible with the
new lxc.hook.version=1 method of hooks!

The new helper is specific to lxc hooks and supports both
current `lxc.hook.version`s.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd PVE::LXC::Tools
Wolfgang Bumiller [Tue, 5 Nov 2019 12:58:01 +0000 (13:58 +0100)]
add PVE::LXC::Tools

Will contain lxc/container specific tools which should also
be accessible within our lxc hook scripts.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 3.0-10
Thomas Lamprecht [Wed, 30 Oct 2019 17:13:55 +0000 (18:13 +0100)]
bump version to 3.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosetup: fedora: allow 31 (and 32)
Thomas Lamprecht [Wed, 30 Oct 2019 14:35:02 +0000 (15:35 +0100)]
setup: fedora: allow 31 (and 32)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 3.0-9
Thomas Lamprecht [Tue, 29 Oct 2019 06:32:48 +0000 (07:32 +0100)]
bump version to 3.0-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosetup: do host architecture translation ourself
Stefan Reiter [Mon, 28 Oct 2019 11:59:14 +0000 (12:59 +0100)]
setup: do host architecture translation ourself

This was done by the PVE:Tools backed get_host_arch method, but as we
were the only user of that specific translation and it's quite LXC
related it makes more sense to do it here. This also allows reuse of
the PVE::Tools function.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoiterate pending config changes sorted
Oguz Bektas [Wed, 23 Oct 2019 16:48:27 +0000 (18:48 +0200)]
iterate pending config changes sorted

since we sort them while going through the delete hash, we can do it
for the other loops for consistency.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoadd 'lock' as a fastplug option
Oguz Bektas [Thu, 24 Oct 2019 13:58:56 +0000 (15:58 +0200)]
add 'lock' as a fastplug option

lock option needs to be fastpluggable when modifying with 'pct set'.
otherwise it registers as a pending change.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofollowup: iterate over pending changes sorted
Thomas Lamprecht [Tue, 22 Oct 2019 11:22:33 +0000 (13:22 +0200)]
followup: iterate over pending changes sorted

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopending apply/hotplug: use normal for loop iterate over
Oguz Bektas [Tue, 22 Oct 2019 10:40:41 +0000 (12:40 +0200)]
pending apply/hotplug: use normal for loop iterate over

format of pending_delete_hash is changed in guest-common, so we have to
use the new format while looping over the hash.

also it make no sense to have a `my ($foo, undef) = each` here, the
undef did nothing anyway.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agobump version to 3.0-8
Thomas Lamprecht [Fri, 18 Oct 2019 20:03:34 +0000 (22:03 +0200)]
bump version to 3.0-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofixup error message
Thomas Lamprecht [Fri, 18 Oct 2019 19:59:50 +0000 (21:59 +0200)]
fixup error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd check to resize disk if current size could not be determined
Tim Marx [Thu, 12 Sep 2019 10:56:20 +0000 (12:56 +0200)]
add check to resize disk if current size could not be determined

This check ensures that disks aren't unintentionally shrunken, if the
size is zero due to an underlying problem.

4 years agowhitespace cleanup
Tim Marx [Thu, 12 Sep 2019 10:56:19 +0000 (12:56 +0200)]
whitespace cleanup

4 years agofix #1291: add option purge for destroy_vm api call
Christian Ebner [Tue, 15 Oct 2019 11:00:24 +0000 (13:00 +0200)]
fix #1291: add option purge for destroy_vm api call

When destroying a CT, we intentionally did not remove all related
configs such as backup or replication jobs.
The intention of this flag is to allow the removal of references to
the VM being removed from such configs on destroy.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoimplement pending changes
Oguz Bektas [Mon, 14 Oct 2019 08:28:51 +0000 (10:28 +0200)]
implement pending changes

previous behaviour directly applied the possible config changes, and
died when there was something which can't be applied while CT is
running.

instead, we now write all the changes directly into the config pending
section, and then apply or hotplug the changes depending on whether CT
is running. the non-hotpluggable changes are left as pending changes.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoapply pending changes during container start
Oguz Bektas [Mon, 14 Oct 2019 08:28:50 +0000 (10:28 +0200)]
apply pending changes during container start

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoadd vmconfig_hotplug_pending and vmconfig_apply_pending
Oguz Bektas [Mon, 14 Oct 2019 08:28:49 +0000 (10:28 +0200)]
add vmconfig_hotplug_pending and vmconfig_apply_pending

vmconfig_hotplug_pending is responsible for checking if a key/value pair
in the pending section can be hotpugged, if yes; perform a generic
replace, or perform specific actions for hotplugging the special cases.

vmconfig_apply_pending is only supposed to be called when ct isn't live.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoallow to check for in-use volumes in pending section
Oguz Bektas [Mon, 14 Oct 2019 08:28:48 +0000 (10:28 +0200)]
allow to check for in-use volumes in pending section

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoskip pending changes while taking backup
Oguz Bektas [Mon, 14 Oct 2019 08:28:46 +0000 (10:28 +0200)]
skip pending changes while taking backup

we can only clone the current state of container (without pending
changes), as otherwise the on-disk state might not match the
configuration. this also makes it more consistent to qemu-server
behavior.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoskip pending changes while cloning
Oguz Bektas [Mon, 14 Oct 2019 08:28:45 +0000 (10:28 +0200)]
skip pending changes while cloning

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoapi: config: use shared guesthelpers in GET call
Oguz Bektas [Mon, 14 Oct 2019 08:28:44 +0000 (10:28 +0200)]
api: config: use shared guesthelpers in GET call

since containers can also have pending changes now, we need a method to
get the current applied config as well as the one with the pending
changes inside. this makes the GET config api more consistent with
qemu-server's by reusing load_current_config and load_snapshot_config from
AbstractConfig.
to decide which method to call, we look at the parameters.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoadd 'pct pending'
Oguz Bektas [Mon, 14 Oct 2019 08:28:43 +0000 (10:28 +0200)]
add 'pct pending'

same as 'qm pending', the code is shared via GuestHelpers

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agofixup: add lxc/pending API path
Thomas Lamprecht [Fri, 18 Oct 2019 18:44:16 +0000 (20:44 +0200)]
fixup: add lxc/pending API path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd lxc/pending API path
Oguz Bektas [Mon, 14 Oct 2019 08:28:42 +0000 (10:28 +0200)]
add lxc/pending API path

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agoadapt CT config parser for pending changes
Oguz Bektas [Mon, 14 Oct 2019 08:28:41 +0000 (10:28 +0200)]
adapt CT config parser for pending changes

config parser can now read/write [pve:pending] section. this was named
such, instead of [PENDING], after on- and offline discussion regarding
namespacing the pending section and snapshots.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agodelete_mp: warn if we ignore a volume deletion due to wrong owner
Thomas Lamprecht [Fri, 18 Oct 2019 10:51:21 +0000 (12:51 +0200)]
delete_mp: warn if we ignore a volume deletion due to wrong owner

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