[pbs-devel] [PATCH proxmox-backup 2/2] rename pbs-systemd to proxmox-systemd
Dietmar Maurer
dietmar at proxmox.com
Tue Sep 21 09:33:51 CEST 2021
---
Cargo.toml | 4 ++--
Makefile | 2 +-
pbs-api-types/Cargo.toml | 2 +-
pbs-api-types/src/jobs.rs | 8 ++++----
pbs-api-types/src/tape/media_pool.rs | 2 +-
pbs-api-types/src/upid.rs | 4 ++--
proxmox-backup-client/Cargo.toml | 2 +-
proxmox-backup-client/src/mount.rs | 8 ++++----
proxmox-file-restore/Cargo.toml | 2 +-
proxmox-file-restore/src/block_driver_qemu.rs | 8 ++++----
{pbs-systemd => proxmox-systemd}/Cargo.toml | 2 +-
{pbs-systemd => proxmox-systemd}/src/lib.rs | 0
{pbs-systemd => proxmox-systemd}/src/parse_time.rs | 0
{pbs-systemd => proxmox-systemd}/src/time.rs | 0
{pbs-systemd => proxmox-systemd}/src/unit.rs | 0
src/api2/node/disks/directory.rs | 12 ++++++------
src/api2/node/disks/zfs.rs | 4 ++--
src/bin/proxmox-backup-proxy.rs | 2 +-
src/server/email_notifications.rs | 2 +-
src/server/jobstate.rs | 2 +-
src/tape/drive/mod.rs | 2 +-
src/tape/inventory.rs | 2 +-
src/tape/media_pool.rs | 2 +-
src/tape/test/alloc_writable_media.rs | 2 +-
src/tape/test/compute_media_state.rs | 4 ++--
src/tools/systemd/types.rs | 4 ++--
26 files changed, 41 insertions(+), 41 deletions(-)
rename {pbs-systemd => proxmox-systemd}/Cargo.toml (93%)
rename {pbs-systemd => proxmox-systemd}/src/lib.rs (100%)
rename {pbs-systemd => proxmox-systemd}/src/parse_time.rs (100%)
rename {pbs-systemd => proxmox-systemd}/src/time.rs (100%)
rename {pbs-systemd => proxmox-systemd}/src/unit.rs (100%)
diff --git a/Cargo.toml b/Cargo.toml
index 95588d06..cd7af590 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@ members = [
"pbs-fuse-loop",
"pbs-runtime",
"proxmox-rest-server",
- "pbs-systemd",
+ "proxmox-systemd",
"pbs-tape",
"pbs-tools",
@@ -110,7 +110,7 @@ pbs-config = { path = "pbs-config" }
pbs-datastore = { path = "pbs-datastore" }
pbs-runtime = { path = "pbs-runtime" }
proxmox-rest-server = { path = "proxmox-rest-server" }
-pbs-systemd = { path = "pbs-systemd" }
+proxmox-systemd = { path = "proxmox-systemd" }
pbs-tools = { path = "pbs-tools" }
pbs-tape = { path = "pbs-tape" }
diff --git a/Makefile b/Makefile
index 8a304469..56fb5437 100644
--- a/Makefile
+++ b/Makefile
@@ -40,7 +40,7 @@ SUBCRATES := \
pbs-fuse-loop \
pbs-runtime \
proxmox-rest-server \
- pbs-systemd \
+ proxmox-systemd \
pbs-tape \
pbs-tools \
proxmox-backup-banner \
diff --git a/pbs-api-types/Cargo.toml b/pbs-api-types/Cargo.toml
index 02c8c2d4..a64d7f0a 100644
--- a/pbs-api-types/Cargo.toml
+++ b/pbs-api-types/Cargo.toml
@@ -16,5 +16,5 @@ serde = { version = "1.0", features = ["derive"] }
proxmox = { version = "0.13.3", default-features = false, features = [ "api-macro" ] }
-pbs-systemd = { path = "../pbs-systemd" }
+proxmox-systemd = { path = "../proxmox-systemd" }
pbs-tools = { path = "../pbs-tools" }
diff --git a/pbs-api-types/src/jobs.rs b/pbs-api-types/src/jobs.rs
index 1526dbc4..a9c64779 100644
--- a/pbs-api-types/src/jobs.rs
+++ b/pbs-api-types/src/jobs.rs
@@ -25,25 +25,25 @@ pub const JOB_ID_SCHEMA: Schema = StringSchema::new("Job ID.")
pub const SYNC_SCHEDULE_SCHEMA: Schema = StringSchema::new(
"Run sync job at specified schedule.")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_calendar_event))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_calendar_event))
.type_text("<calendar-event>")
.schema();
pub const GC_SCHEDULE_SCHEMA: Schema = StringSchema::new(
"Run garbage collection job at specified schedule.")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_calendar_event))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_calendar_event))
.type_text("<calendar-event>")
.schema();
pub const PRUNE_SCHEDULE_SCHEMA: Schema = StringSchema::new(
"Run prune job at specified schedule.")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_calendar_event))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_calendar_event))
.type_text("<calendar-event>")
.schema();
pub const VERIFICATION_SCHEDULE_SCHEMA: Schema = StringSchema::new(
"Run verify job at specified schedule.")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_calendar_event))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_calendar_event))
.type_text("<calendar-event>")
.schema();
diff --git a/pbs-api-types/src/tape/media_pool.rs b/pbs-api-types/src/tape/media_pool.rs
index 53e46788..9e3d8b56 100644
--- a/pbs-api-types/src/tape/media_pool.rs
+++ b/pbs-api-types/src/tape/media_pool.rs
@@ -14,7 +14,7 @@ use proxmox::api::{
schema::{Schema, StringSchema, ApiStringFormat, Updater},
};
-use pbs_systemd::time::{parse_calendar_event, parse_time_span, CalendarEvent, TimeSpan};
+use proxmox_systemd::time::{parse_calendar_event, parse_time_span, CalendarEvent, TimeSpan};
use crate::{
PROXMOX_SAFE_ID_FORMAT,
diff --git a/pbs-api-types/src/upid.rs b/pbs-api-types/src/upid.rs
index 50d70b67..ba23a646 100644
--- a/pbs-api-types/src/upid.rs
+++ b/pbs-api-types/src/upid.rs
@@ -109,7 +109,7 @@ impl std::str::FromStr for UPID {
let worker_id = if cap["wid"].is_empty() {
None
} else {
- let wid = pbs_systemd::unescape_unit(&cap["wid"])?;
+ let wid = proxmox_systemd::unescape_unit(&cap["wid"])?;
Some(wid)
};
@@ -135,7 +135,7 @@ impl std::fmt::Display for UPID {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let wid = if let Some(ref id) = self.worker_id {
- pbs_systemd::escape_unit(id, false)
+ proxmox_systemd::escape_unit(id, false)
} else {
String::new()
};
diff --git a/proxmox-backup-client/Cargo.toml b/proxmox-backup-client/Cargo.toml
index 6c1bb936..d3c35534 100644
--- a/proxmox-backup-client/Cargo.toml
+++ b/proxmox-backup-client/Cargo.toml
@@ -31,5 +31,5 @@ pbs-client = { path = "../pbs-client" }
pbs-datastore = { path = "../pbs-datastore" }
pbs-fuse-loop = { path = "../pbs-fuse-loop" }
pbs-runtime = { path = "../pbs-runtime" }
-pbs-systemd = { path = "../pbs-systemd" }
+proxmox-systemd = { path = "../proxmox-systemd" }
pbs-tools = { path = "../pbs-tools" }
diff --git a/proxmox-backup-client/src/mount.rs b/proxmox-backup-client/src/mount.rs
index e4544c07..9ac1d9c2 100644
--- a/proxmox-backup-client/src/mount.rs
+++ b/proxmox-backup-client/src/mount.rs
@@ -118,7 +118,7 @@ fn complete_mapping_names<S: BuildHasher>(_arg: &str, _param: &HashMap<String, S
match pbs_fuse_loop::find_all_mappings() {
Ok(mappings) => mappings
.filter_map(|(name, _)| {
- pbs_systemd::unescape_unit(&name).ok()
+ proxmox_systemd::unescape_unit(&name).ok()
}).collect(),
Err(_) => Vec::new()
}
@@ -279,7 +279,7 @@ async fn mount_do(param: Value, pipe: Option<Fd>) -> Result<Value, Error> {
let reader = CachedChunkReader::new(chunk_reader, index, 8).seekable();
let name = &format!("{}:{}/{}", repo.to_string(), path, archive_name);
- let name_escaped = pbs_systemd::escape_unit(name, false);
+ let name_escaped = proxmox_systemd::escape_unit(name, false);
let mut session = pbs_fuse_loop::FuseLoopSession::map_loop(size, reader, &name_escaped, options).await?;
let loopdev = session.loopdev_path.clone();
@@ -341,7 +341,7 @@ fn unmap(
pbs_fuse_loop::cleanup_unused_run_files(None);
let mut any = false;
for (backing, loopdev) in pbs_fuse_loop::find_all_mappings()? {
- let name = pbs_systemd::unescape_unit(&backing)?;
+ let name = proxmox_systemd::unescape_unit(&backing)?;
println!("{}:\t{}", loopdev.unwrap_or_else(|| "(unmapped)".to_string()), name);
any = true;
}
@@ -360,7 +360,7 @@ fn unmap(
if name.starts_with("/dev/loop") {
pbs_fuse_loop::unmap_loopdev(name)?;
} else {
- let name = pbs_systemd::escape_unit(&name, false);
+ let name = proxmox_systemd::escape_unit(&name, false);
pbs_fuse_loop::unmap_name(name)?;
}
diff --git a/proxmox-file-restore/Cargo.toml b/proxmox-file-restore/Cargo.toml
index 97f9c414..1e13fb46 100644
--- a/proxmox-file-restore/Cargo.toml
+++ b/proxmox-file-restore/Cargo.toml
@@ -24,5 +24,5 @@ pbs-config = { path = "../pbs-config" }
pbs-client = { path = "../pbs-client" }
pbs-datastore = { path = "../pbs-datastore" }
pbs-runtime = { path = "../pbs-runtime" }
-pbs-systemd = { path = "../pbs-systemd" }
+proxmox-systemd = { path = "../proxmox-systemd" }
pbs-tools = { path = "../pbs-tools" }
diff --git a/proxmox-file-restore/src/block_driver_qemu.rs b/proxmox-file-restore/src/block_driver_qemu.rs
index 8954223c..2f73e669 100644
--- a/proxmox-file-restore/src/block_driver_qemu.rs
+++ b/proxmox-file-restore/src/block_driver_qemu.rs
@@ -80,7 +80,7 @@ impl VMStateMap {
fn make_name(repo: &BackupRepository, snap: &BackupDir) -> String {
let full = format!("qemu_{}/{}", repo, snap);
- pbs_systemd::escape_unit(&full, false)
+ proxmox_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 = pbs_systemd::unescape_unit(n)
+ let name = proxmox_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 = pbs_systemd::escape_unit(&id, false);
+ let name = proxmox_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, _)| pbs_systemd::unescape_unit(&name).ok())
+ .filter_map(|(name, _)| proxmox_systemd::unescape_unit(&name).ok())
.collect(),
Err(_) => Vec::new(),
}
diff --git a/pbs-systemd/Cargo.toml b/proxmox-systemd/Cargo.toml
similarity index 93%
rename from pbs-systemd/Cargo.toml
rename to proxmox-systemd/Cargo.toml
index 830ab816..c6caa7ec 100644
--- a/pbs-systemd/Cargo.toml
+++ b/proxmox-systemd/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "pbs-systemd"
+name = "proxmox-systemd"
version = "0.1.0"
authors = ["Proxmox Support Team <support at proxmox.com>"]
edition = "2018"
diff --git a/pbs-systemd/src/lib.rs b/proxmox-systemd/src/lib.rs
similarity index 100%
rename from pbs-systemd/src/lib.rs
rename to proxmox-systemd/src/lib.rs
diff --git a/pbs-systemd/src/parse_time.rs b/proxmox-systemd/src/parse_time.rs
similarity index 100%
rename from pbs-systemd/src/parse_time.rs
rename to proxmox-systemd/src/parse_time.rs
diff --git a/pbs-systemd/src/time.rs b/proxmox-systemd/src/time.rs
similarity index 100%
rename from pbs-systemd/src/time.rs
rename to proxmox-systemd/src/time.rs
diff --git a/pbs-systemd/src/unit.rs b/proxmox-systemd/src/unit.rs
similarity index 100%
rename from pbs-systemd/src/unit.rs
rename to proxmox-systemd/src/unit.rs
diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index ea01352e..38809dcf 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -186,9 +186,9 @@ pub fn create_datastore_disk(
let mount_unit_name = create_datastore_mount_unit(&name, &mount_point, filesystem, &uuid_path)?;
- pbs_systemd::reload_daemon()?;
- pbs_systemd::enable_unit(&mount_unit_name)?;
- pbs_systemd::start_unit(&mount_unit_name)?;
+ proxmox_systemd::reload_daemon()?;
+ proxmox_systemd::enable_unit(&mount_unit_name)?;
+ proxmox_systemd::start_unit(&mount_unit_name)?;
if add_datastore {
let lock = pbs_config::datastore::lock_config()?;
@@ -242,9 +242,9 @@ pub fn delete_datastore_disk(name: String) -> Result<(), Error> {
}
// disable systemd mount-unit
- let mut mount_unit_name = pbs_systemd::escape_unit(&path, true);
+ let mut mount_unit_name = proxmox_systemd::escape_unit(&path, true);
mount_unit_name.push_str(".mount");
- pbs_systemd::disable_unit(&mount_unit_name)?;
+ proxmox_systemd::disable_unit(&mount_unit_name)?;
// delete .mount-file
let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
@@ -281,7 +281,7 @@ fn create_datastore_mount_unit(
what: &str,
) -> Result<String, Error> {
- let mut mount_unit_name = pbs_systemd::escape_unit(&mount_point, true);
+ let mut mount_unit_name = proxmox_systemd::escape_unit(&mount_point, true);
mount_unit_name.push_str(".mount");
let mount_unit_path = format!("/etc/systemd/system/{}", mount_unit_name);
diff --git a/src/api2/node/disks/zfs.rs b/src/api2/node/disks/zfs.rs
index 28f24dc4..14c2cfec 100644
--- a/src/api2/node/disks/zfs.rs
+++ b/src/api2/node/disks/zfs.rs
@@ -271,8 +271,8 @@ pub fn create_zpool(
worker.log(output);
if std::path::Path::new("/lib/systemd/system/zfs-import at .service").exists() {
- let import_unit = format!("zfs-import@{}.service", pbs_systemd::escape_unit(&name, false));
- pbs_systemd::enable_unit(&import_unit)?;
+ let import_unit = format!("zfs-import@{}.service", proxmox_systemd::escape_unit(&name, false));
+ proxmox_systemd::enable_unit(&import_unit)?;
}
if let Some(compression) = compression {
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 6a8736e2..dadce847 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -35,7 +35,7 @@ use proxmox_backup::{
};
use pbs_buildcfg::configdir;
-use pbs_systemd::time::{compute_next_event, parse_calendar_event};
+use proxmox_systemd::time::{compute_next_event, parse_calendar_event};
use pbs_tools::logrotate::LogRotate;
use pbs_api_types::{
diff --git a/src/server/email_notifications.rs b/src/server/email_notifications.rs
index 1371990a..a70f2d1b 100644
--- a/src/server/email_notifications.rs
+++ b/src/server/email_notifications.rs
@@ -431,7 +431,7 @@ pub fn send_tape_backup_status(
) -> Result<(), Error> {
let (fqdn, port) = get_server_url();
- let duration: pbs_systemd::time::TimeSpan = summary.duration.into();
+ let duration: proxmox_systemd::time::TimeSpan = summary.duration.into();
let mut data = json!({
"job": job,
"fqdn": fqdn,
diff --git a/src/server/jobstate.rs b/src/server/jobstate.rs
index 27da94ef..74224f33 100644
--- a/src/server/jobstate.rs
+++ b/src/server/jobstate.rs
@@ -46,7 +46,7 @@ use proxmox::tools::fs::{
create_path, file_read_optional_string, replace_file, CreateOptions,
};
-use pbs_systemd::time::{compute_next_event, parse_calendar_event};
+use proxmox_systemd::time::{compute_next_event, parse_calendar_event};
use pbs_config::{open_backup_lockfile, BackupLockGuard};
use pbs_api_types::{UPID, JobScheduleStatus};
diff --git a/src/tape/drive/mod.rs b/src/tape/drive/mod.rs
index afb91b64..f477acc7 100644
--- a/src/tape/drive/mod.rs
+++ b/src/tape/drive/mod.rs
@@ -606,7 +606,7 @@ pub struct DeviceLockGuard(std::fs::File);
// Uses systemd escape_unit to compute a file name from `device_path`, the try
// to lock `/var/lock/<name>`.
fn open_device_lock(device_path: &str) -> Result<std::fs::File, Error> {
- let lock_name = pbs_systemd::escape_unit(device_path, true);
+ let lock_name = proxmox_systemd::escape_unit(device_path, true);
let mut path = std::path::PathBuf::from(crate::tape::DRIVE_LOCK_DIR);
path.push(lock_name);
diff --git a/src/tape/inventory.rs b/src/tape/inventory.rs
index 90e72153..2b96da74 100644
--- a/src/tape/inventory.rs
+++ b/src/tape/inventory.rs
@@ -39,7 +39,7 @@ use proxmox::tools::{
},
};
-use pbs_systemd::time::compute_next_event;
+use proxmox_systemd::time::compute_next_event;
use pbs_config::BackupLockGuard;
use pbs_api_types::{MediaSetPolicy, RetentionPolicy, MediaStatus, MediaLocation};
diff --git a/src/tape/media_pool.rs b/src/tape/media_pool.rs
index f539eeee..5ae2f9dc 100644
--- a/src/tape/media_pool.rs
+++ b/src/tape/media_pool.rs
@@ -18,7 +18,7 @@ use pbs_api_types::{
Fingerprint, MediaStatus, MediaLocation, MediaSetPolicy, RetentionPolicy,
MediaPoolConfig,
};
-use pbs_systemd::time::compute_next_event;
+use proxmox_systemd::time::compute_next_event;
use pbs_config::BackupLockGuard;
use crate::tape::{
diff --git a/src/tape/test/alloc_writable_media.rs b/src/tape/test/alloc_writable_media.rs
index 5bf41ddf..ee158eab 100644
--- a/src/tape/test/alloc_writable_media.rs
+++ b/src/tape/test/alloc_writable_media.rs
@@ -5,7 +5,7 @@
use std::path::PathBuf;
use anyhow::Error;
-use pbs_systemd::time::parse_time_span;
+use proxmox_systemd::time::parse_time_span;
use pbs_api_types::{RetentionPolicy, MediaSetPolicy};
use crate::tape::{Inventory, MediaPool};
diff --git a/src/tape/test/compute_media_state.rs b/src/tape/test/compute_media_state.rs
index 9cf76279..6dbfaf4f 100644
--- a/src/tape/test/compute_media_state.rs
+++ b/src/tape/test/compute_media_state.rs
@@ -102,8 +102,8 @@ fn test_media_expire_time() -> Result<(), Error> {
let sl2= MediaSetLabel::with_data("p1", Uuid::generate(), 0, ctime + 120, None);
let tape2_uuid = inventory.generate_used_tape("tape2", sl2, 0);
- let event = pbs_systemd::time::parse_calendar_event("*:0/2")?;
- let span = pbs_systemd::time::parse_time_span("120 seconds")?;
+ let event = proxmox_systemd::time::parse_calendar_event("*:0/2")?;
+ let span = proxmox_systemd::time::parse_time_span("120 seconds")?;
let pool = MediaPool::new(
"p1",
diff --git a/src/tools/systemd/types.rs b/src/tools/systemd/types.rs
index 368b25dd..d44af70e 100644
--- a/src/tools/systemd/types.rs
+++ b/src/tools/systemd/types.rs
@@ -248,10 +248,10 @@ pub enum ServiceStartup {
pub const SYSTEMD_TIMESPAN_SCHEMA: Schema = StringSchema::new(
"systemd time span")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_time_span))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_time_span))
.schema();
pub const SYSTEMD_CALENDAR_EVENT_SCHEMA: Schema = StringSchema::new(
"systemd calendar event")
- .format(&ApiStringFormat::VerifyFn(pbs_systemd::time::verify_calendar_event))
+ .format(&ApiStringFormat::VerifyFn(proxmox_systemd::time::verify_calendar_event))
.schema();
--
2.30.2
More information about the pbs-devel
mailing list