]> git.proxmox.com Git - pve-manager.git/commit - PVE/API2/Backup.pm
Jobs: fix scheduling after updating job from a different node
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 15 Jul 2022 12:34:35 +0000 (14:34 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 5 Aug 2022 11:08:08 +0000 (13:08 +0200)
commit2cf7706e3d90cc23fe9861d2f4bceea023934db5
treebd0ac94cdd159d3f95f261ea9ff7aad7d226a929
parent9018237e242038ee505da7730e0543fbccacb579
Jobs: fix scheduling after updating job from a different node

since the jobs are configured clusterwide in pmxcfs, a user can use any
node to update the config of them. for some configs (schedule/enabled)
we need to update the last runtime in the state file, but this
is sadly only node-local.

to also update the state file on the other nodes, we introduce
a new 'detect_changed_runtime_props' function that checks and saves relevant
properties from the config to the statefile each round of the scheduler if they
changed.

this way, we can detect changes in those and update the last runtime too.

the only situation where we don't detect a config change is when the
user changes back to the previous configuration in between iterations.
This can be ignored though, since it would not be scheduled then
anyway.

in 'synchronize_job_states_with_config' we switch from reading the
jobstate unconditionally to check the existance of the statefile
(which is the only condition that can return undef anyway)
so that we don't read the file multiple times each round.

Fixes: 0c8d7468 ("fix #4053: don't run vzdump jobs when they change from
disabled->enabled")

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/API2/Backup.pm
PVE/Jobs.pm