[pve-devel] [PATCH 1/4] Add scsi controllers V2

Derumier Alexandre aderumier at odiso.com
Fri Sep 9 10:27:21 CEST 2011


only if scsi disk exists

Signed-off-by: Derumier Alexandre <aderumier at odiso.com>
---
 PVE/QemuServer.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 98444ec..ec4647c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2074,6 +2074,7 @@ sub config_to_command {
     }
 
     my $vollist = [];
+    my $scsicontroller = {};
 
     foreach_drive($conf, sub {
 	my ($ds, $drive) = @_;
@@ -2084,6 +2085,12 @@ sub config_to_command {
 	}; # ignore errors
 
 	$use_virtio = 1 if $ds =~ m/^virtio/;
+        if ($drive->{interface} eq 'scsi') {
+           my $maxdev = 7;
+           my $controller = int ($drive->{index} / $maxdev);
+           push @$cmd, '-device', "lsi,id=scsi$controller" if !$scsicontroller->{$controller};
+           my $scsicontroller->{$controller}=1;
+        }
 	my $tmp = print_drive_full ($storecfg, $vmid, $drive);
 	$tmp .= ",boot=on" if $conf->{bootdisk} && ($conf->{bootdisk} eq $ds);
 	push @$cmd, '-drive', $tmp;
-- 
1.7.2.5




More information about the pve-devel mailing list