diff --git a/Cargo.toml b/Cargo.toml index 05f0811c..e3cb972b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ zstd = { version = "0.6", features = [ "bindgen" ] } pathpatterns = "0.1.2" pxar = { version = "0.10.1", features = [ "tokio-io" ] } -proxmox = { version = "0.15.0", features = [ "sortable-macro" ] } +proxmox = { version = "0.15.3", features = [ "sortable-macro" ] } proxmox-http = { version = "0.5.4", features = [ "client", "http-helpers", "websocket" ] } proxmox-io = "1" proxmox-lang = "1" diff --git a/pbs-api-types/Cargo.toml b/pbs-api-types/Cargo.toml index 4b188c07..925207e8 100644 --- a/pbs-api-types/Cargo.toml +++ b/pbs-api-types/Cargo.toml @@ -15,7 +15,7 @@ openssl = "0.10" regex = "1.2" serde = { version = "1.0", features = ["derive"] } -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-lang = "1.0.0" proxmox-schema = { version = "1.0.1", features = [ "api-macro" ] } proxmox-time = "1.1" diff --git a/pbs-client/Cargo.toml b/pbs-client/Cargo.toml index 2fb05ca4..135e4045 100644 --- a/pbs-client/Cargo.toml +++ b/pbs-client/Cargo.toml @@ -28,7 +28,7 @@ tower-service = "0.3.0" xdg = "2.2" pathpatterns = "0.1.2" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-fuse = "0.1.1" proxmox-http = { version = "0.5.4", features = [ "client", "http-helpers", "websocket" ] } proxmox-io = { version = "1", features = [ "tokio" ] } diff --git a/pbs-config/Cargo.toml b/pbs-config/Cargo.toml index 0ea62d9e..9424e95b 100644 --- a/pbs-config/Cargo.toml +++ b/pbs-config/Cargo.toml @@ -17,7 +17,7 @@ regex = "1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-lang = "1" proxmox-router = { version = "1.1", default-features = false } proxmox-schema = "1" diff --git a/pbs-datastore/Cargo.toml b/pbs-datastore/Cargo.toml index 01c5ee00..072fa1d4 100644 --- a/pbs-datastore/Cargo.toml +++ b/pbs-datastore/Cargo.toml @@ -25,7 +25,7 @@ zstd = { version = "0.6", features = [ "bindgen" ] } pathpatterns = "0.1.2" pxar = "0.10.1" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-borrow = "1" proxmox-io = "1" proxmox-lang = "1" diff --git a/pbs-tape/Cargo.toml b/pbs-tape/Cargo.toml index c3e8b0af..e11a835a 100644 --- a/pbs-tape/Cargo.toml +++ b/pbs-tape/Cargo.toml @@ -18,7 +18,7 @@ bitflags = "1.2.1" regex = "1.2" udev = "0.4" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-io = "1" proxmox-lang = "1" # api-macro is only used by the binaries, so maybe we should split them out diff --git a/pbs-tools/Cargo.toml b/pbs-tools/Cargo.toml index 635933e1..e72591e5 100644 --- a/pbs-tools/Cargo.toml +++ b/pbs-tools/Cargo.toml @@ -32,7 +32,7 @@ url = "2.1" walkdir = "2" zstd = { version = "0.6", features = [ "bindgen" ] } -proxmox = { version = "0.15.0", default-features = false, features = [ "tokio" ] } +proxmox = { version = "0.15.3", default-features = false, features = [ "tokio" ] } proxmox-borrow = "1" proxmox-io = { version = "1", features = [ "tokio" ] } proxmox-lang = { version = "1" } diff --git a/pbs-tools/src/fd.rs b/pbs-tools/src/fd.rs deleted file mode 100644 index 6f866bfb..00000000 --- a/pbs-tools/src/fd.rs +++ /dev/null @@ -1,14 +0,0 @@ -//! Raw file descriptor related utilities. - -use std::os::unix::io::RawFd; - -use anyhow::Error; -use nix::fcntl::{fcntl, FdFlag, F_GETFD, F_SETFD}; - -/// Change the `O_CLOEXEC` flag of an existing file descriptor. -pub fn fd_change_cloexec(fd: RawFd, on: bool) -> Result<(), Error> { - let mut flags = unsafe { FdFlag::from_bits_unchecked(fcntl(fd, F_GETFD)?) }; - flags.set(FdFlag::FD_CLOEXEC, on); - fcntl(fd, F_SETFD(flags))?; - Ok(()) -} diff --git a/pbs-tools/src/lib.rs b/pbs-tools/src/lib.rs index f36cc175..e257fe32 100644 --- a/pbs-tools/src/lib.rs +++ b/pbs-tools/src/lib.rs @@ -7,7 +7,6 @@ pub mod compression; pub mod crypt; pub mod crypt_config; pub mod format; -pub mod fd; pub mod fs; pub mod io; pub mod json; diff --git a/proxmox-backup-client/Cargo.toml b/proxmox-backup-client/Cargo.toml index 235baca9..d83c07a9 100644 --- a/proxmox-backup-client/Cargo.toml +++ b/proxmox-backup-client/Cargo.toml @@ -22,7 +22,7 @@ zstd = { version = "0.6", features = [ "bindgen" ] } pathpatterns = "0.1.2" pxar = { version = "0.10.1", features = [ "tokio-io" ] } -proxmox = { version = "0.15.0", features = [ "sortable-macro" ] } +proxmox = { version = "0.15.3", features = [ "sortable-macro" ] } proxmox-router = { version = "1.1", features = [ "cli" ] } proxmox-schema = { version = "1", features = [ "api-macro" ] } proxmox-time = "1" diff --git a/proxmox-file-restore/Cargo.toml b/proxmox-file-restore/Cargo.toml index 1ca91f9f..a64665b3 100644 --- a/proxmox-file-restore/Cargo.toml +++ b/proxmox-file-restore/Cargo.toml @@ -16,7 +16,7 @@ tokio = { version = "1.6", features = [ "io-std", "rt", "rt-multi-thread", "time pxar = { version = "0.10.1", features = [ "tokio-io" ] } -proxmox = { version = "0.15.0" } +proxmox = { version = "0.15.3" } proxmox-lang = "1" proxmox-router = { version = "1.1", features = [ "cli" ] } proxmox-schema = { version = "1", features = [ "api-macro" ] } diff --git a/proxmox-file-restore/src/qemu_helper.rs b/proxmox-file-restore/src/qemu_helper.rs index 377788d9..a49fc6bf 100644 --- a/proxmox-file-restore/src/qemu_helper.rs +++ b/proxmox-file-restore/src/qemu_helper.rs @@ -12,6 +12,7 @@ use nix::sys::signal::{kill, Signal}; use nix::unistd::Pid; use proxmox::tools::fs::{create_path, file_read_string, make_tmp_file, CreateOptions}; +use proxmox::tools::fd::fd_change_cloexec; use pbs_client::{VsockClient, DEFAULT_VSOCK_PORT}; @@ -86,7 +87,7 @@ async fn create_temp_initramfs(ticket: &str, debug: bool) -> Result<(File, Strin let (tmp_file, tmp_path) = make_tmp_file("/tmp/file-restore-qemu.initramfs.tmp", CreateOptions::new())?; nix::unistd::unlink(&tmp_path)?; - pbs_tools::fd::fd_change_cloexec(tmp_file.as_raw_fd(), false)?; + fd_change_cloexec(tmp_file.as_raw_fd(), false)?; let initramfs = if debug { pbs_buildcfg::PROXMOX_BACKUP_INITRAMFS_DBG_FN @@ -142,7 +143,7 @@ pub async fn start_vm( let pid; let (mut pid_file, pid_path) = make_tmp_file("/tmp/file-restore-qemu.pid.tmp", CreateOptions::new())?; nix::unistd::unlink(&pid_path)?; - pbs_tools::fd::fd_change_cloexec(pid_file.as_raw_fd(), false)?; + fd_change_cloexec(pid_file.as_raw_fd(), false)?; let (_ramfs_pid, ramfs_path) = create_temp_initramfs(ticket, debug).await?; @@ -159,7 +160,7 @@ pub async fn start_vm( .append(true) .create_new(true) .open(logfile)?; - pbs_tools::fd::fd_change_cloexec(logfd.as_raw_fd(), false)?; + fd_change_cloexec(logfd.as_raw_fd(), false)?; // preface log file with start timestamp so one can see how long QEMU took to start writeln!(logfd, "[{}] PBS file restore VM log", { diff --git a/proxmox-rest-server/Cargo.toml b/proxmox-rest-server/Cargo.toml index b88e5d12..f0c0c65e 100644 --- a/proxmox-rest-server/Cargo.toml +++ b/proxmox-rest-server/Cargo.toml @@ -30,7 +30,7 @@ tokio-openssl = "0.6.1" tower-service = "0.3.0" url = "2.1" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-io = "1" proxmox-lang = "1" proxmox-http = { version = "0.5.0", features = [ "client" ] } diff --git a/proxmox-rest-server/src/daemon.rs b/proxmox-rest-server/src/daemon.rs index cbaaaa7b..c533b0f4 100644 --- a/proxmox-rest-server/src/daemon.rs +++ b/proxmox-rest-server/src/daemon.rs @@ -13,11 +13,9 @@ use anyhow::{bail, format_err, Error}; use futures::future::{self, Either}; use nix::unistd::{fork, ForkResult}; -use proxmox::tools::fd::Fd; +use proxmox::tools::fd::{fd_change_cloexec, Fd}; use proxmox_io::{ReadExt, WriteExt}; -use pbs_tools::fd::fd_change_cloexec; - // Unfortunately FnBox is nightly-only and Box is unusable, so just use Box... type BoxedStoreFunc = Box Result + UnwindSafe + Send>; diff --git a/proxmox-restore-daemon/Cargo.toml b/proxmox-restore-daemon/Cargo.toml index 94e5fccd..08107101 100644 --- a/proxmox-restore-daemon/Cargo.toml +++ b/proxmox-restore-daemon/Cargo.toml @@ -26,7 +26,7 @@ tokio-util = { version = "0.6", features = [ "codec", "io" ] } pathpatterns = "0.1.2" pxar = { version = "0.10.1", features = [ "tokio-io" ] } -proxmox = { version = "0.15.0", features = [ "sortable-macro" ] } +proxmox = { version = "0.15.3", features = [ "sortable-macro" ] } proxmox-router = { version = "1.1", features = [ "cli" ] } proxmox-schema = { version = "1", features = [ "api-macro" ] } proxmox-time = "1" diff --git a/proxmox-rrd/Cargo.toml b/proxmox-rrd/Cargo.toml index 7e1b2cb6..8e9d1b77 100644 --- a/proxmox-rrd/Cargo.toml +++ b/proxmox-rrd/Cargo.toml @@ -19,6 +19,6 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_cbor = "0.11.1" -proxmox = { version = "0.15.0" } +proxmox = { version = "0.15.3" } proxmox-time = "1" proxmox-schema = { version = "1", features = [ "api-macro" ] } diff --git a/pxar-bin/Cargo.toml b/pxar-bin/Cargo.toml index 195ef1a2..d44a3ffd 100644 --- a/pxar-bin/Cargo.toml +++ b/pxar-bin/Cargo.toml @@ -16,7 +16,7 @@ serde_json = "1.0" tokio = { version = "1.6", features = [ "rt", "rt-multi-thread" ] } pathpatterns = "0.1.2" -proxmox = "0.15.0" +proxmox = "0.15.3" proxmox-schema = { version = "1", features = [ "api-macro" ] } proxmox-router = "1.1" pxar = { version = "0.10.1", features = [ "tokio-io" ] } diff --git a/src/api2/node/mod.rs b/src/api2/node/mod.rs index 5e7a09e2..ec6ff186 100644 --- a/src/api2/node/mod.rs +++ b/src/api2/node/mod.rs @@ -13,6 +13,8 @@ use serde_json::{json, Value}; use tokio::io::{AsyncBufReadExt, BufReader}; use proxmox::{identity, sortable}; +use proxmox::tools::fd::fd_change_cloexec; + use proxmox_router::{ ApiHandler, ApiMethod, ApiResponseFuture, Permission, RpcEnvironment, Router, SubdirMap, }; @@ -152,7 +154,7 @@ async fn termproxy(cmd: Option, rpcenv: &mut dyn RpcEnvironment) -> Resu move |worker| async move { // move inside the worker so that it survives and does not close the port // remove CLOEXEC from listenere so that we can reuse it in termproxy - pbs_tools::fd::fd_change_cloexec(listener.as_raw_fd(), false)?; + fd_change_cloexec(listener.as_raw_fd(), false)?; let mut arguments: Vec<&str> = Vec::new(); let fd_string = listener.as_raw_fd().to_string();