From: Eric Bollengier Date: Mon, 2 Feb 2026 07:32:57 +0000 (+0100) Subject: Fix org#2376 Update numvols after deleting a volume X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=329dd0860b02745b5dadd48a20d560e3a8596f08;p=thirdparty%2Fbacula.git Fix org#2376 Update numvols after deleting a volume --- diff --git a/bacula/src/dird/ua_cmds.c b/bacula/src/dird/ua_cmds.c index 1f3a3e988..16cfbd3c7 100644 --- a/bacula/src/dird/ua_cmds.c +++ b/bacula/src/dird/ua_cmds.c @@ -2327,7 +2327,20 @@ static int delete_a_volume(UAContext *ua, MEDIA_DBR *mr) /* Keep track of this important event */ ua->send_events("DC0010", EVENTS_TYPE_COMMAND, "delete volume=%s", mr->VolumeName); + POOL_DBR pr; + pr.PoolId = mr->PoolId; + + db_lock(ua->db); db_delete_media_record(ua->jcr, ua->db, mr); + /* Don't compute NumVols here */ + if (db_get_pool_record(ua->jcr, ua->db, &pr)) { + /* NumVols is updated here */ + db_update_pool_record(ua->jcr, ua->db, &pr); + /* If we cannot update the pool record, it will be done the next time, or + * it's not a problem + */ + } + db_unlock(ua->db); return 1; }