]> git.proxmox.com Git - qemu-server.git/commitdiff
exclude efidisk and tpmstate for boot disk selection
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 15 Nov 2021 15:56:41 +0000 (16:56 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 15 Nov 2021 15:57:52 +0000 (16:57 +0100)
else we cannot create a vm without a disk but with a tpmstate/efidisk,
since the api tries to generate the default bootorder with them included

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/QemuServer/Drive.pm

index 0f9ceba1c2be21c8ea3ed5f620352d90b77b7b71..7b82fb228f023e7c8183dea78c73e96b8abb9ec5 100644 (file)
@@ -457,6 +457,10 @@ for (my $i = 0; $i < $MAX_UNUSED_DISKS; $i++) {
     $drivedesc_hash->{"unused$i"} = $unuseddesc;
 }
 
+sub valid_drive_names_for_boot {
+    return grep { $_ ne 'efidisk0' && $_ ne 'tpmstate0' } valid_drive_names();
+}
+
 sub valid_drive_names {
     # order is important - used to autoselect boot disk
     return ((map { "ide$_" } (0 .. ($MAX_IDE_DISKS - 1))),
@@ -697,7 +701,7 @@ sub is_volume_in_use {
 
 sub resolve_first_disk {
     my ($conf, $cdrom) = @_;
-    my @disks = valid_drive_names();
+    my @disks = valid_drive_names_for_boot();
     foreach my $ds (@disks) {
        next if !$conf->{$ds};
        my $disk = parse_drive($ds, $conf->{$ds});