5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-02-25 17:57:35 +03:00

file restore: rename dynamic-memory to auto-memory-hotplug

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-11-11 10:20:41 +01:00
parent 0ce86cb533
commit fa1c3eaea1
3 changed files with 25 additions and 25 deletions

View File

@ -43,7 +43,7 @@ pub trait BlockRestoreDriver {
details: SnapRestoreDetails, details: SnapRestoreDetails,
img_file: String, img_file: String,
path: Vec<u8>, path: Vec<u8>,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Async<Result<Vec<ArchiveEntry>, Error>>; ) -> Async<Result<Vec<ArchiveEntry>, Error>>;
/// pxar=true: /// pxar=true:
@ -58,7 +58,7 @@ pub trait BlockRestoreDriver {
path: Vec<u8>, path: Vec<u8>,
format: Option<FileRestoreFormat>, format: Option<FileRestoreFormat>,
zstd: bool, zstd: bool,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Async<Result<Box<dyn tokio::io::AsyncRead + Unpin + Send>, Error>>; ) -> Async<Result<Box<dyn tokio::io::AsyncRead + Unpin + Send>, Error>>;
/// Return status of all running/mapped images, result value is (id, extra data), where id must /// Return status of all running/mapped images, result value is (id, extra data), where id must
@ -94,11 +94,11 @@ pub async fn data_list(
details: SnapRestoreDetails, details: SnapRestoreDetails,
img_file: String, img_file: String,
path: Vec<u8>, path: Vec<u8>,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Result<Vec<ArchiveEntry>, Error> { ) -> Result<Vec<ArchiveEntry>, Error> {
let driver = driver.unwrap_or(DEFAULT_DRIVER).resolve(); let driver = driver.unwrap_or(DEFAULT_DRIVER).resolve();
driver driver
.data_list(details, img_file, path, dynamic_memory) .data_list(details, img_file, path, auto_memory_hotplug)
.await .await
} }
@ -109,11 +109,11 @@ pub async fn data_extract(
path: Vec<u8>, path: Vec<u8>,
format: Option<FileRestoreFormat>, format: Option<FileRestoreFormat>,
zstd: bool, zstd: bool,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Result<Box<dyn tokio::io::AsyncRead + Send + Unpin>, Error> { ) -> Result<Box<dyn tokio::io::AsyncRead + Send + Unpin>, Error> {
let driver = driver.unwrap_or(DEFAULT_DRIVER).resolve(); let driver = driver.unwrap_or(DEFAULT_DRIVER).resolve();
driver driver
.data_extract(details, img_file, path, format, zstd, dynamic_memory) .data_extract(details, img_file, path, format, zstd, auto_memory_hotplug)
.await .await
} }

View File

