mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-05-01 05:44:20 +00:00
file restore: use proxmox-systemd crate
Some systemd code got split out from proxmox-sys and left there re-exported with a deprecation marker, use the newer crate, the workspace already depends on proxmox-systemd anyway. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
1c395ad195
commit
05d22be1cf
@ -24,6 +24,7 @@ proxmox-lang.workspace=true
|
|||||||
proxmox-router = { workspace = true, features = [ "cli" ] }
|
proxmox-router = { workspace = true, features = [ "cli" ] }
|
||||||
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
|
proxmox-schema = { workspace = true, features = [ "api-macro" ] }
|
||||||
proxmox-sys = { workspace = true, features = [ "logrotate" ] }
|
proxmox-sys = { workspace = true, features = [ "logrotate" ] }
|
||||||
|
proxmox-systemd.workspace = true
|
||||||
proxmox-time.workspace = true
|
proxmox-time.workspace = true
|
||||||
proxmox-uuid.workspace = true
|
proxmox-uuid.workspace = true
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use proxmox_sys::fs::lock_file;
|
use proxmox_sys::fs::lock_file;
|
||||||
|
use proxmox_systemd;
|
||||||
|
|
||||||
use pbs_api_types::{file_restore::FileRestoreFormat, BackupDir, BackupNamespace};
|
use pbs_api_types::{file_restore::FileRestoreFormat, BackupDir, BackupNamespace};
|
||||||
use pbs_client::{BackupRepository, VsockClient, DEFAULT_VSOCK_PORT};
|
use pbs_client::{BackupRepository, VsockClient, DEFAULT_VSOCK_PORT};
|
||||||
@ -88,7 +89,7 @@ fn make_name(repo: &BackupRepository, ns: &BackupNamespace, snap: &BackupDir) ->
|
|||||||
} else {
|
} else {
|
||||||
format!("qemu_{repo}:{ns}/{snap}")
|
format!("qemu_{repo}:{ns}/{snap}")
|
||||||
};
|
};
|
||||||
proxmox_sys::systemd::escape_unit(full, false)
|
proxmox_systemd::escape_unit(full, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// remove non-responsive VMs from given map, returns 'true' if map was modified
|
/// remove non-responsive VMs from given map, returns 'true' if map was modified
|
||||||
@ -309,7 +310,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
|
|||||||
let resp = client
|
let resp = client
|
||||||
.get("api2/json/status", Some(json!({"keep-timeout": true})))
|
.get("api2/json/status", Some(json!({"keep-timeout": true})))
|
||||||
.await;
|
.await;
|
||||||
let name = proxmox_sys::systemd::unescape_unit(n)
|
let name = proxmox_systemd::unescape_unit(n)
|
||||||
.unwrap_or_else(|_| "<invalid name>".to_owned());
|
.unwrap_or_else(|_| "<invalid name>".to_owned());
|
||||||
let mut extra = json!({"pid": s.pid, "cid": s.cid});
|
let mut extra = json!({"pid": s.pid, "cid": s.cid});
|
||||||
|
|
||||||
@ -344,7 +345,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
|
|||||||
|
|
||||||
fn stop(&self, id: String) -> Async<Result<(), Error>> {
|
fn stop(&self, id: String) -> Async<Result<(), Error>> {
|
||||||
async move {
|
async move {
|
||||||
let name = proxmox_sys::systemd::escape_unit(&id, false);
|
let name = proxmox_systemd::escape_unit(&id, false);
|
||||||
let mut map = VMStateMap::load()?;
|
let mut map = VMStateMap::load()?;
|
||||||
let map_mod = cleanup_map(&mut map.map).await;
|
let map_mod = cleanup_map(&mut map.map).await;
|
||||||
match map.map.get(&name) {
|
match map.map.get(&name) {
|
||||||
@ -374,7 +375,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
|
|||||||
match VMStateMap::load_read_only() {
|
match VMStateMap::load_read_only() {
|
||||||
Ok(state) => state
|
Ok(state) => state
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|(name, _)| proxmox_sys::systemd::unescape_unit(name).ok())
|
.filter_map(|(name, _)| proxmox_systemd::unescape_unit(name).ok())
|
||||||
.collect(),
|
.collect(),
|
||||||
Err(_) => Vec::new(),
|
Err(_) => Vec::new(),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user