update to proxmox-sys 0.2 crate
- imported pbs-api-types/src/common_regex.rs from old proxmox crate - use hex crate to generate/parse hex digest - remove all reference to proxmox crate (use proxmox-sys and proxmox-serde instead) Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
@ -27,7 +27,7 @@ pub fn get_lvm_devices(
|
||||
let mut command = std::process::Command::new(PVS_BIN_PATH);
|
||||
command.args(&["--reportformat", "json", "--noheadings", "--readonly", "-o", "pv_name"]);
|
||||
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
let mut device_set: HashSet<u64> = HashSet::new();
|
||||
|
||||
|
@ -14,9 +14,9 @@ use once_cell::sync::OnceCell;
|
||||
|
||||
use ::serde::{Deserialize, Serialize};
|
||||
|
||||
use proxmox::sys::error::io_err_other;
|
||||
use proxmox::sys::linux::procfs::{MountInfo, mountinfo::Device};
|
||||
use proxmox::{io_bail, io_format_err};
|
||||
use proxmox_sys::error::io_err_other;
|
||||
use proxmox_sys::linux::procfs::{MountInfo, mountinfo::Device};
|
||||
use proxmox_sys::{io_bail, io_format_err};
|
||||
use proxmox_schema::api;
|
||||
|
||||
use pbs_api_types::{BLOCKDEVICE_NAME_REGEX, StorageStatus};
|
||||
@ -498,7 +498,7 @@ impl Disk {
|
||||
|
||||
let mut map = HashMap::new();
|
||||
|
||||
for item in pbs_tools::fs::read_subdir(libc::AT_FDCWD, sys_path)? {
|
||||
for item in proxmox_sys::fs::read_subdir(libc::AT_FDCWD, sys_path)? {
|
||||
let item = item?;
|
||||
let name = match item.file_name().to_str() {
|
||||
Ok(name) => name,
|
||||
@ -574,7 +574,7 @@ pub fn get_lsblk_info() -> Result<Vec<LsblkInfo>, Error> {
|
||||
let mut command = std::process::Command::new("lsblk");
|
||||
command.args(&["--json", "-o", "path,parttype,fstype"]);
|
||||
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
let mut output: serde_json::Value = output.parse()?;
|
||||
|
||||
@ -680,7 +680,7 @@ fn scan_partitions(
|
||||
let mut found_dm = false;
|
||||
let mut found_partitions = false;
|
||||
|
||||
for item in pbs_tools::fs::read_subdir(libc::AT_FDCWD, &sys_path)? {
|
||||
for item in proxmox_sys::fs::read_subdir(libc::AT_FDCWD, &sys_path)? {
|
||||
let item = item?;
|
||||
let name = match item.file_name().to_str() {
|
||||
Ok(name) => name,
|
||||
@ -770,7 +770,7 @@ pub fn get_disks(
|
||||
|
||||
let mut result = HashMap::new();
|
||||
|
||||
for item in pbs_tools::fs::scan_subdir(libc::AT_FDCWD, "/sys/block", &BLOCKDEVICE_NAME_REGEX)? {
|
||||
for item in proxmox_sys::fs::scan_subdir(libc::AT_FDCWD, "/sys/block", &BLOCKDEVICE_NAME_REGEX)? {
|
||||
let item = item?;
|
||||
|
||||
let name = item.file_name().to_str().unwrap().to_string();
|
||||
@ -886,7 +886,7 @@ pub fn reread_partition_table(disk: &Disk) -> Result<(), Error> {
|
||||
command.arg("--rereadpt");
|
||||
command.arg(disk_path);
|
||||
|
||||
pbs_tools::run_command(command, None)?;
|
||||
proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -905,7 +905,7 @@ pub fn inititialize_gpt_disk(disk: &Disk, uuid: Option<&str>) -> Result<(), Erro
|
||||
command.arg(disk_path);
|
||||
command.args(&["-U", uuid]);
|
||||
|
||||
pbs_tools::run_command(command, None)?;
|
||||
proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -922,7 +922,7 @@ pub fn create_single_linux_partition(disk: &Disk) -> Result<Disk, Error> {
|
||||
command.args(&["-n1", "-t1:8300"]);
|
||||
command.arg(disk_path);
|
||||
|
||||
pbs_tools::run_command(command, None)?;
|
||||
proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
let mut partitions = disk.partitions()?;
|
||||
|
||||
@ -975,7 +975,7 @@ pub fn create_file_system(disk: &Disk, fs_type: FileSystemType) -> Result<(), Er
|
||||
command.args(&["-t", &fs_type]);
|
||||
command.arg(disk_path);
|
||||
|
||||
pbs_tools::run_command(command, None)?;
|
||||
proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@ -984,7 +984,7 @@ pub fn create_file_system(disk: &Disk, fs_type: FileSystemType) -> Result<(), Er
|
||||
pub fn complete_disk_name(_arg: &str, _param: &HashMap<String, String>) -> Vec<String> {
|
||||
let mut list = Vec::new();
|
||||
|
||||
let dir = match pbs_tools::fs::scan_subdir(libc::AT_FDCWD, "/sys/block", &BLOCKDEVICE_NAME_REGEX) {
|
||||
let dir = match proxmox_sys::fs::scan_subdir(libc::AT_FDCWD, "/sys/block", &BLOCKDEVICE_NAME_REGEX) {
|
||||
Ok(dir) => dir,
|
||||
Err(_) => return list,
|
||||
};
|
||||
@ -1013,7 +1013,7 @@ pub fn get_fs_uuid(disk: &Disk) -> Result<String, Error> {
|
||||
command.args(&["-o", "export"]);
|
||||
command.arg(disk_path);
|
||||
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
for line in output.lines() {
|
||||
if let Some(uuid) = line.strip_prefix("UUID=") {
|
||||
|
@ -91,7 +91,7 @@ pub fn get_smart_data(
|
||||
};
|
||||
command.arg(disk_path);
|
||||
|
||||
let output = pbs_tools::run_command(command, Some(|exitcode|
|
||||
let output = proxmox_sys::command::run_command(command, Some(|exitcode|
|
||||
(exitcode & 0b0111) == 0 // only bits 0-2 are fatal errors
|
||||
))?;
|
||||
|
||||
|
@ -34,7 +34,7 @@ pub fn zfs_pool_stats(pool: &OsStr) -> Result<Option<BlockDevStat>, Error> {
|
||||
path.push(pool);
|
||||
path.push("io");
|
||||
|
||||
let text = match proxmox::tools::fs::file_read_optional_string(&path)? {
|
||||
let text = match proxmox_sys::fs::file_read_optional_string(&path)? {
|
||||
Some(text) => text,
|
||||
None => { return Ok(None); }
|
||||
};
|
||||
|
@ -147,7 +147,7 @@ pub fn zpool_list(pool: Option<String>, verbose: bool) -> Result<Vec<ZFSPoolInfo
|
||||
|
||||
if let Some(pool) = pool { command.arg(pool); }
|
||||
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
parse_zpool_list(&output)
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ pub fn zpool_status(pool: &str) -> Result<Vec<(String, String)>, Error> {
|
||||
let mut command = std::process::Command::new("zpool");
|
||||
command.args(&["status", "-p", "-P", pool]);
|
||||
|
||||
let output = pbs_tools::run_command(command, None)?;
|
||||
let output = proxmox_sys::command::run_command(command, None)?;
|
||||
|
||||
parse_zpool_status(&output)
|
||||
}
|
||||
|
Reference in New Issue
Block a user