[pve-devel] r6574 - qemu-server/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Dec 6 09:13:30 CET 2011


Author: dietmar
Date: 2011-12-06 09:13:29 +0100 (Tue, 06 Dec 2011)
New Revision: 6574

Modified:
   qemu-server/trunk/QemuServer.pm
Log:
fix bootindex


Modified: qemu-server/trunk/QemuServer.pm
===================================================================
--- qemu-server/trunk/QemuServer.pm	2011-12-06 07:22:28 UTC (rev 6573)
+++ qemu-server/trunk/QemuServer.pm	2011-12-06 08:13:29 UTC (rev 6574)
@@ -1351,9 +1351,9 @@
     push @$cmd, '-smp', "sockets=$sockets,cores=$cores";
 
     my $bootindex_hash = {
-	c => 1,
-	a => 2,
-	d => 3,
+	c => 100,
+	a => 200,
+	d => 300,
     };
 
     $boot_opt = "menu=on";
@@ -1361,7 +1361,7 @@
 	$bootindex_hash = {};
 	my $i = 1;
 	foreach my $o (split(//, $conf->{boot})) {
-	    $bootindex_hash->{$o} = $i;
+	    $bootindex_hash->{$o} = $i*100;
 	    $i++;
 	} 
     }
@@ -1424,9 +1424,15 @@
 	my $drive = $di->{$ds};
 	$use_virtio = 1 if $ds =~ m/^virtio/;
 	if (drive_is_cdrom ($drive)) {
-	    $drive->{bootindex} = $bootindex_hash->{d};
+	    if ($bootindex_hash->{d}) {
+		$drive->{bootindex} = $bootindex_hash->{d};
+		$bootindex_hash->{d} += 1;
+	    }
 	} else {
-	    $drive->{bootindex} = $bootindex_hash->{c} if $conf->{bootdisk} && ($conf->{bootdisk} eq $ds);
+	    if ($bootindex_hash->{c}) {
+		$drive->{bootindex} = $bootindex_hash->{c} if $conf->{bootdisk} && ($conf->{bootdisk} eq $ds);
+		$bootindex_hash->{c} += 1;
+	    }
 	}
         if ($drive->{interface} eq 'scsi') {
            my $maxdev = 7;
@@ -1471,8 +1477,10 @@
 	my $extra = ((!$conf->{boot} || ($conf->{boot} !~ m/n/))) ?
 	    "romfile=," : '';
 	my $tmpstr =  "$device,${extra}mac=$nic->{macaddr},netdev=${id}";
-	my $bootindex = $bootindex_hash->{n};
-	$tmpstr .= ",bootindex=$bootindex" if $bootindex;
+	if (my $bootindex = $bootindex_hash->{n}) {
+	    $tmpstr .= ",bootindex=$bootindex";
+	    $bootindex_hash->{n} += 1;
+	}
 	push @$cmd, '-device', $tmpstr;
     };
 



More information about the pve-devel mailing list