[pve-devel] [PATCH common v4 2/2] PBSClient: add optional 'dynamic-memory' parameter to file-restore commands
Dominik Csapak
d.csapak at proxmox.com
Thu Nov 10 11:36:31 CET 2022
so that we can make use of the dynamic memory feature of file-restore
(it automatically increases the memory of the file-restore vm when
we detect a zfs path)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v4
depends on the proxmox-backup patch for file-restore
src/PVE/PBSClient.pm | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm
index ec05a1c..13b28c1 100644
--- a/src/PVE/PBSClient.pm
+++ b/src/PVE/PBSClient.pm
@@ -383,6 +383,9 @@ sub file_restore_list {
if (my $timeout = $extra_params->{timeout}) {
push $cmd->@*, '--timeout', $timeout;
}
+ if (my $dynamic_memory = $extra_params->{'dynamic-memory'}) {
+ push $cmd->@*, '--dynamic-memory', $dynamic_memory;
+ }
return run_client_cmd(
$self,
@@ -416,10 +419,16 @@ sub file_restore_extract_prepare {
# this blocks while data is transfered, call this from a background worker
sub file_restore_extract {
- my ($self, $output_file, $snapshot, $filepath, $base64) = @_;
+ my ($self, $output_file, $snapshot, $filepath, $base64, $extra_params) = @_;
(my $namespace, $snapshot) = split_namespaced_parameter($self, $snapshot);
+ my $cmd = [ $snapshot, $filepath, "-", "--base64", $base64 ? 1 : 0 ];
+
+ if (my $dynamic_memory = $extra_params->{'dynamic-memory'}) {
+ push $cmd->@*, '--dynamic-memory', $dynamic_memory;
+ }
+
my $ret = eval {
local $SIG{ALRM} = sub { die "got timeout\n" };
alarm(30);
@@ -433,7 +442,7 @@ sub file_restore_extract {
return run_raw_client_cmd(
$self,
"extract",
- [ $snapshot, $filepath, "-", "--base64", $base64 ? 1 : 0 ],
+ $cmd,
binary => "proxmox-file-restore",
namespace => $namespace,
errfunc => $errfunc,
--
2.30.2
More information about the pve-devel
mailing list