mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-12-09 18:00:47 +00:00
fix #2473: use of unitialized value
With the noerr flag set in parse_volume_id we have to check if $volname is defined before comparing it to 'cloudinit'. Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
This commit is contained in:
parent
b3233604d1
commit
8f2c9019f5
@ -70,7 +70,7 @@ my $check_storage_access = sub {
|
|||||||
my $volid = $drive->{file};
|
my $volid = $drive->{file};
|
||||||
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
|
my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
|
||||||
|
|
||||||
if (!$volid || ($volid eq 'none' || $volid eq 'cloudinit' || $volname eq 'cloudinit')) {
|
if (!$volid || ($volid eq 'none' || $volid eq 'cloudinit' || (defined($volname) && $volname eq 'cloudinit'))) {
|
||||||
# nothing to check
|
# nothing to check
|
||||||
} elsif ($isCDROM && ($volid eq 'cdrom')) {
|
} elsif ($isCDROM && ($volid eq 'cdrom')) {
|
||||||
$rpcenv->check($authuser, "/", ['Sys.Console']);
|
$rpcenv->check($authuser, "/", ['Sys.Console']);
|
||||||
@ -148,7 +148,7 @@ my $create_disks = sub {
|
|||||||
if (!$volid || $volid eq 'none' || $volid eq 'cdrom') {
|
if (!$volid || $volid eq 'none' || $volid eq 'cdrom') {
|
||||||
delete $disk->{size};
|
delete $disk->{size};
|
||||||
$res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
|
$res->{$ds} = PVE::QemuServer::print_drive($vmid, $disk);
|
||||||
} elsif ($volname eq 'cloudinit') {
|
} elsif (defined($volname) && $volname eq 'cloudinit') {
|
||||||
$storeid = $storeid // $default_storage;
|
$storeid = $storeid // $default_storage;
|
||||||
die "no storage ID specified (and no default storage)\n" if !$storeid;
|
die "no storage ID specified (and no default storage)\n" if !$storeid;
|
||||||
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
|
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user