use proxmox::tools::fs::{replace_file, file_read_optional_string, CreateOptions, open_file_locked};
+use pbs_datastore::{task_log, task_warn};
+use pbs_datastore::task::TaskState;
use pbs_tools::format::HumanByte;
use pbs_tools::fs::{lock_dir_noblock, DirLockGuard};
use super::index::*;
use super::{DataBlob, ArchiveType, archive_type};
use crate::config::datastore::{self, DataStoreConfig};
-use crate::task::TaskState;
use crate::tools;
use crate::api2::types::{Authid, GarbageCollectionStatus};
use crate::server::UPID;
if let Some(datastore) = map.get(name) {
// Compare Config - if changed, create new Datastore object!
- if datastore.chunk_store.base == path &&
+ if datastore.chunk_store.base() == path &&
datastore.verify_new == config.verify_new.unwrap_or(false)
{
return Ok(datastore.clone());
tools::fail_on_shutdown()?;
let digest = index.index_digest(pos).unwrap();
if !self.chunk_store.cond_touch_chunk(digest, false)? {
- crate::task_warn!(
+ task_warn!(
worker,
"warning: unable to access non-existent chunk {}, required by {:?}",
proxmox::tools::digest_to_hex(digest),
let percentage = (i + 1) * 100 / image_count;
if percentage > last_percentage {
- crate::task_log!(
+ task_log!(
worker,
"marked {}% ({} of {} index files)",
percentage,
}
if strange_paths_count > 0 {
- crate::task_log!(
+ task_log!(
worker,
"found (and marked) {} index files outside of expected directory scheme",
strange_paths_count,
let mut gc_status = GarbageCollectionStatus::default();
gc_status.upid = Some(upid.to_string());
- crate::task_log!(worker, "Start GC phase1 (mark used chunks)");
+ task_log!(worker, "Start GC phase1 (mark used chunks)");
self.mark_used_chunks(&mut gc_status, worker)?;
- crate::task_log!(worker, "Start GC phase2 (sweep unused chunks)");
+ task_log!(worker, "Start GC phase2 (sweep unused chunks)");
self.chunk_store.sweep_unused_chunks(
oldest_writer,
phase1_start_time,
&mut gc_status,
worker,
+ crate::tools::fail_on_shutdown,
)?;
- crate::task_log!(
+ task_log!(
worker,
"Removed garbage: {}",
HumanByte::from(gc_status.removed_bytes),
);
- crate::task_log!(worker, "Removed chunks: {}", gc_status.removed_chunks);
+ task_log!(worker, "Removed chunks: {}", gc_status.removed_chunks);
if gc_status.pending_bytes > 0 {
- crate::task_log!(
+ task_log!(
worker,
"Pending removals: {} (in {} chunks)",
HumanByte::from(gc_status.pending_bytes),
);
}
if gc_status.removed_bad > 0 {
- crate::task_log!(worker, "Removed bad chunks: {}", gc_status.removed_bad);
+ task_log!(worker, "Removed bad chunks: {}", gc_status.removed_bad);
}
if gc_status.still_bad > 0 {
- crate::task_log!(worker, "Leftover bad chunks: {}", gc_status.still_bad);
+ task_log!(worker, "Leftover bad chunks: {}", gc_status.still_bad);
}
- crate::task_log!(
+ task_log!(
worker,
"Original data usage: {}",
HumanByte::from(gc_status.index_data_bytes),
if gc_status.index_data_bytes > 0 {
let comp_per = (gc_status.disk_bytes as f64 * 100.)/gc_status.index_data_bytes as f64;
- crate::task_log!(
+ task_log!(
worker,
"On-Disk usage: {} ({:.2}%)",
HumanByte::from(gc_status.disk_bytes),
);
}
- crate::task_log!(worker, "On-Disk chunks: {}", gc_status.disk_chunks);
+ task_log!(worker, "On-Disk chunks: {}", gc_status.disk_chunks);
let deduplication_factor = if gc_status.disk_bytes > 0 {
(gc_status.index_data_bytes as f64)/(gc_status.disk_bytes as f64)
1.0
};
- crate::task_log!(worker, "Deduplication factor: {:.2}", deduplication_factor);
+ task_log!(worker, "Deduplication factor: {:.2}", deduplication_factor);
if gc_status.disk_chunks > 0 {
let avg_chunk = gc_status.disk_bytes/(gc_status.disk_chunks as u64);
- crate::task_log!(worker, "Average chunk size: {}", HumanByte::from(avg_chunk));
+ task_log!(worker, "Average chunk size: {}", HumanByte::from(avg_chunk));
}
if let Ok(serialized) = serde_json::to_string(&gc_status) {