]> git.proxmox.com Git - pve-guest-common.git/log
pve-guest-common.git
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
18 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>
19 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>
19 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>
19 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>
19 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>
21 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>
21 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>
21 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>
21 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>
23 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>
23 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>
23 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years agopartially fix #3111: replication: be less picky when selecting incremental base
Fabian Ebner [Thu, 12 Aug 2021 11:01:10 +0000 (13:01 +0200)]
partially fix #3111: replication: be less picky when selecting incremental base

After rollback, it might be necessary to start the replication from an
earlier, possibly non-replication, snapshot, because the replication
snapshot might have been removed from the source node. Previously,
replication could only recover in case the current parent snapshot was
already replicated.

To get into the bad situation (with no replication happening between
the steps):
1. have existing replication
2. take new snapshot
3. rollback to that snapshot
In case the partial fix to only remove blocking replication snapshots
for rollback was already applied, an additional step is necessary to
get into the bad situation:
4. take a second new snapshot

Since non-replication snapshots are now also included, where no
timestamp is readily available, it is necessary to filter them out
when probing for replication snapshots.

If no common replication snapshot is present, iterate backwards
through the config snapshots.

The changes are backwards compatible:

If one side is running the old code, and the other the new code,
the fact that one of the two prepare() calls does not return the
new additional snapshot candidates, means that no new match is
possible. Since the new prepare() returns a superset, no previously
possible match is now impossible.

The branch with @desc_sorted_snap is now taken more often, but
it can still only be taken when the volume exists on the remote side
(and has snapshots). In such cases, it is safe to die if no
incremental base snapshot can be found, because a full sync would not
be possible.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: pass guest config to find_common_replication_snapshot
Fabian Ebner [Thu, 12 Aug 2021 11:01:09 +0000 (13:01 +0200)]
replication: pass guest config to find_common_replication_snapshot

in preparation to iterate over all config snapshots when necessary.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoreplication: remove unused variable and style fixes
Fabian Ebner [Thu, 12 Aug 2021 11:01:08 +0000 (13:01 +0200)]
replication: remove unused variable and style fixes

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopartially fix #3111: further improve removing replication snapshots
Fabian Ebner [Thu, 12 Aug 2021 11:01:07 +0000 (13:01 +0200)]
partially fix #3111: further improve removing replication snapshots

by using the new $blocker parameter. No longer remove all replication
snapshots from affected volumes unconditionally, but check first if
all blocking snapshots are replication snapshots. If they are, remove
them and proceed with rollback. If they are not, die without removing
any.

For backwards compatibility, it's still necessary to remove all
replication snapshots if $blockers is not available.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoconfig: rollback: factor out helper for removing replication snapshots
Fabian Ebner [Thu, 12 Aug 2021 11:01:06 +0000 (13:01 +0200)]
config: rollback: factor out helper for removing replication snapshots

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agopartially fix #3111: snapshot rollback: improve removing replication snapshots
Fabian Ebner [Thu, 12 Aug 2021 11:01:05 +0000 (13:01 +0200)]
partially fix #3111: snapshot rollback: improve removing replication snapshots

Get the replicatable volumes from the snapshot config rather than the
current config. And filter those volumes further to those that will
actually be rolled back.

Previously, a volume that only had replication snapshots (e.g. because
it was added after the snapshot was taken, or the vmstate volume)
would lose them.  Then, on the next replication run, such a volume
would lead to an error, because replication tried to do a full sync,
but the target volume still exists.

This is not a complete fix. It is still possible to run into problems:
- by removing the last (non-replication) snapshots after a rollback
  before replication can run once.
- by creating a snapshot and making a rollback before replication can
  run once.

The list of volumes is not required to be sorted for prepare(), but it
is sorted by how foreach_volume() iterates now, so not random.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobuild: switch upload target to bullseye
Fabian Grünbichler [Wed, 9 Jun 2021 09:39:15 +0000 (11:39 +0200)]
build: switch upload target to bullseye

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 4.0-2
Fabian Grünbichler [Wed, 9 Jun 2021 08:07:42 +0000 (10:07 +0200)]
bump version to 4.0-2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agovzdump: defaults: keep all backups by default for 7.0
Fabian Ebner [Fri, 4 Jun 2021 13:49:26 +0000 (15:49 +0200)]
vzdump: defaults: keep all backups by default for 7.0

