restore-daemon: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
a637e7f490
commit
8dc1b5abf7
@ -4,6 +4,7 @@ version = "0.1.0"
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Proxmox Restore Daemon"
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
@ -12,7 +13,6 @@ env_logger.workspace = true
|
||||
futures.workspace = true
|
||||
http.workspace = true
|
||||
hyper.workspace = true
|
||||
lazy_static.workspace = true
|
||||
libc.workspace = true
|
||||
log.workspace = true
|
||||
nix.workspace = true
|
||||
|
@ -6,10 +6,9 @@ use std::os::unix::{
|
||||
net,
|
||||
};
|
||||
use std::path::Path;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::{Arc, LazyLock, Mutex};
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use lazy_static::lazy_static;
|
||||
use log::{error, info};
|
||||
use tokio::sync::mpsc;
|
||||
use tokio_stream::wrappers::ReceiverStream;
|
||||
@ -29,12 +28,9 @@ pub const MAX_PENDING: usize = 32;
|
||||
/// Will be present in base initramfs
|
||||
pub const VM_DETECT_FILE: &str = "/restore-vm-marker";
|
||||
|
||||
lazy_static! {
|
||||
/// The current disks state. Use for accessing data on the attached snapshots.
|
||||
pub static ref DISK_STATE: Arc<Mutex<DiskState>> = {
|
||||
Arc::new(Mutex::new(DiskState::scan().unwrap()))
|
||||
};
|
||||
}
|
||||
/// The current disks state. Use for accessing data on the attached snapshots.
|
||||
pub static DISK_STATE: LazyLock<Arc<Mutex<DiskState>>> =
|
||||
LazyLock::new(|| Arc::new(Mutex::new(DiskState::scan().unwrap())));
|
||||
|
||||
fn init_disk_state() {
|
||||
info!("scanning all disks...");
|
||||
|
@ -4,9 +4,9 @@ use std::fs::{create_dir_all, File};
|
||||
use std::io::{BufRead, BufReader};
|
||||
use std::path::{Component, Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use anyhow::{bail, format_err, Error};
|
||||
use lazy_static::lazy_static;
|
||||
use log::{info, warn};
|
||||
|
||||
use proxmox_schema::const_regex;
|
||||
@ -21,27 +21,25 @@ const_regex! {
|
||||
ZPOOL_IMPORT_DISK_REGEX = r"^\t {2,4}(vd[a-z]+(?:\d+)?)\s+ONLINE$";
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
static ref FS_OPT_MAP: HashMap<&'static str, &'static str> = {
|
||||
let mut m = HashMap::new();
|
||||
static FS_OPT_MAP: LazyLock<HashMap<&'static str, &'static str>> = LazyLock::new(|| {
|
||||
let mut m = HashMap::new();
|
||||
|
||||
// otherwise ext complains about mounting read-only
|
||||
m.insert("ext2", "noload");
|
||||
m.insert("ext3", "noload");
|
||||
m.insert("ext4", "noload");
|
||||
// otherwise ext complains about mounting read-only
|
||||
m.insert("ext2", "noload");
|
||||
m.insert("ext3", "noload");
|
||||
m.insert("ext4", "noload");
|
||||
|
||||
m.insert("xfs", "norecovery");
|
||||
m.insert("xfs", "norecovery");
|
||||
|
||||
// ufs2 is used as default since FreeBSD 5.0 released in 2003, so let's assume that
|
||||
// whatever the user is trying to restore is not using anything older...
|
||||
m.insert("ufs", "ufstype=ufs2");
|
||||
// ufs2 is used as default since FreeBSD 5.0 released in 2003, so let's assume that
|
||||
// whatever the user is trying to restore is not using anything older...
|
||||
m.insert("ufs", "ufstype=ufs2");
|
||||
|
||||
m.insert("ntfs", "utf8");
|
||||
m.insert("ntfs3", "iocharset=utf8");
|
||||
m.insert("ntfs", "utf8");
|
||||
m.insert("ntfs3", "iocharset=utf8");
|
||||
|
||||
m
|
||||
};
|
||||
}
|
||||
m
|
||||
});
|
||||
|
||||
pub enum ResolveResult {
|
||||
Path(PathBuf),
|
||||
|
Loading…
x
Reference in New Issue
Block a user