public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common v4 2/2] PBSClient: add optional 'dynamic-memory' parameter to file-restore commands
Date: Thu, 10 Nov 2022 11:36:31 +0100	[thread overview]
Message-ID: <20221110103634.2177856-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20221110103634.2177856-1-d.csapak@proxmox.com>

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@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





  parent reply	other threads:[~2022-11-10 10:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-10 10:36 [pve-devel] [PATCH proxmox-backup/common/storage v4] improve file-restore timeout behaviour Dominik Csapak
2022-11-10 10:36 ` [pve-devel] [PATCH proxmox-backup v4 1/1] file-restore: make dynamic memory behaviour controllable Dominik Csapak
2022-11-15  8:29   ` [pve-devel] applied: [pbs-devel] " Thomas Lamprecht
2022-11-10 10:36 ` [pve-devel] [PATCH common v4 1/2] PBSClient: file_restore_list: add extraParams and use timeout Dominik Csapak
2022-11-15 12:27   ` [pve-devel] applied: " Thomas Lamprecht
2022-11-10 10:36 ` Dominik Csapak [this message]
2022-11-10 10:36 ` [pve-devel] [PATCH storage v4 1/3] api: FileRestore: decode and return proper error of file-restore listing Dominik Csapak
2022-11-15 12:27   ` [pve-devel] applied: " Thomas Lamprecht
2022-11-10 10:36 ` [pve-devel] [PATCH storage v4 2/3] api: FileRestore: make use of file-restores and guis timeout mechanism Dominik Csapak
2022-11-15 12:28   ` [pve-devel] applied: " Thomas Lamprecht
2022-11-10 10:36 ` [pve-devel] [PATCH storage v4 3/3] api: FileRestore: allow automatic memory increase for privileged users Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221110103634.2177856-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal