use UPID and systemd helpers from proxmox 0.13.4

This commit is contained in:
Dietmar Maurer
2021-09-22 12:46:44 +02:00
parent 0a33fba49c
commit 81867f0539
23 changed files with 86 additions and 318 deletions

View File

@ -80,7 +80,7 @@ impl VMStateMap {
fn make_name(repo: &BackupRepository, snap: &BackupDir) -> String {
let full = format!("qemu_{}/{}", repo, snap);
proxmox_systemd::escape_unit(&full, false)
proxmox::tools::systemd::escape_unit(&full, false)
}
/// remove non-responsive VMs from given map, returns 'true' if map was modified
@ -257,7 +257,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
let resp = client
.get("api2/json/status", Some(json!({"keep-timeout": true})))
.await;
let name = proxmox_systemd::unescape_unit(n)
let name = proxmox::tools::systemd::unescape_unit(n)
.unwrap_or_else(|_| "<invalid name>".to_owned());
let mut extra = json!({"pid": s.pid, "cid": s.cid});
@ -295,7 +295,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
fn stop(&self, id: String) -> Async<Result<(), Error>> {
async move {
let name = proxmox_systemd::escape_unit(&id, false);
let name = proxmox::tools::systemd::escape_unit(&id, false);
let mut map = VMStateMap::load()?;
let map_mod = cleanup_map(&mut map.map).await;
match map.map.get(&name) {
@ -325,7 +325,7 @@ impl BlockRestoreDriver for QemuBlockDriver {
match VMStateMap::load_read_only() {
Ok(state) => state
.iter()
.filter_map(|(name, _)| proxmox_systemd::unescape_unit(&name).ok())
.filter_map(|(name, _)| proxmox::tools::systemd::unescape_unit(&name).ok())
.collect(),
Err(_) => Vec::new(),
}