tape: create tmp dirs early at server startup

This commit is contained in:
Dietmar Maurer
2021-02-19 17:49:50 +01:00
parent aca4c2b5a9
commit cd44fb8d84
4 changed files with 49 additions and 11 deletions

View File

@ -20,6 +20,7 @@ mod mam;
pub use mam::*;
use std::os::unix::io::AsRawFd;
use std::path::PathBuf;
use anyhow::{bail, format_err, Error};
use ::serde::{Deserialize};
@ -470,10 +471,9 @@ pub fn set_tape_device_state(
drive: &str,
state: &str,
) -> Result<(), Error> {
let mut path = "/run/proxmox-backup/drive-state".to_string();
std::fs::create_dir_all(&path)?;
use std::fmt::Write;
write!(path, "/{}", drive)?;
let mut path = PathBuf::from(crate::tape::DRIVE_STATE_DIR);
path.push(drive);
let backup_user = crate::backup::backup_user()?;
let mode = nix::sys::stat::Mode::from_bits_truncate(0o0644);