]> git.proxmox.com Git - qemu-server.git/commitdiff
cd rom handling: return a clearer error when there is no cd rom drive
authorStefan Sterz <s.sterz@proxmox.com>
Tue, 20 Dec 2022 10:30:36 +0000 (11:30 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 13 Jan 2023 12:20:35 +0000 (13:20 +0100)
when a vm is configured to use a physical cd rom drive but there is no
such drive a cryptic "uninitialized value" error is thrown. this is
due to `$path` being undefined in `sub print_drive_commandline_full`.
warn that no cd rom drive is available instead.

note that the error was cosmetic as the vm would start just fine.

forum thread: https://forum.proxmox.com/threads/119592/

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
PVE/QemuServer.pm

index d94fe5ab1ba06641c200e2fa6d6e0f6f9ee96302..ceb383204d5e052a45273b97046aeea944652cda 100644 (file)
@@ -1287,11 +1287,16 @@ sub option_exists {
 my $cdrom_path;
 sub get_cdrom_path {
 
-    return  $cdrom_path if $cdrom_path;
+    return $cdrom_path if defined($cdrom_path);
 
     return $cdrom_path = "/dev/cdrom" if -l "/dev/cdrom";
     return $cdrom_path = "/dev/cdrom1" if -l "/dev/cdrom1";
     return $cdrom_path = "/dev/cdrom2" if -l "/dev/cdrom2";
+
+    log_warn("no physical CD-ROM available, ignoring");
+    $cdrom_path = '';
+
+    return $cdrom_path;
 }
 
 sub get_iso_path {