fix #7860: api: backup info: skip jobs with invalid guest selection
A backup job in pool mode keeps referencing its pool after the pool got deleted. Resolving the guests of such a job dies with "pool '<name>' does not exist", and since get_included_vmids() did not catch this, the whole /cluster/backup-info/not-backed-up call failed. The GUI then hides the "Show guests without backup job" button, so users lose exactly the overview that would tell them some guests are no longer backed up. Catch the error per job, warn about it and continue with the remaining jobs. The broken job does not back up anything, so its guests correctly show up as not covered by any backup job. Add a test for get_included_vmids() covering this case. Signed-off-by: Michal Fox <me@dualfroz.com>
This commit is contained in:
1 parent
ac62170ae2
commit
c09a3d7d49
3 files changed
+82
-2
No files matched your search
@@ -25,7 +25,12 @@ sub get_included_vmids {
|
||||
|
||||
my $all_vmids = {};
|
||||
for my $job ($legacy_jobs->@*, grep { $_->{type} eq 'vzdump' } values $jobs->{ids}->%*) {
|
||||
my $job_included_guests = PVE::VZDump::get_included_guests($job);
|
||||
# a job referencing e.g. a deleted pool backs up nothing, but must not break the overview
|
||||
my $job_included_guests = eval { PVE::VZDump::get_included_guests($job) };
|
||||
if (my $err = $@) {
|
||||
warn "ignoring backup job with invalid guest selection - $err";
|
||||
next;
|
||||
}
|
||||
$all_vmids->{$_} = 1 for map { $_->@* } values %{$job_included_guests};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user