Skip to content

Commit

Permalink
Skip SCSI controller check when empty (#1179)
Browse files Browse the repository at this point in the history
Fixes #1138
  • Loading branch information
bill-rich authored Aug 26, 2020
1 parent 0ba8555 commit de88dc7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,18 +694,18 @@ func createSCSIController(l *object.VirtualDeviceList, ct string, st string) ([]
// depending on if all controllers are one specific kind or not. Only the first
// number of controllers specified by count are checked.
func ReadSCSIBusType(l object.VirtualDeviceList, count int) string {
ctlrs := make([]types.BaseVirtualSCSIController, count)
controllers := make([]types.BaseVirtualSCSIController, count)
for _, dev := range l {
if sc, ok := dev.(types.BaseVirtualSCSIController); ok && sc.GetVirtualSCSIController().BusNumber < int32(count) {
ctlrs[sc.GetVirtualSCSIController().BusNumber] = sc
controllers[sc.GetVirtualSCSIController().BusNumber] = sc
}
}
log.Printf("[DEBUG] ReadSCSIBusType: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(ctlrs))
if len(ctlrs) == 0 {
log.Printf("[DEBUG] ReadSCSIBusType: SCSI controller layout for first %d controllers: %s", count, scsiControllerListString(controllers))
if len(controllers) == 0 || controllers[0] == nil {
return subresourceControllerTypeUnknown
}
last := l.Type(ctlrs[0].(types.BaseVirtualDevice))
for _, ctlr := range ctlrs[1:] {
last := l.Type(controllers[0].(types.BaseVirtualDevice))
for _, ctlr := range controllers[1:] {
if ctlr == nil || l.Type(ctlr.(types.BaseVirtualDevice)) != last {
return subresourceControllerTypeMixed
}
Expand Down

0 comments on commit de88dc7

Please sign in to comment.