update to first proxmox crate split

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2021-10-08 11:19:37 +02:00
parent e3f3359c86
commit 6ef1b649d9
265 changed files with 880 additions and 1036 deletions

View File

@ -3,8 +3,8 @@ use std::collections::{HashMap, HashSet};
use anyhow::{bail, Error};
use proxmox::tools::Uuid;
use proxmox::api::section_config::SectionConfigData;
use proxmox_section_config::SectionConfigData;
use proxmox_uuid::Uuid;
use pbs_api_types::{VirtualTapeDrive, ScsiTapeChanger};
use pbs_tape::{ElementStatus, MtxStatus};

View File

@ -17,7 +17,7 @@ use std::convert::TryInto;
use anyhow::{bail, format_err, Error};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_api_types::{
Fingerprint, MamAttribute, LtoDriveAndMediaStatus, LtoTapeDrive, Lp17VolumeStatistics,
@ -47,7 +47,7 @@ use crate::{
/// - for autoloader only, try to reload ejected tapes
pub fn open_lto_tape_drive(config: &LtoTapeDrive) -> Result<LtoTapeHandle, Error> {
proxmox::try_block!({
proxmox_lang::try_block!({
let file = open_lto_tape_device(&config.path)?;
let mut handle = LtoTapeHandle::new(file)?;

View File

@ -8,15 +8,13 @@ pub use lto::*;
use std::path::PathBuf;
use anyhow::{bail, format_err, Error};
use ::serde::{Deserialize};
use serde::Deserialize;
use serde_json::Value;
use nix::fcntl::OFlag;
use nix::sys::stat::Mode;
use proxmox::{
tools::{
Uuid,
io::ReadExt,
fs::{
lock_file,
atomic_open_or_create_file,
@ -25,8 +23,10 @@ use proxmox::{
CreateOptions,
}
},
api::section_config::SectionConfigData,
};
use proxmox_io::ReadExt;
use proxmox_section_config::SectionConfigData;
use proxmox_uuid::Uuid;
use pbs_api_types::{VirtualTapeDrive, LtoTapeDrive, Fingerprint};
use pbs_config::key_config::KeyConfig;
@ -364,7 +364,7 @@ pub fn request_and_load_media(
MediaId,
), Error> {
let check_label = |handle: &mut dyn TapeDriver, uuid: &proxmox::tools::Uuid| {
let check_label = |handle: &mut dyn TapeDriver, uuid: &proxmox_uuid::Uuid| {
if let Ok((Some(media_id), _)) = handle.read_label() {
task_log!(
worker,

View File

@ -42,7 +42,7 @@ use crate::{
/// This needs to lock the drive
pub fn open_virtual_tape_drive(config: &VirtualTapeDrive) -> Result<VirtualTapeHandle, Error> {
proxmox::try_block!({
proxmox_lang::try_block!({
let mut lock_path = std::path::PathBuf::from(&config.path);
lock_path.push(".drive.lck");

View File

@ -1,10 +1,8 @@
use std::fs::File;
use std::io::Read;
use proxmox::{
sys::error::SysError,
tools::Uuid,
};
use proxmox::sys::error::SysError;
use proxmox_uuid::Uuid;
use pbs_tape::{
PROXMOX_TAPE_BLOCK_SIZE,
@ -53,9 +51,9 @@ pub fn tape_write_catalog<'a>(
return Ok(None);
}
let mut file_copy_buffer = proxmox::tools::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
let mut file_copy_buffer = proxmox_io::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
let result: Result<(), std::io::Error> = proxmox::try_block!({
let result: Result<(), std::io::Error> = proxmox_lang::try_block!({
let file_size = file.metadata()?.len();
let mut remaining = file_size;

View File

@ -3,10 +3,8 @@ use std::io::Read;
use anyhow::{bail, Error};
use endian_trait::Endian;
use proxmox::tools::{
Uuid,
io::ReadExt,
};
use proxmox_io::ReadExt;
use proxmox_uuid::Uuid;
use pbs_datastore::DataBlob;
use pbs_tape::{

View File

@ -6,7 +6,7 @@ use std::collections::HashMap;
use endian_trait::Endian;
use serde::{Deserialize, Serialize};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_api_types::Fingerprint;

View File

@ -2,7 +2,7 @@ use std::io::{Read};
use anyhow::{bail, Error};
use proxmox::tools::io::ReadExt;
use proxmox_io::ReadExt;
use pbs_tape::{TapeRead, MediaContentHeader};
@ -50,7 +50,7 @@ impl <'a> Read for MultiVolumeReader<'a> {
let mut reader = (self.next_reader_fn)()
.map_err(|err| proxmox::io_format_err!("multi-volume next failed: {}", err))?;
proxmox::try_block!({
proxmox_lang::try_block!({
let part_header: MediaContentHeader = unsafe { reader.read_le_value()? };
self.reader = Some(reader);

View File

@ -1,6 +1,6 @@
use anyhow::Error;
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_tape::{TapeWrite, MediaContentHeader};

View File

@ -2,10 +2,8 @@ use std::io::{Read, Write};
use std::pin::Pin;
use std::task::{Context, Poll};
use proxmox::{
sys::error::SysError,
tools::Uuid,
};
use proxmox::sys::error::SysError;
use proxmox_uuid::Uuid;
use pbs_tape::{
PROXMOX_TAPE_BLOCK_SIZE,
@ -46,9 +44,9 @@ pub fn tape_write_snapshot_archive<'a>(
let root_metadata = pxar::Metadata::dir_builder(0o0664).build();
let mut file_copy_buffer = proxmox::tools::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
let mut file_copy_buffer = proxmox_io::vec::undefined(PROXMOX_TAPE_BLOCK_SIZE);
let result: Result<(), std::io::Error> = proxmox::try_block!({
let result: Result<(), std::io::Error> = proxmox_lang::try_block!({
let leom = writer.write_header(&header, &header_data)?;
if leom {

View File

@ -30,14 +30,8 @@ use anyhow::{bail, Error};
use serde::{Serialize, Deserialize};
use serde_json::json;
use proxmox::tools::{
Uuid,
fs::{
replace_file,
file_get_json,
CreateOptions,
},
};
use proxmox::tools::fs::{replace_file, file_get_json, CreateOptions};
use proxmox_uuid::Uuid;
use proxmox_systemd::time::compute_next_event;
use pbs_config::BackupLockGuard;
@ -571,7 +565,7 @@ impl Inventory {
if let Some(ctime) = self.media_set_start_time(media_set_uuid) {
let mut template = template.unwrap_or_else(|| String::from("%c"));
template = template.replace("%id%", &media_set_uuid.to_string());
proxmox::tools::time::strftime_local(&template, ctime)
Ok(proxmox_time::strftime_local(&template, ctime)?)
} else {
// We don't know the set start time, so we cannot use the template
Ok(media_set_uuid.to_string())

View File

@ -11,18 +11,13 @@ use endian_trait::Endian;
use pbs_tools::fs::read_subdir;
use pbs_datastore::backup_info::BackupDir;
use proxmox::tools::{
Uuid,
fs::{
fchown,
create_path,
CreateOptions,
},
io::{
WriteExt,
ReadExt,
},
use proxmox::tools::fs::{
fchown,
create_path,
CreateOptions,
};
use proxmox_io::{WriteExt, ReadExt};
use proxmox_uuid::Uuid;
use crate::{
tape::{
@ -207,7 +202,7 @@ impl MediaCatalog {
let path = Self::catalog_path(base_path, uuid);
let me = proxmox::try_block!({
let me = proxmox_lang::try_block!({
Self::create_basedir(base_path)?;
@ -295,7 +290,7 @@ impl MediaCatalog {
let tmp_path = Self::tmp_catalog_path(base_path, uuid);
let me = proxmox::try_block!({
let me = proxmox_lang::try_block!({
let file = Self::create_temporary_database_file(base_path, uuid)?;
@ -380,7 +375,7 @@ impl MediaCatalog {
let pending = &self.pending;
// Note: lock file, to get a consistent view with load_catalog
nix::fcntl::flock(file.as_raw_fd(), nix::fcntl::FlockArg::LockExclusive)?;
let result: Result<(), Error> = proxmox::try_block!({
let result: Result<(), Error> = proxmox_lang::try_block!({
file.write_all(pending)?;
file.flush()?;
file.sync_data()?;

View File

@ -12,7 +12,7 @@ use std::path::{PathBuf, Path};
use anyhow::{bail, Error};
use serde::{Deserialize, Serialize};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_api_types::{
Fingerprint, MediaStatus, MediaLocation, MediaSetPolicy, RetentionPolicy,

View File

@ -1,7 +1,7 @@
use anyhow::{bail, Error};
use serde::{Serialize, Deserialize};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
/// MediaSet - Ordered group of media
#[derive(Debug, Serialize, Deserialize)]

View File

@ -1,6 +1,6 @@
use anyhow::{bail, Error};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use crate::{
tape::{

View File

@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
use anyhow::{bail, Error};
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_tools::{task_log, task_warn};
use pbs_config::tape_encryption_keys::load_key_configs;
@ -74,7 +74,7 @@ impl PoolWriter {
force_media_set: bool,
) -> Result<Self, Error> {
let current_time = proxmox::tools::time::epoch_i64();
let current_time = proxmox_time::epoch_i64();
let new_media_set_reason = pool.start_write_session(current_time, force_media_set)?;
if let Some(reason) = new_media_set_reason {
@ -202,7 +202,7 @@ impl PoolWriter {
None => None,
};
let current_time = proxmox::tools::time::epoch_i64();
let current_time = proxmox_time::epoch_i64();
let media_uuid = self.pool.alloc_writable_media(current_time)?;
let media = self.pool.lookup_media(&media_uuid).unwrap();

View File

@ -36,7 +36,7 @@ impl NewChunksIterator {
let datastore_name = snapshot_reader.datastore_name();
let result: Result<(), Error> = proxmox::try_block!({
let result: Result<(), Error> = proxmox_lang::try_block!({
let mut chunk_iter = snapshot_reader.chunk_iterator()?;

View File

@ -5,9 +5,7 @@
use std::path::PathBuf;
use anyhow::Error;
use proxmox::tools::{
Uuid,
};
use proxmox_uuid::Uuid;
use pbs_api_types::{MediaStatus, MediaSetPolicy, RetentionPolicy};

View File

@ -5,7 +5,7 @@
use std::path::PathBuf;
use anyhow::Error;
use proxmox::tools::Uuid;
use proxmox_uuid::Uuid;
use pbs_api_types::{RetentionPolicy, MediaSetPolicy};

View File

@ -5,9 +5,7 @@
use std::path::PathBuf;
use anyhow::{bail, Error};
use proxmox::tools::{
Uuid,
};
use proxmox_uuid::Uuid;
use pbs_api_types::{MediaLocation, MediaStatus};