and switch to using prune-backups instead of maxfiles.

Storages created via the web UI defaulted to keeping all backups already, switch
to this safer default here as well.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agovzdump: remove deprecated size parameter
Fabian Ebner [Fri, 4 Jun 2021 13:49:25 +0000 (15:49 +0200)]
vzdump: remove deprecated size parameter

It was deprecated for a long time (before it got move to guest-common) already,
and there also was a deprecation warning when passed as a CLI option.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 4.0-1
Thomas Lamprecht [Wed, 12 May 2021 11:08:53 +0000 (13:08 +0200)]
bump version to 4.0-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: increase compat level to 12
Thomas Lamprecht [Wed, 12 May 2021 11:03:34 +0000 (13:03 +0200)]
d/control: increase compat level to 12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agod/control: update meta information
Thomas Lamprecht [Wed, 12 May 2021 11:03:09 +0000 (13:03 +0200)]
d/control: update meta information

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobuildsys: split packaging and source build-systems
Thomas Lamprecht [Sun, 9 May 2021 18:10:14 +0000 (20:10 +0200)]
buildsys: split packaging and source build-systems

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomention prune behavior for the remove parameter
Fabian Ebner [Wed, 3 Mar 2021 11:50:40 +0000 (12:50 +0100)]
mention prune behavior for the remove parameter

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-5
Thomas Lamprecht [Fri, 19 Feb 2021 15:32:26 +0000 (16:32 +0100)]
bump version to 3.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: mailto: use email-or-username-list format
Fabian Ebner [Mon, 15 Feb 2021 12:24:59 +0000 (13:24 +0100)]
vzdump: mailto: use email-or-username-list format

because it is a more complete pattern. Also, 'mailto' was a '-list' format in
PVE 6.2 and earlier, so this also fixes whitespace-related backwards
compatibility. In particular, this fixes creating a backup job in the GUI
without setting an address, which passes along ''.

For example,
> vzdump 153 --mailto " ,,,admin@proxmox.com;;; developer@proxmox.com , ; "
was valid and worked in PVE 6.2.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: command line: make sure mailto is comma-separated
Fabian Ebner [Mon, 15 Feb 2021 12:24:58 +0000 (13:24 +0100)]
vzdump: command line: make sure mailto is comma-separated

In addition to relying on shellquote(), it's still nice to avoid printing out
unnecessary whitespaces, especially newlines.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: command line: refactor handling prune-backups
Fabian Ebner [Mon, 15 Feb 2021 12:24:57 +0000 (13:24 +0100)]
vzdump: command line: refactor handling prune-backups

to re-use a line here and with the next patch.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: correctly handle prune-backups option in commandline and cron config
Fabian Ebner [Tue, 24 Nov 2020 11:27:28 +0000 (12:27 +0100)]
vzdump: correctly handle prune-backups option in commandline and cron config

Previously only the hash reference was printed instead of the property string.
It's also necessary to parse the property string when reading the cron config.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agovzdump: add explicit reminder for breaking schema change for PVE 7.0
Fabian Ebner [Fri, 15 Jan 2021 12:59:30 +0000 (13:59 +0100)]
vzdump: add explicit reminder for breaking schema change for PVE 7.0

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-4
Thomas Lamprecht [Tue, 15 Dec 2020 14:52:58 +0000 (15:52 +0100)]
bump version to 3.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: update exclude-path description
Fabian Ebner [Fri, 20 Nov 2020 14:50:41 +0000 (15:50 +0100)]
vzdump: update exclude-path description

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agojob_status: simplify fixup of jobs for stolen guests
Fabian Ebner [Thu, 29 Oct 2020 13:31:29 +0000 (14:31 +0100)]
job_status: simplify fixup of jobs for stolen guests

by using switch_replication_job_target_nolock.

