rename pbs-systemd to proxmox-systemd

This commit is contained in:
Dietmar Maurer 2021-09-21 09:33:51 +02:00 committed by Thomas Lamprecht
parent 48109c5354
commit 84af82e8cf
26 changed files with 41 additions and 41 deletions

View File

@ -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" }

View File

@ -40,7 +40,7 @@ SUBCRATES := \
pbs-fuse-loop \
pbs-runtime \
proxmox-rest-server \
pbs-systemd \
proxmox-systemd \
pbs-tape \
pbs-tools \
proxmox-backup-banner \

View File

@ -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" }

View File

@ -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();

View File

@ -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,

View File

@ -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()
};

View File

@ -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" }

View File

@ -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)?;
}

View File

@ -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" }

View File

@ -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(),
}

View File

@ -1,5 +1,5 @@
[package]
name = "pbs-systemd"
name = "proxmox-systemd"
version = "0.1.0"
authors = ["Proxmox Support Team <support@proxmox.com>"]
edition = "2018"

View File

@ -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);

View File

@ -271,8 +271,8 @@ pub fn create_zpool(
worker.log(output);
if std::path::Path::new("/lib/systemd/system/zfs-import@.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 {

View File

@ -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::{

View File

@ -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,

View File

@ -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};

View File

@ -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);

View File

@ -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};

View File

@ -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::{

View File

@ -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};

View File

@ -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",

View File

@ -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();