@ -19,7 +19,7 @@ use pbs_datastore::catalog::ArchiveEntry;
use super::block_driver::*; use super::block_driver::*;
use crate::get_user_run_dir; use crate::get_user_run_dir;
use crate::qemu_helper::set_dynamic_memory; use crate::qemu_helper::set_auto_memory_hotplug;
const RESTORE_VM_MAP: &str = "restore-vm-map.json"; const RESTORE_VM_MAP: &str = "restore-vm-map.json";
@ -218,15 +218,15 @@ impl BlockRestoreDriver for QemuBlockDriver {
details: SnapRestoreDetails, details: SnapRestoreDetails,
img_file: String, img_file: String,
mut path: Vec<u8>, mut path: Vec<u8>,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Async<Result<Vec<ArchiveEntry>, Error>> { ) -> Async<Result<Vec<ArchiveEntry>, Error>> {
async move { async move {
let (cid, client) = ensure_running(&details).await?; let (cid, client) = ensure_running(&details).await?;
if !path.is_empty() && path[0] != b'/' { if !path.is_empty() && path[0] != b'/' {
path.insert(0, b'/'); path.insert(0, b'/');
} }
if path_is_zfs(&path) && dynamic_memory { if path_is_zfs(&path) && auto_memory_hotplug {
if let Err(err) = set_dynamic_memory(cid, None).await { if let Err(err) = set_auto_memory_hotplug(cid, None).await {
log::error!("could not increase memory: {err}"); log::error!("could not increase memory: {err}");
} }
} }
@ -246,15 +246,15 @@ impl BlockRestoreDriver for QemuBlockDriver {
mut path: Vec<u8>, mut path: Vec<u8>,
format: Option<FileRestoreFormat>, format: Option<FileRestoreFormat>,
zstd: bool, zstd: bool,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Async<Result<Box<dyn tokio::io::AsyncRead + Unpin + Send>, Error>> { ) -> Async<Result<Box<dyn tokio::io::AsyncRead + Unpin + Send>, Error>> {
async move { async move {
let (cid, client) = ensure_running(&details).await?; let (cid, client) = ensure_running(&details).await?;
if !path.is_empty() && path[0] != b'/' { if !path.is_empty() && path[0] != b'/' {
path.insert(0, b'/'); path.insert(0, b'/');
} }
if path_is_zfs(&path) && dynamic_memory { if path_is_zfs(&path) && auto_memory_hotplug {
if let Err(err) = set_dynamic_memory(cid, None).await { if let Err(err) = set_auto_memory_hotplug(cid, None).await {
log::error!("could not increase memory: {err}"); log::error!("could not increase memory: {err}");
} }
} }

View File

@ -105,7 +105,7 @@ async fn list_files(
crypt_config: Option<Arc<CryptConfig>>, crypt_config: Option<Arc<CryptConfig>>,
keyfile: Option<String>, keyfile: Option<String>,
driver: Option<BlockDriverType>, driver: Option<BlockDriverType>,
dynamic_memory: bool, auto_memory_hotplug: bool,
) -> Result<Vec<ArchiveEntry>, Error> { ) -> Result<Vec<ArchiveEntry>, Error> {
let client = connect(&repo)?; let client = connect(&repo)?;
let client = BackupReader::start( let client = BackupReader::start(
@ -172,7 +172,7 @@ async fn list_files(
snapshot, snapshot,
keyfile, keyfile,
}; };
data_list(driver, details, file, path, dynamic_memory).await data_list(driver, details, file, path, auto_memory_hotplug).await
} }
} }
} }
@ -228,9 +228,9 @@ async fn list_files(
minimum: 1, minimum: 1,
optional: true, optional: true,
}, },
"dynamic-memory": { "auto-memory-hotplug": {
type: Boolean, type: Boolean,
description: "If enabled, automatically increases memory for started vms in case of accessing a zpool inside.", description: "If enabled, automatically hot-plugs memory for started VM if a ZFS pool is accessed.",
default: false, default: false,
optional: true, optional: true,
}, },
@ -251,7 +251,7 @@ async fn list(
path: String, path: String,
base64: bool, base64: bool,
timeout: Option<u64>, timeout: Option<u64>,
dynamic_memory: bool, auto_memory_hotplug: bool,
param: Value, param: Value,
) -> Result<(), Error> { ) -> Result<(), Error> {
let repo = extract_repository_from_value(&param)?; let repo = extract_repository_from_value(&param)?;
@ -289,7 +289,7 @@ async fn list(
crypt_config, crypt_config,
keyfile, keyfile,
driver, driver,
dynamic_memory, auto_memory_hotplug,
), ),
) )
.await .await
@ -306,7 +306,7 @@ async fn list(
crypt_config, crypt_config,
keyfile, keyfile,
driver, driver,
dynamic_memory, auto_memory_hotplug,
) )
.await .await
}; };
@ -415,9 +415,9 @@ async fn list(
type: BlockDriverType, type: BlockDriverType,
optional: true, optional: true,
}, },
"dynamic-memory": { "auto-memory-hotplug": {
type: Boolean, type: Boolean,
description: "If enabled, automatically increases memory for started vms in case of accessing a zpool inside.", description: "If enabled, automatically hot-plugs memory for started VM if a ZFS pool is accessed.",
default: false, default: false,
optional: true, optional: true,
}, },
@ -434,7 +434,7 @@ async fn extract(
target: Option<String>, target: Option<String>,
format: Option<FileRestoreFormat>, format: Option<FileRestoreFormat>,
zstd: bool, zstd: bool,
dynamic_memory: bool, auto_memory_hotplug: bool,
param: Value, param: Value,
) -> Result<(), Error> { ) -> Result<(), Error> {
let repo = extract_repository_from_value(&param)?; let repo = extract_repository_from_value(&param)?;
@ -516,7 +516,7 @@ async fn extract(
path.clone(), path.clone(),
Some(FileRestoreFormat::Pxar), Some(FileRestoreFormat::Pxar),
false, false,
dynamic_memory, auto_memory_hotplug,
) )
.await?; .await?;
let decoder = Decoder::from_tokio(reader).await?; let decoder = Decoder::from_tokio(reader).await?;
@ -536,7 +536,7 @@ async fn extract(
path.clone(), path.clone(),
format, format,
zstd, zstd,
dynamic_memory, auto_memory_hotplug,
) )
.await?; .await?;
tokio::io::copy(&mut reader, &mut tokio::io::stdout()).await?; tokio::io::copy(&mut reader, &mut tokio::io::stdout()).await?;