From 941e0c42a55286e42b63e64c371aaa33782feb43 Mon Sep 17 00:00:00 2001 From: Derumier Alexandre Date: Fri, 9 Sep 2011 10:27:21 +0200 Subject: [PATCH] Add scsi controllers V2 only if scsi disk exists Signed-off-by: Derumier Alexandre --- PVE/QemuServer.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 128fb8bd..cc5e1506 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2095,6 +2095,7 @@ sub config_to_command { } my $vollist = []; + my $scsicontroller = {}; foreach_drive($conf, sub { my ($ds, $drive) = @_; @@ -2105,6 +2106,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;