disks: add a guard possible nonexistent field

When running

    pveceph osd create <device>

one would get one or two warnings:

    Use of uninitialized value in pattern match (m//) at /usr/share/perl5/PVE/Diskmanage.pm line 317.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Link: https://lore.proxmox.com/20251024121309.1253604-1-m.sandoval@proxmox.com
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Maximiliano Sandoval
2025-10-24 14:13:09 +02:00
committed by Thomas Lamprecht
parent c9a2ce281b
commit 5b949979f7

View File

@ -316,6 +316,7 @@ sub get_ceph_volume_infos {
# $result autovivification is wanted, to not creating empty hashes # $result autovivification is wanted, to not creating empty hashes
if ( if (
($type eq 'block' || $type eq 'data') ($type eq 'block' || $type eq 'data')
&& $fields->[2]
&& $fields->[2] =~ m/ceph.osd_id=([^,]+)/ && $fields->[2] =~ m/ceph.osd_id=([^,]+)/
) { ) {
$result->{$dev}->{osdid} = $1; $result->{$dev}->{osdid} = $1;