all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v3 manager 1/4] vzdump: storage info: move out activate storage call
@ 2021-03-11  9:22 Fabian Ebner
  2021-03-11  9:22 ` [pve-devel] [PATCH v3 manager 2/4] api: vzdump: add call to get currently configured vzdump defaults Fabian Ebner
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Fabian Ebner @ 2021-03-11  9:22 UTC (permalink / raw)
  To: pve-devel

Otherwise storage_info() cannot be used for (at least) PBS storages from an API
call without 'protected => 1', because the password cannot be read from
'/etc/pve/priv'. Note that the function itself does not need the storage to be
active, because it only uses storage_config() and get_backup_dir().

AFAICT new() is the only existing user of this function and can be responsible
for activating the storage itself.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

New in v3

 PVE/VZDump.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 02858d8e..fb4c8bad 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -106,8 +106,6 @@ sub storage_info {
     die "can't use storage '$storage' for backups - wrong content type\n"
 	if (!$scfg->{content}->{backup});
 
-    PVE::Storage::activate_storage($cfg, $storage);
-
     my $info = {
 	scfg => $scfg,
     };
@@ -505,6 +503,13 @@ sub new {
     my $errors = '';
 
     if ($opts->{storage}) {
+	my $storage_cfg = PVE::Storage::config();
+	eval { PVE::Storage::activate_storage($storage_cfg, $opts->{storage}) };
+	if (my $err = $@) {
+	    chomp($err);
+	    $errors .= "could not activate storage '$opts->{storage}': $err";
+	}
+
 	my $info = eval { storage_info ($opts->{storage}) };
 	if (my $err = $@) {
 	    chomp($err);
-- 
2.20.1





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-02 12:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11  9:22 [pve-devel] [PATCH v3 manager 1/4] vzdump: storage info: move out activate storage call Fabian Ebner
2021-03-11  9:22 ` [pve-devel] [PATCH v3 manager 2/4] api: vzdump: add call to get currently configured vzdump defaults Fabian Ebner
2021-04-01 13:40   ` Thomas Lamprecht
2021-04-02 12:27     ` Fabian Ebner
2021-04-02 12:58       ` Thomas Lamprecht
2021-03-11  9:22 ` [pve-devel] [PATCH v3 manager 3/4] ui: backup: fill in some of the " Fabian Ebner
2021-03-11  9:22 ` [pve-devel] [PATCH v3 manager 4/4] fix #2745: ui: backup: allow specifying remove parameter for manual backup Fabian Ebner
2021-04-01 13:25 ` [pve-devel] applied: [PATCH v3 manager 1/4] vzdump: storage info: move out activate storage call Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal