use proxmox::tools::fd::fd_change_cloexec from proxmox 0.15.3
Depend on proxmox 0.15.3 Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
26e949d5fe
commit
860eaec58f
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" }
|
||||
|
|
|
@ -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(())
|
||||
}
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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", {
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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<FnOnce> is unusable, so just use Box<Fn>...
|
||||
type BoxedStoreFunc = Box<dyn FnMut() -> Result<String, Error> + UnwindSafe + Send>;
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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" ] }
|
||||
|
|
|
@ -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<String>, 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();
|
||||
|
|
Loading…
Reference in New Issue