]> git.proxmox.com Git - proxmox-backup.git/blobdiff - proxmox-rest-server/src/worker_task.rs
use new fsync parameter to replace_file and atomic_open_or_create
[proxmox-backup.git] / proxmox-rest-server / src / worker_task.rs
index 51394549cdbaa579bb714aac59cf902eb627f205..242d2de23e76206ece641efcc22d3cd370706860 100644 (file)
@@ -17,9 +17,9 @@ use nix::fcntl::OFlag;
 use once_cell::sync::OnceCell;
 
 use proxmox::sys::linux::procfs;
-use proxmox::try_block;
 use proxmox::tools::fs::{create_path, replace_file, atomic_open_or_create_file, CreateOptions};
-use proxmox::api::upid::UPID;
+use proxmox_lang::try_block;
+use proxmox_schema::upid::UPID;
 
 use pbs_tools::task::WorkerTaskContext;
 use pbs_tools::logrotate::{LogRotate, LogRotateFiles};
@@ -120,7 +120,7 @@ impl WorkerTaskSetup {
 
                 if !worker_is_active_local(&info.upid) {
                     // println!("Detected stopped task '{}'", &info.upid_str);
-                    let now = proxmox::tools::time::epoch_i64();
+                    let now = proxmox_time::epoch_i64();
                     let status = upid_read_status(&info.upid).unwrap_or(TaskState::Unknown { endtime: now });
                     finish_list.push(TaskListInfo {
                         upid: info.upid,
@@ -146,6 +146,7 @@ impl WorkerTaskSetup {
             &self.active_tasks_fn,
             active_raw.as_bytes(),
             options,
+            false,
         )?;
 
         finish_list.sort_unstable_by(|a, b| {
@@ -166,6 +167,7 @@ impl WorkerTaskSetup {
                 OFlag::O_APPEND | OFlag::O_RDWR,
                 &[],
                 options,
+                false,
             )?;
             for info in &finish_list {
                 writer.write_all(render_task_line(&info).as_bytes())?;
@@ -320,7 +322,7 @@ pub fn upid_read_status(upid: &UPID) -> Result<TaskState, Error> {
 
     let mut iter = last_line.splitn(2, ": ");
     if let Some(time_str) = iter.next() {
-        if let Ok(endtime) = proxmox::tools::time::parse_rfc3339(time_str) {
+        if let Ok(endtime) = proxmox_time::parse_rfc3339(time_str) {
             // set the endtime even if we cannot parse the state
             status = TaskState::Unknown { endtime };
             if let Some(rest) = iter.next().and_then(|rest| rest.strip_prefix("TASK ")) {
@@ -839,7 +841,7 @@ impl WorkerTask {
     pub fn create_state(&self, result: &Result<(), Error>) -> TaskState {
         let warn_count = self.data.lock().unwrap().warn_count;
 
-        let endtime = proxmox::tools::time::epoch_i64();
+        let endtime = proxmox_time::epoch_i64();
 
         if let Err(err) = result {
             TaskState::Error { message: err.to_string(), endtime }