If a job is scheduled for removal and the guest was
stolen, it still makes sense to correct the job entry,
which didn't happen previously.

AFAICT, this was the only user of swap_source_target_nolock.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agocreate nolock variant for switch_replication_job_target
Fabian Ebner [Thu, 29 Oct 2020 13:31:28 +0000 (14:31 +0100)]
create nolock variant for switch_replication_job_target

so that it can be used within job_status

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoalso update sources in switch_replication_job_target
Fabian Ebner [Thu, 29 Oct 2020 13:31:27 +0000 (14:31 +0100)]
also update sources in switch_replication_job_target

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoclarify what the source property is used for in a replication job
Fabian Ebner [Thu, 29 Oct 2020 13:31:26 +0000 (14:31 +0100)]
clarify what the source property is used for in a replication job

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agojob_status: read only after acquiring the lock
Fabian Ebner [Thu, 29 Oct 2020 13:31:25 +0000 (14:31 +0100)]
job_status: read only after acquiring the lock

to get the current replication config and have the VM list
and state object as recent as possible.

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoprint snapshot tree: reduce indentation
Thomas Lamprecht [Sat, 24 Oct 2020 14:56:54 +0000 (16:56 +0200)]
print snapshot tree: reduce indentation

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agovzdump: use regex check for 'mailto'
Oguz Bektas [Tue, 7 Jul 2020 12:55:40 +0000 (14:55 +0200)]
vzdump: use regex check for 'mailto'

add a new string format to allow local usernames like 'root' but also
limit which characters can be used in the 'mailto' address.

Co-Authored-by: Fabian Gruenbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agobump version to 3.1-3
Thomas Lamprecht [Mon, 24 Aug 2020 08:12:34 +0000 (10:12 +0200)]
bump version to 3.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agomove config: add comment about node owning configs
Thomas Lamprecht [Mon, 24 Aug 2020 07:45:30 +0000 (09:45 +0200)]
move config: add comment about node owning configs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoAdd move_config_to_node method
Fabian Ebner [Thu, 20 Aug 2020 09:11:38 +0000 (11:11 +0200)]
Add move_config_to_node method

allows to mock it when testing and a few lines less duplication
between the migration modules.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agoAdd prune-backups option to vzdump parameters
Fabian Ebner [Thu, 9 Jul 2020 12:45:44 +0000 (14:45 +0200)]
Add prune-backups option to vzdump parameters

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agobump version to 3.1-2
Fabian Grünbichler [Wed, 5 Aug 2020 10:15:00 +0000 (12:15 +0200)]
bump version to 3.1-2

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agounbreak config_with_pending_array
Fabian Grünbichler [Wed, 5 Aug 2020 10:05:18 +0000 (12:05 +0200)]
unbreak config_with_pending_array

which lead to current and pending/delete values being returned
separately, and being misinterpreted by the web interface (and probably
other clients as well).

Fixes: daf8fca57a34417365c873ed91f3a52bf0002a4f
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 3.1-1
Thomas Lamprecht [Mon, 13 Jul 2020 07:08:57 +0000 (09:08 +0200)]
bump version to 3.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup: add comment to avoid same mistake again
Thomas Lamprecht [Sat, 11 Jul 2020 16:47:53 +0000 (18:47 +0200)]
followup: add comment to avoid same mistake again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2834: skip refs in config_with_pending_array
Stoiko Ivanov [Fri, 10 Jul 2020 18:11:28 +0000 (20:11 +0200)]
fix #2834: skip refs in config_with_pending_array

With the refactoring of config_with_pending_array in
daf8fca57a34417365c873ed91f3a52bf0002a4f a few sanity checks on parsed configs
were dropped.

One case where a config value should be skipped, instead of parsed and added
is when the value is not scalar. This is the case for the raw lxc keys
(e.g. lxc.init.cmd, lxc.apparmor.profile) - which get added as array to the
'lxc' key.

This patch reintroduces the skipping of non-scalar values, when parsing the
config but not for the pending values.
From a short look through the commit history the sanity checks were in place
since 2014 (introduced in qemu-server for handling pending configuration
changes), and their removal did not cause any other regressions.
To my knowledge only the raw lxc config keys are parsed into a non-scalar
value.

