From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 802276150A for ; Thu, 3 Dec 2020 09:57:33 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6C1A324B4A for ; Thu, 3 Dec 2020 09:57:03 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id E591D24B42 for ; Thu, 3 Dec 2020 09:57:02 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8445044BDE for ; Thu, 3 Dec 2020 09:43:14 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Thu, 3 Dec 2020 09:43:09 +0100 Message-Id: <20201203084309.24838-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.299 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm] Subject: [pve-devel] [PATCH qemu-server] fix backpu/restore with ipv6/ports for pbs X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 08:57:33 -0000 by copying the 'get_server_with_port' from PVE::Storage::PBSPlugin here and using it for generating the server Signed-off-by: Dominik Csapak --- ideally we would make the get_server_with_port sub in pve-storage public and use it here (like we do e.g. in container with 'run_raw_client_cmd') or even push that stuff into PVE::PBSClient module in comment to reuse that here and in pve-storage but to avoid the dependency bumps and fix it fast, this should be enough for now PVE/QemuServer.pm | 14 +++++++++++++- PVE/VZDump/QemuServer.pm | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 4989938..7170230 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -6050,6 +6050,18 @@ sub rescan { } } +sub pbs_get_server_with_port { + my ($scfg) = @_; + + my $server = $scfg->{server}; + $server = "[$server]" if $server =~ /^$IPV6RE$/; + + if (my $port = $scfg->{port}) { + $server .= ":$port" if $port != 8007; + } + return $server; +} + sub restore_proxmox_backup_archive { my ($archive, $vmid, $user, $options) = @_; @@ -6058,7 +6070,7 @@ sub restore_proxmox_backup_archive { my ($storeid, $volname) = PVE::Storage::parse_volume_id($archive); my $scfg = PVE::Storage::storage_config($storecfg, $storeid); - my $server = $scfg->{server}; + my $server = pbs_get_server_with_port($scfg); my $datastore = $scfg->{datastore}; my $username = $scfg->{username} // 'root@pam'; my $fingerprint = $scfg->{fingerprint}; diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index 5003676..57436e6 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -473,7 +473,8 @@ sub archive_pbs { my $starttime = time(); - my $server = $scfg->{server}; + my $server = PVE::QemuServer::pbs_get_server_with_port($scfg); + my $datastore = $scfg->{datastore}; my $username = $scfg->{username} // 'root@pam'; my $fingerprint = $scfg->{fingerprint}; -- 2.20.1