/* 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;
}