]> git.proxmox.com Git - pve-guest-common.git/log
pve-guest-common.git
6 days agobump version to 5.1.1 master
Thomas Lamprecht [Thu, 18 Apr 2024 08:20:23 +0000 (10:20 +0200)]
bump version to 5.1.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
6 days agoreplication: snapshot cleanup: only attempt to remove snapshots that exist
Fiona Ebner [Thu, 18 Apr 2024 07:06:47 +0000 (09:06 +0200)]
replication: snapshot cleanup: only attempt to remove snapshots that exist

Since commit a6f5b35 ("replication: prepare: include volumes without
snapshots in the result"), attempts would be made to remove previous
replication snapshots from volumes on which they didn't exist. This
was noticed by Thomas since the output of a replication test in
pve-manager changed.

The issue is not completely new, i.e. there was no check that the
(previous) replication snapshot acutally exists before attempting
removal during the cleanup phase. Fix the issue by adding such a
check.

The $replicate_snapshots hash is only used for this, so the change
there is fine.

Fixes: a6f5b35 ("replication: prepare: include volumes without snapshots in the result")
Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
7 days agobump version to 5.1.0
Thomas Lamprecht [Wed, 17 Apr 2024 15:39:52 +0000 (17:39 +0200)]
bump version to 5.1.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agoguest helpers: avoid checking user/token if one can abort all tasks
Thomas Lamprecht [Wed, 17 Apr 2024 15:30:52 +0000 (17:30 +0200)]
guest helpers: avoid checking user/token if one can abort all tasks

If the user can already stop all tasks there is no point in spending
some work on every task to check if the user could also stop if
without those powerful permissions.

To avoid to much indentation rework the filter to an early-next style.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
7 days agoguest helpers: add helper to abort active guest tasks of a certain type
Friedrich Weber [Fri, 12 Apr 2024 14:15:49 +0000 (16:15 +0200)]
guest helpers: add helper to abort active guest tasks of a certain type

Given a `(type, user, vmid)` tuple, the helper aborts all tasks of the
given `type` for guest `vmid` that `user` is allowed to abort:

- If `user` has `Sys.Modify` on the node, they can abort any task
- If `user` is an API token, it can abort any task it started itself
- If `user` is a user, they can abort any task started by themselves
  or one of their API tokens.

The helper is used to overrule any active qmshutdown/vzshutdown tasks
when attempting to stop a VM/CT (if requested).

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
13 days agovzdump: schema: make storage for fleecing semi-optional
Fiona Ebner [Thu, 11 Apr 2024 09:29:31 +0000 (11:29 +0200)]
vzdump: schema: make storage for fleecing semi-optional

so it doesn't need to be set when explicitly disabling fleecing. Needs
a custom verifier to enforce it being set when enabled.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 days agovzdump: schema: add fleecing property string
Fiona Ebner [Thu, 11 Apr 2024 09:29:30 +0000 (11:29 +0200)]
vzdump: schema: add fleecing property string

It's a property string, because that avoids having an implicit
"enabled" as part of a 'fleecing-storage' property. And there likely
will be more options in the future, e.g. threshold/limit for the
fleecing image size.

Storage is non-optional, so the storage choice needs to be a conscious
decision. Can allow for a default later, when a good choice can be
made further down the stack. The original idea with "same storage as
VM disk" is not great, because e.g. for LVM, it would require the same
size as the disk up front.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
 [ TL: style fix for whitespace placement in multi-line strings ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 days agomapping: pci: fix missing description/default for mdev
Dominik Csapak [Wed, 10 Apr 2024 11:03:40 +0000 (13:03 +0200)]
mapping: pci: fix missing description/default for mdev

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
13 days agoabstract config: fix snapshot needed by replication check
Fiona Ebner [Wed, 13 Dec 2023 14:17:47 +0000 (15:17 +0100)]
abstract config: fix snapshot needed by replication check

Do not pass the cleanup flag to get_replicatable_volumes() which leads
to replicatable volumes that have the replicate setting turned off to
be part of the result.

Instead pass the noerr flag, because things like missing the
storage-level replicate feature should not lead to an error here.

Reported in the community forum:
https://forum.proxmox.com/threads/120910/post-605574

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
13 days agoreplication: find common base: improve error when no common base snapshot exists
Fiona Ebner [Wed, 13 Dec 2023 14:17:46 +0000 (15:17 +0100)]
replication: find common base: improve error when no common base snapshot exists

Suggest an alternative solution by removing the problematic volumes
from the replication target rather than the whole job.

This is helpful if there are multiple replicated volumes to avoid the
need to fully re-sync all volumes in many cases.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
13 days agoreplication: prepare: include volumes without snapshots in the result
Fiona Ebner [Wed, 13 Dec 2023 14:17:45 +0000 (15:17 +0100)]
replication: prepare: include volumes without snapshots in the result

Note that PVE::Storage::volume_snapshot_info() will fail when a volume
does not exist, so no non-existing volume will end up in the result
(prepare() is only called with volumes that should exist).

This makes it possible to detect a volume without snapshots in the
result of prepare(), and as a consequence, replication will now also
fail early in a situation where source and remote volume both exist,
but (at least) one of them doesn't have any snapshots.

Such a situation can happen, for example, by deleting and re-creating
a volume with the same name on the source side without running
replication after deletion.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
5 months agobump version to 5.0.6
Thomas Lamprecht [Tue, 21 Nov 2023 12:31:14 +0000 (13:31 +0100)]
bump version to 5.0.6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agovzdump: fixup style for multi-line literal strings
Thomas Lamprecht [Tue, 21 Nov 2023 12:29:43 +0000 (13:29 +0100)]
vzdump: fixup style for multi-line literal strings

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
5 months agovzdump: config: add 'notification-mode' param for backup jobs
Lukas Wagner [Tue, 21 Nov 2023 10:22:05 +0000 (11:22 +0100)]
vzdump: config: add 'notification-mode' param for backup jobs

'legacy-sendmail': Use mailto/mailnotification parameters and send
emails directly.
'notification-system': Always notify via notification system
'auto': Notify via mail if mailto is set, otherwise use notification
system.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
5 months agovzdump: deprecate mailto/mailnotification/notification-{target, policy}
Lukas Wagner [Tue, 14 Nov 2023 12:59:30 +0000 (13:59 +0100)]
vzdump: deprecate mailto/mailnotification/notification-{target, policy}

The first two will be migrated to the notification system, the second
were part for the first attempt for the new notification system.
The first attempt only ever hit pvetest, so we simply tell the user
to not use the two params.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
7 months agobump version to 5.0.5
Thomas Lamprecht [Mon, 18 Sep 2023 14:47:40 +0000 (16:47 +0200)]
bump version to 5.0.5

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

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

Signed-off-by: Alexander Zeidler <a.zeidler@proxmox.com>
7 months agoreplication: avoid passing removed storages to target
Fiona Ebner [Fri, 23 Jun 2023 10:08:11 +0000 (12:08 +0200)]
replication: avoid passing removed storages to target

After removing a storage, replication states can still contain
references to it, even if no volume references it anymore.

If a storage does not exist in the storage configuration, the
replication target runs into an error when preparing the job locally.
This error prevents both running and removing the replication job. Fix
it by not passing the invalid storage ID in the first place.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
9 months agobump version to 5.0.4
Wolfgang Bumiller [Mon, 24 Jul 2023 13:22:15 +0000 (15:22 +0200)]
bump version to 5.0.4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
9 months agovzdump: add config options for new notification backend
Lukas Wagner [Thu, 20 Jul 2023 14:32:06 +0000 (16:32 +0200)]
vzdump: add config options for new notification backend

- Add new option 'notification-target'
  Allows to select to which endpoint/group notifications shall be sent
- Add new option 'notification-policy'
  Replacement for the now deprecated 'mailnotification' option. Mostly
  just a rename for consistency, but also adds the 'never' option.
- Mark 'mailnotification' as deprecated in favor of 'notification-policy'
- Clarify that 'mailto' is ignored if 'notification-target' is set

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
9 months agovzdump: use worker aware log_warn from rest environment for warn level
Thomas Lamprecht [Wed, 5 Jul 2023 13:02:36 +0000 (15:02 +0200)]
vzdump: use worker aware log_warn from rest environment for warn level

This ensures that the alert counter is incremented when a message
with such a level is logged, and that the task is prominently marked
in the web UI task log.

The log_warn produces the exact same message format for the warn
level, so we can just swap printing to STDERR for the warning level
without any change to the resulting text in the log. Keep printing to
the (on storage saved) backup log-fd as is.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
9 months agovzdump: always lower-case level in message logging base method
Thomas Lamprecht [Wed, 5 Jul 2023 13:01:16 +0000 (15:01 +0200)]
vzdump: always lower-case level in message logging base method

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agominor style and doc fixups
Wolfgang Bumiller [Tue, 13 Jun 2023 08:43:41 +0000 (10:43 +0200)]
minor style and doc fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 months agobump version to 5.0.3
Thomas Lamprecht [Wed, 7 Jun 2023 17:35:25 +0000 (19:35 +0200)]
bump version to 5.0.3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agoabstract config: add method to calculate derived properties from a config
Fiona Ebner [Tue, 28 Feb 2023 10:54:07 +0000 (11:54 +0100)]
abstract config: add method to calculate derived properties from a config

HA manager currently needs to know about internal details about the
configs and how the properties are calculated. With this method, those
details are abstracted away, allowing to change the configuration
structure. In particular, QemuConfig's 'memory' can be turned into
a property string without HA manager needing to know about it (once HA
manager switched to using this mehtod).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
10 months agobump version to 5.0.2
Thomas Lamprecht [Wed, 7 Jun 2023 17:21:15 +0000 (19:21 +0200)]
bump version to 5.0.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agovzdump: config: improve description of ionice setting
Fiona Ebner [Wed, 7 Jun 2023 14:54:50 +0000 (16:54 +0200)]
vzdump: config: improve description of ionice setting

The CFQ scheduler was removed with Linux 5.0 and ionice is now used
by the newer BFQ scheduler. Mention what the special value 8 does.
Also mention that for snapshot and suspend mode backups of VMs, the
setting only affects the compressor, because the kvm process is not a
child process of vzdump then and does not inherit the ionice priority.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
10 months agomappings: cleanup imports
Thomas Lamprecht [Wed, 7 Jun 2023 17:16:02 +0000 (19:16 +0200)]
mappings: cleanup imports

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agoadd PCI/USB Mapping configs
Dominik Csapak [Tue, 6 Jun 2023 13:52:01 +0000 (15:52 +0200)]
add PCI/USB Mapping configs

adds a config file for each type of resource (usb/pci) by using a 'map'
array propertystring for each node mapping

in each mapping we save the path(s) and some other information to detect
hardware changes (if possible) like the vendor/device id

both configs have custom header parser/formatter to omit the type (since
we only want one type per config here)

also each config has some helpers like find_on_current_node

the resulting config (e.g. for pci) would look like this:

10 months agohelpers : add check_vnet_access
Alexandre Derumier [Wed, 7 Jun 2023 12:03:52 +0000 (14:03 +0200)]
helpers : add check_vnet_access

if a tag is defined, test if user have a specific access to the vlan (or propagate from full bridge acl or zone)
if trunks is defined, we check permissions for each vlan of the trunks
if no tag, test if user have access to full bridge.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
FG:
- conditionalize check for bridge
- make trunk to tags helper private for now

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
10 months agobump version to 5.0.1
Wolfgang Bumiller [Wed, 7 Jun 2023 11:28:49 +0000 (13:28 +0200)]
bump version to 5.0.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 months agobreak libpve-http-server-perl << 5.0.2 and pve-manager << 8.0.0~7
Wolfgang Bumiller [Wed, 7 Jun 2023 11:28:32 +0000 (13:28 +0200)]
break libpve-http-server-perl << 5.0.2 and pve-manager << 8.0.0~7

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 months agodepend on pve-common >= 8.0.2
Wolfgang Bumiller [Wed, 7 Jun 2023 11:28:16 +0000 (13:28 +0200)]
depend on pve-common >= 8.0.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
10 months agovzdump: change 'exclude-path' from alist to an array format
Dominik Csapak [Tue, 6 Jun 2023 13:08:50 +0000 (15:08 +0200)]
vzdump: change 'exclude-path' from alist to an array format

to get rid of the '-alist' format

Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
10 months agovzdump: improve description of bwlimit parameter
Stefan Hanreich [Wed, 29 Mar 2023 12:34:36 +0000 (14:34 +0200)]
vzdump: improve description of bwlimit parameter

This makes the description consistent with the other places that
have bwlimit as a parameter as well.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
11 months agobump version to 5.0.0
Thomas Lamprecht [Mon, 22 May 2023 11:24:33 +0000 (13:24 +0200)]
bump version to 5.0.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: define compat level via build-depends and raise to 13
Thomas Lamprecht [Mon, 22 May 2023 11:05:16 +0000 (13:05 +0200)]
d/control: define compat level via build-depends and raise to 13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: raise standards version compliance to 4.6.2
Thomas Lamprecht [Mon, 22 May 2023 11:22:11 +0000 (13:22 +0200)]
d/control: raise standards version compliance to 4.6.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add sbuild convenience target
Thomas Lamprecht [Mon, 22 May 2023 11:23:44 +0000 (13:23 +0200)]
buildsys: add sbuild convenience target

And only run lintian explicitly for the dsc target, as sbuild runs it
itself anyway

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: cleanup and expand clean target
Thomas Lamprecht [Mon, 22 May 2023 11:23:27 +0000 (13:23 +0200)]
buildsys: cleanup and expand clean target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: derive upload dist automatically
Thomas Lamprecht [Mon, 22 May 2023 11:23:20 +0000 (13:23 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: make build-dir generation atomic
Thomas Lamprecht [Mon, 22 May 2023 11:22:43 +0000 (13:22 +0200)]
buildsys: make build-dir generation atomic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: use full DEB_VERSION
Thomas Lamprecht [Mon, 22 May 2023 11:22:29 +0000 (13:22 +0200)]
buildsys: use full DEB_VERSION

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: wrap-and-sort -tkn
Thomas Lamprecht [Mon, 22 May 2023 10:53:23 +0000 (12:53 +0200)]
d/control: wrap-and-sort -tkn

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agosrc/makefile: convert to use simple parenthesis
Thomas Lamprecht [Mon, 22 May 2023 10:30:42 +0000 (12:30 +0200)]
src/makefile: convert to use simple parenthesis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobump version to 4.2-4
Thomas Lamprecht [Thu, 16 Mar 2023 10:54:08 +0000 (11:54 +0100)]
bump version to 4.2-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agoconfig: ensure definedness for iterating pending & snapshot volumes
Thomas Lamprecht [Thu, 16 Mar 2023 10:46:47 +0000 (11:46 +0100)]
config: ensure definedness for iterating pending & snapshot volumes

while it will work as is, autovivification can be a real PITA so this
should make it more robust and might even avoid having the one or
other warning about accessing undef values in logs.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agofix #4572: config: also update volume IDs in pending section
Fiona Ebner [Wed, 15 Mar 2023 14:44:22 +0000 (15:44 +0100)]
fix #4572: config: also update volume IDs in pending section

The method is intended to be used in cases where the volumes actually
got renamed (e.g. migration). Thus, updating the volume IDs should of
course also be done for pending changes to avoid changes referring to
now non-existent volumes or even the wrong existing volume.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
15 months agoabstract migrate: avoid branched loop, move error-level into prefix
Thomas Lamprecht [Thu, 12 Jan 2023 12:01:18 +0000 (13:01 +0100)]
abstract migrate: avoid branched loop, move error-level into prefix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agoabstract migrate: rename tstr to prefix
Thomas Lamprecht [Thu, 12 Jan 2023 12:00:33 +0000 (13:00 +0100)]
abstract migrate: rename tstr to prefix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agoabstract migrate: minimal code cleanups
Thomas Lamprecht [Thu, 12 Jan 2023 11:59:37 +0000 (12:59 +0100)]
abstract migrate: minimal code cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
15 months agoabstract migrate: sort and split use statements
Thomas Lamprecht [Thu, 12 Jan 2023 10:21:57 +0000 (11:21 +0100)]
abstract migrate: sort and split use statements

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 4.2-3
Thomas Lamprecht [Mon, 21 Nov 2022 07:17:36 +0000 (08:17 +0100)]
bump version to 4.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agotag helpers: add get_unique_tags method for filtering out duplicates
Thomas Lamprecht [Mon, 21 Nov 2022 07:09:24 +0000 (08:09 +0100)]
tag helpers: add get_unique_tags method for filtering out duplicates

tags must be unique, allow the user some control in how unique (case
sensitive) and honor the ordering settings (even if I doubt any
production setups wants to spent time and $$$ on cautiously
reordering all tags of their dozens to hundreds virtual guests..

Have some duplicate code to avoid checking to much in the loop
itself, as frequent branches can be more expensive.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agotag helpers: code/style cleanup and reduction
Thomas Lamprecht [Mon, 21 Nov 2022 07:07:51 +0000 (08:07 +0100)]
tag helpers: code/style cleanup and reduction

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 4.2-2
Thomas Lamprecht [Thu, 17 Nov 2022 12:13:48 +0000 (13:13 +0100)]
bump version to 4.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: bump versioned dependency for libpve-cluster-perl to >= 7-2-3
Thomas Lamprecht [Thu, 17 Nov 2022 12:10:48 +0000 (13:10 +0100)]
d/control: bump versioned dependency for libpve-cluster-perl to >= 7-2-3

to ensure we got the tag stuff available

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoGuestHelpers: add tag related helpers
Dominik Csapak [Wed, 16 Nov 2022 15:48:00 +0000 (16:48 +0100)]
GuestHelpers: add tag related helpers

'get_allowed_tags':
returns the allowed tags for the given user

'assert_tag_permissions'
helper to check permissions for tag setting/updating/deleting
for both container and qemu-server

gets the list of allowed tags from the DataCenterConfig and the current
user permissions, and checks for each tag that is added/removed if
the user has permissions to modify it

'normal' tags require 'VM.Config.Options' on '/vms/<vmid>', but not
allowed tags (either limited with 'user-tag-access' or
'privileged-tags' in the datacenter.cfg) requrie 'Sys.Modify' on '/'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
17 months agobump version to 4.2-1
Thomas Lamprecht [Sat, 12 Nov 2022 15:52:14 +0000 (16:52 +0100)]
bump version to 4.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agod/control: bump versioned dependency for libpve-common-perl to 7.2-6
Thomas Lamprecht [Sat, 12 Nov 2022 15:50:22 +0000 (16:50 +0100)]
d/control: bump versioned dependency for libpve-common-perl to 7.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agovzdump: comment that vzdump.cron is the legacy parser
Thomas Lamprecht [Sat, 12 Nov 2022 15:30:02 +0000 (16:30 +0100)]
vzdump: comment that vzdump.cron is the legacy parser

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agovzdump: handle new jobs.cfg when removing VMIDs from backup jobs
Thomas Lamprecht [Sat, 12 Nov 2022 15:25:34 +0000 (16:25 +0100)]
vzdump: handle new jobs.cfg when removing VMIDs from backup jobs

we use the relatively new SectionConfig functionallity of allowing to
parse/write unknown config types, that way we can directly use the
directly available base job plugin for vzdump jobs and update only
those, keeping the other jobs untouched.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoadd VZDump::JobBase, split out from manager
Thomas Lamprecht [Sat, 12 Nov 2022 15:21:33 +0000 (16:21 +0100)]
add VZDump::JobBase, split out from manager

We need access to vzdump type jobs at this level, else we cannot do
things like removing VMIDs on purge of their guest.

So split out the independent part (all but the actual run method)
from pve-manager's PVE::Jobs::VZDump module.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agovzdump: re-factor remove_vmid_from_jobs to checking a single job
Thomas Lamprecht [Sat, 12 Nov 2022 13:18:06 +0000 (14:18 +0100)]
vzdump: re-factor remove_vmid_from_jobs to checking a single job

that way we'll be able to re-use it for adding support of cleaning
out vzdump jobs from the newish job.cfg

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agobump version to 4.1-4
Wolfgang Bumiller [Wed, 12 Oct 2022 12:02:29 +0000 (14:02 +0200)]
bump version to 4.1-4

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
18 months agovzdump: add 'performance' property string as a setting
Fiona Ebner [Mon, 3 Oct 2022 13:52:05 +0000 (15:52 +0200)]
vzdump: add 'performance' property string as a setting

Initially, to be used for tuning backup performance with QEMU.

A few users reported IO-related issues during backup after upgrading
to PVE 7.x and using a modified QEMU build with max-workers reduced to
8 instead of 16 helped them [0].

Also generalizes the way vzdump property string are handled for easier
extension in the future.

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

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
18 months agobump version to 4.1-3
Thomas Lamprecht [Tue, 27 Sep 2022 11:15:54 +0000 (13:15 +0200)]
bump version to 4.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoreplication: avoid "expected snapshot missing" warning when irrelevant
Fiona Ebner [Fri, 23 Sep 2022 08:16:47 +0000 (10:16 +0200)]
replication: avoid "expected snapshot missing" warning when irrelevant

Only print it when there is a snapshot that would've been removed
without the safeguard. Mostly relevant when a new volume is added to
an already replicated guest.

Fixes replication tests in pve-manager.

Fixes: c0b2948 ("replication: prepare: safeguard against removal if expected snapshot is missing")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agoreplication: prepare: safeguard against removal if expected snapshot is missing
Fiona Ebner [Mon, 13 Jun 2022 10:29:59 +0000 (12:29 +0200)]
replication: prepare: safeguard against removal if expected snapshot is missing

Such a check would also have prevented the issue in 1aa4d84
("ReplicationState: purge state from non local vms") and other
scenarios where state and disk state are inconsistent with regard to
the last_sync snapshot.

AFAICT, all existing callers intending to remove all snapshots use
last_sync=1 so chaning the behavior for other (non-zero) values should
be fine.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agoreplication: also consider storages from replication state upon removal
Fiona Ebner [Mon, 13 Jun 2022 10:29:58 +0000 (12:29 +0200)]
replication: also consider storages from replication state upon removal

This prevents left-over volume(s) in the following situation:
1. replication with volumes on different storages A and B
2. remove all volumes on storage B from the guest configuration
3. schedule full removal before the next normal replication runs

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agoreplication: rename last_snapshots to local_snapshots
Fiona Ebner [Mon, 13 Jun 2022 10:29:57 +0000 (12:29 +0200)]
replication: rename last_snapshots to local_snapshots

because prepare() was changed in 8d1cd44 ("partially fix #3111:
replication: be less picky when selecting incremental base") to return
all local snapshots.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
20 months agoreplication: prepare: adapt/expand function comment
Fiona Ebner [Mon, 13 Jun 2022 10:29:56 +0000 (12:29 +0200)]
replication: prepare: adapt/expand function comment

Commit 8d1cd44 ("partially fix #3111: replication: be less picky when
selecting incremental base") changed prepare() to return all local
snapshots.

Special behavior regarding last_sync is also better mentioned
explicitly.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
22 months agoReplicationState: deterministically order replication jobs
Dominik Csapak [Fri, 3 Jun 2022 07:16:30 +0000 (09:16 +0200)]
ReplicationState: deterministically order replication jobs

if we have multiple jobs for the same vmid with the same schedule,
the last_sync, next_sync and vmid will always be the same, so the order
depends on the order of the $jobs hash (which is random; thanks perl)

to have a fixed order, take the jobid also into consideration

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
22 months agoReplicationState: purge state from non local vms
Dominik Csapak [Fri, 3 Jun 2022 07:16:29 +0000 (09:16 +0200)]
ReplicationState: purge state from non local vms

when running replication, we don't want to keep replication states for
non-local vms. Normally this would not be a problem, since on migration,
we transfer the states anyway, but when the ha-manager steals a vm, it
cannot do that. In that case, having an old state lying around is
harmful, since the code does not expect the state to be out-of-sync
with the actual snapshots on disk.

One such problem is the following:

Replicate vm 100 from node A to node B and C, and activate HA. When node
A dies, it will be relocated to e.g. node B and start replicate from
there. If node B now had an old state lying around for it's sync to node
C, it might delete the common base snapshots of B and C and cannot sync
again.

Deleting the state for all non local guests fixes that issue, since it
always starts fresh, and the potentially existing old state cannot be
valid anyway since we just relocated the vm here (from a dead node).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
22 months agovzdump config: limit notes template to maximal 1024 characters
Thomas Lamprecht [Wed, 8 Jun 2022 06:47:59 +0000 (08:47 +0200)]
vzdump config: limit notes template to maximal 1024 characters

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agovzdump: update notes-template description
Fabian Ebner [Thu, 28 Apr 2022 08:07:40 +0000 (10:07 +0200)]
vzdump: update notes-template description

as the actual handling in pve-manager changed a bit.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
23 months agobump version to 4.1-2
Thomas Lamprecht [Wed, 27 Apr 2022 16:51:21 +0000 (18:51 +0200)]
bump version to 4.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agovzdump: schema: add 'notes-template' and 'protected' properties
Fabian Ebner [Thu, 7 Apr 2022 10:05:39 +0000 (12:05 +0200)]
vzdump: schema: add 'notes-template' and 'protected' properties

In command_line(), notes are printed, quoted, but otherwise as is,
which is a bit ugly for multi-line notes. But it is part of the
commandline, so print it.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
23 months agoreplication config: retry first three failed times quicker before going to 30m
Thomas Lamprecht [Wed, 27 Apr 2022 07:59:24 +0000 (09:59 +0200)]
replication config: retry first three failed times quicker before going to 30m

So the repeat frequency for a stuck job is now:
t0 -> fails
t1 = t0 +  5m -> repat
t2 = t1 + 10m = t0 + 15m -> repat
t3 = t2 + 15m = t0 + 30m -> repat
t4 = t3 + 30m = t0 + 60-> repat
then
tx = tx-1 + 30m -> repat

So, we converge more naturally/stable to the 30m intervals than
before, when t3 would have been t0 + 45m.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
23 months agoreplication config: code cleanup
Thomas Lamprecht [Wed, 27 Apr 2022 07:58:41 +0000 (09:58 +0200)]
replication config: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoprint snapshot tree: reduce indentation delta per level
Thomas Lamprecht [Tue, 1 Mar 2022 12:06:21 +0000 (13:06 +0100)]
print snapshot tree: reduce indentation delta per level

previous:

> `-> foo                         2021-05-28 12:59:36 no-description
>   `-> bar                       2021-06-18 12:44:48 no-description
>     `-> current                                     You are here!

now:

> `-> foo                         2021-05-28 12:59:36 no-description
>  `-> bar                        2021-06-18 12:44:48 no-description
>   `-> current                                       You are here!

So requires less space, allowing deeper snapshot trees to still be
displayed nicely, and looks even better while doing that - the latter
may be subjective though.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoprint snapshot tree: clamp indentation length to positive
Dominik Csapak [Mon, 28 Feb 2022 14:46:46 +0000 (15:46 +0100)]
print snapshot tree: clamp indentation length to positive

If a user has many snapshots, the length heuristic can go negative
and produce wrong indentation, so clamp it at 0.

Reported in the forum: https://forum.proxmox.com/threads/105740/

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 4.1-1
Thomas Lamprecht [Wed, 9 Feb 2022 17:28:20 +0000 (18:28 +0100)]
bump version to 4.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd storage tunnel module
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:36 +0000 (14:07 +0100)]
add storage tunnel module

encapsulating storage-related tunnel methods, currently
- source-side storage-migrate helper
- target-side disk-import handler
- target-side query-disk-import handler
- target-side bwlimit handler

to be extended further with replication-related handlers and helpers.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoadd tunnel helper module
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:35 +0000 (14:07 +0100)]
add tunnel helper module

lifted from PVE::QemuMigrate, abstracting away use-case specific data.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomigrate: add get_bwlimit helper
Fabian Grünbichler [Wed, 9 Feb 2022 13:07:34 +0000 (14:07 +0100)]
migrate: add get_bwlimit helper

given a source and target storage query either locally or both locally
and remotely and merge the result.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agomigrate: handle migration_network with remote migration
Fabian Grünbichler [Thu, 3 Feb 2022 12:41:22 +0000 (13:41 +0100)]
migrate: handle migration_network with remote migration

remote migration always has an explicit endpoint from the start which
gets used for everything.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoabstract config: fix implement-me comment
Thomas Lamprecht [Fri, 4 Feb 2022 16:36:03 +0000 (17:36 +0100)]
abstract config: fix implement-me comment

this is internal and doesn't needs to wait until a next major release

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoconfig: activate affected storages for snapshot operations
Fabian Ebner [Thu, 13 Jan 2022 11:04:01 +0000 (12:04 +0100)]
config: activate affected storages for snapshot operations

For snapshot creation, the storage for the vmstate file is activated
via vdisk_alloc when the state file is created.

Do not activate the volumes themselves, as that has unnecessary side
effects (e.g. waiting for zvol device link for ZFS, mapping the volume
for RBD). If a storage can only do snapshot operations on a volume
that has been activated, it needs to activate the volume itself.

The actual implementation will be in the plugins to be able to skip
CD ROM drives and bind-mounts, etc.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: remove unused variable
Fabian Ebner [Thu, 13 Jan 2022 11:04:00 +0000 (12:04 +0100)]
config: remove unused variable

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agosnapshot prepare: log on parent-cycle deletion
Thomas Lamprecht [Tue, 30 Nov 2021 07:13:13 +0000 (08:13 +0100)]
snapshot prepare: log on parent-cycle deletion

for new clones this should not happen anyway, as the API calls clean
such parent references up now, but for old ones it still can happen,
log to inform.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosnapshots: delete parent property if new snapshot name is already a parent to existin...
Oguz Bektas [Thu, 14 Oct 2021 09:29:57 +0000 (11:29 +0200)]
snapshots: delete parent property if new snapshot name is already a parent to existing one

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Tested-by: Hannes Laimer <h.laimer@proxmox.com>
2 years agoreplication: prepare: simplify code
Fabian Ebner [Fri, 26 Nov 2021 10:52:31 +0000 (11:52 +0100)]
replication: prepare: simplify code

No functional change is intended.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: update last_sync before removing old replication snapshots
Fabian Ebner [Fri, 26 Nov 2021 10:52:30 +0000 (11:52 +0100)]
replication: update last_sync before removing old replication snapshots

If pvesr was terminated after finishing with the new sync and after
removing old replication snapshots, but before it could write the new
state, the next replication would fail. It would wrongly interpret the
actual last replication snapshot as stale, remove it, and (if no other
snapshots are present) attempt a full sync, which would fail.

Reported in the community forum [0], this was brought to light by the
new pvescheduler before it learned graceful reload.

It's not possible to simply preserve a last remaining snapshot in
prepare(), because prepare() is also used for valid removals. Instead,
update last_sync early enough. Stale snapshots will still be removed
on the next run if there are any.

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

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 4.0-3
Fabian Grünbichler [Tue, 9 Nov 2021 12:17:37 +0000 (13:17 +0100)]
bump version to 4.0-3

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoconfig: snapshot delete check: use volume_snapshot_info
Fabian Ebner [Tue, 19 Oct 2021 07:54:56 +0000 (09:54 +0200)]
config: snapshot delete check: use volume_snapshot_info

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: find common snapshot: use additional information
Fabian Ebner [Tue, 19 Oct 2021 07:54:55 +0000 (09:54 +0200)]
replication: find common snapshot: use additional information

which is now available from the storage back-end.

The benefits are:

1. Ability to detect different snapshots even if they have the same
name. Rather hard to reach, but for example with:
Snapshots A -> B -> C -> __replicationXYZ
Remove B, rollback to C (causes __replicationXYZ to be removed),
create a new snapshot B. Previously, B was selected as replication
base, but it didn't match on source and target. Now, C is correctly
selected.
2. Smaller delta in some cases by not prefering replication snapshots
over config snapshots, but using the most recent possible one from
both types of snapshots.
3. Less code complexity for snapshot selection.

If the remote side is old, it's not possible to detect mismatch of
distinct snapshots with the same name, but the timestamps from the
local side can still be used.

Still limit to our snapshots (config and replication), because we
don't have guarantees for other snapshots (could be deleted in the
meantime, name might not fit import/export regex, etc.).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: prepare: return additional information about snapshots
Fabian Ebner [Tue, 19 Oct 2021 07:54:54 +0000 (09:54 +0200)]
replication: prepare: return additional information about snapshots

This is backwards compatible, because existing users of prepare() only
rely on the elements to evaluate to true or be defined.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: refactor finding most recent common replication snapshot
Fabian Ebner [Tue, 19 Oct 2021 07:54:53 +0000 (09:54 +0200)]
replication: refactor finding most recent common replication snapshot

By using a single loop instead. Should make the code more readable,
but also more efficient.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agofix #3111: config: snapshot delete: check if replication still needs it
Fabian Ebner [Thu, 12 Aug 2021 11:01:11 +0000 (13:01 +0200)]
fix #3111: config: snapshot delete: check if replication still needs it

and abort if it does and --force is not specified.

After rollback, the rollback snapshot might still be needed as the
base for incremental replication, because rollback removes (blocking)
replication snapshots.

It's not enough to limit the check to the most recent snapshot,
because new snapshots might've been created between rollback and
remove.

It's not enough to limit the check to snapshots without a parent (i.e.
in case of ZFS, the oldest), because some volumes might've been added
only after that, meaning the oldest snapshot is not an incremental
replication base for them.

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