Tested by adding a 'lxc.init.cmd' key to a container config.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agobump version to 3.0-11
Thomas Lamprecht [Tue, 7 Jul 2020 16:42:41 +0000 (18:42 +0200)]
bump version to 3.0-11

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoAdapt description of get_backup_volumes
Aaron Lauterer [Mon, 22 Jun 2020 14:34:39 +0000 (16:34 +0200)]
Adapt description of get_backup_volumes

as `data` was a bit too generic we now use `volume_config` in the actual
implementations. Thus we should adapt the description as well.

Tab spacing for the other keys has been adapted for easier readabilty.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agorefactor config_with_pending_array
Thomas Lamprecht [Wed, 20 May 2020 15:08:09 +0000 (17:08 +0200)]
refactor config_with_pending_array

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix config_with_pending_array for falsy current values
Thomas Lamprecht [Wed, 20 May 2020 15:00:55 +0000 (17:00 +0200)]
fix config_with_pending_array for falsy current values

one could have a config with:
> acpi: 0

and a pending deletion for that to restore the default 1 value.

The config_with_pending_array method then pushed the key twice, one
in the loop iterating the config itself correctly and once in the
pending delete hash, which is normally only for those options not yet
referenced in the config at all. Here the check was on "truthiness"
not definedness, fix that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 3.0-10
Fabian Grünbichler [Tue, 5 May 2020 09:41:48 +0000 (11:41 +0200)]
bump version to 3.0-10

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 3.0-9
Fabian Grünbichler [Tue, 5 May 2020 09:19:59 +0000 (11:19 +0200)]
bump version to 3.0-9

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: break older pve-container
Fabian Grünbichler [Tue, 5 May 2020 09:24:14 +0000 (11:24 +0200)]
d/control: break older pve-container

since the changed locking exposes a bug that requires fixing on the
pve-container side.

4 years agod/control: break older qemu-server
Fabian Grünbichler [Tue, 5 May 2020 09:18:38 +0000 (11:18 +0200)]
d/control: break older qemu-server

since we renamed lock_config_mode to lock_config_shared

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agolock_config: rename lock_config_mode -> lock_config_shared
Fabian Grünbichler [Tue, 5 May 2020 08:27:22 +0000 (10:27 +0200)]
lock_config: rename lock_config_mode -> lock_config_shared

and pull the actual lock_file_full handling into a helper, to make the
public interface clearer:

lock_config -> standard exclusive lock with 10s timeout
lock_config_full -> exclusive lock with configurable timeout
lock_config_shared -> shared lock with configurable timeout

the latter only has a single user (qemu-server's clone API call)
currently.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_delete: check for concurrent modifications at each step
Fabian Grünbichler [Tue, 5 May 2020 08:27:21 +0000 (10:27 +0200)]
snapshot_delete: check for concurrent modifications at each step

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_rollback: make sure newer replication snapshots are deleted
Fabian Ebner [Tue, 5 May 2020 08:27:19 +0000 (10:27 +0200)]
snapshot_rollback: make sure newer replication snapshots are deleted

Commit a1dfeff3a8502544123245ea61ad62cbe97803b7 changed the behavior
for Replication::prepare with last_sync=0, so use last_sync=1 instead.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agosnapshot_rollback: flock earlier
Fabian Grünbichler [Tue, 5 May 2020 08:27:18 +0000 (10:27 +0200)]
snapshot_rollback: flock earlier

to protect checks against concurrent modifications

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Ebner <f.ebner@proxmox.com>
4 years agofix 2682: make sure configuration file is up-to-date for lock_config-variants
Fabian Ebner [Tue, 5 May 2020 08:27:17 +0000 (10:27 +0200)]
fix 2682: make sure configuration file is up-to-date for lock_config-variants

See [0] for the details. The call tree for the variants is
lock_config -> lock_config_full -> lock_config_mode
so it is sufficient to adapt lock_config_mode.

[0]: https://bugzilla.proxmox.com/show_bug.cgi?id=2682

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>