Skip to content

Commit

Permalink
Merge pull request microsoft#397 from Microsoft/scsi_uint32_uvm
Browse files Browse the repository at this point in the history
UVMOptions.SCSIControllerCount should be uint
  • Loading branch information
jterry75 authored Nov 30, 2018
2 parents f785b15 + 799ec4e commit 353176b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions uvm/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ type UVMOptions struct {
LayerFolders []string // Set of folders for base layers and scratch. Ordered from top most read-only through base read-only layer, followed by scratch

// LCOW specific parameters
BootFilesPath string // Folder in which kernel and root file system reside. Defaults to \Program Files\Linux Containers
KernelFile string // Filename under BootFilesPath for the kernel. Defaults to `kernel`
RootFSFile string // Filename under BootFilesPath for the UVMs root file system. Defaults are `initrd.img` or `rootfs.vhd`.
KernelBootOptions string // Additional boot options for the kernel
EnableGraphicsConsole bool // If true, enable a graphics console for the utility VM
ConsolePipe string // The named pipe path to use for the serial console. eg \\.\pipe\vmpipe
SCSIControllerCount *int // The number of SCSI controllers. Defaults to 1 if omitted. Currently we only support 0 or 1.
BootFilesPath string // Folder in which kernel and root file system reside. Defaults to \Program Files\Linux Containers
KernelFile string // Filename under BootFilesPath for the kernel. Defaults to `kernel`
RootFSFile string // Filename under BootFilesPath for the UVMs root file system. Defaults are `initrd.img` or `rootfs.vhd`.
KernelBootOptions string // Additional boot options for the kernel
EnableGraphicsConsole bool // If true, enable a graphics console for the utility VM
ConsolePipe string // The named pipe path to use for the serial console. eg \\.\pipe\vmpipe
SCSIControllerCount *uint32 // The number of SCSI controllers. Defaults to 1 if omitted. Currently we only support 0 or 1.

// Fields that can be configured via OCI annotations in runhcs.

Expand Down Expand Up @@ -183,7 +183,7 @@ func Create(opts *UVMOptions) (_ *UtilityVM, err error) {
scsi["0"] = hcsschema.Scsi{Attachments: attachments}
uvm.scsiControllerCount = 1
if opts.SCSIControllerCount != nil {
if *opts.SCSIControllerCount < 0 || *opts.SCSIControllerCount > 1 {
if *opts.SCSIControllerCount > 1 {
return nil, fmt.Errorf("SCSI controller count must be 0 or 1") // Future extension here for up to 4
}
uvm.scsiControllerCount = *opts.SCSIControllerCount
Expand Down
2 changes: 1 addition & 1 deletion uvm/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type UtilityVM struct {

// SCSI devices that are mapped into a Windows or Linux utility VM
scsiLocations [4][64]scsiInfo // Hyper-V supports 4 controllers, 64 slots per controller. Limited to 1 controller for now though.
scsiControllerCount int // Number of SCSI controllers in the utility VM
scsiControllerCount uint32 // Number of SCSI controllers in the utility VM

// Plan9 are directories mapped into a Linux utility VM
plan9Shares map[string]*plan9Info
Expand Down

0 comments on commit 353176b

Please sign in to comment.