[pve-devel] [PATCH v2 manager 2/6] vzdump: generate notes: initialize potentially undef values

Fabian Ebner f.ebner at proxmox.com
Mon May 9 12:34:09 CEST 2022


For VMs, $task->{hostname} might be undef and when running on a
stand-alone node, there is no cluster name.

Reported-by: Marco Gabriel <mgabriel at inett.de>
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * Use 'standalone node' rather than empty string if there is no
      cluster.

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

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 0dbf8928..86d5a232 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -97,8 +97,8 @@ my $generate_notes = sub {
     $verify_notes_template->($notes_template);
 
     my $info = {
-	cluster => PVE::Cluster::get_clinfo()->{cluster}->{name},
-	guestname => $task->{hostname},
+	cluster => PVE::Cluster::get_clinfo()->{cluster}->{name} // 'standalone node',
+	guestname => $task->{hostname} // "VM $task->{vmid}", # is always set for CTs
 	node => PVE::INotify::nodename(),
 	vmid => $task->{vmid},
     };
-- 
2.30.2






More information about the pve-devel mailing list