diff --git a/functional/lcow_test.go b/functional/lcow_test.go index 9b3b0c94df..f639bdaa44 100644 --- a/functional/lcow_test.go +++ b/functional/lcow_test.go @@ -22,7 +22,7 @@ import ( // TestLCOWUVMNoSCSINoVPMemInitrd starts an LCOW utility VM without a SCSI controller and // no VPMem device. Uses initrd. func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { - scsiCount := 0 + var scsiCount uint32 = 0 var vpmemCount uint32 = 0 opts := &uvm.UVMOptions{ OperatingSystem: "linux", @@ -36,7 +36,7 @@ func TestLCOWUVMNoSCSINoVPMemInitrd(t *testing.T) { // TestLCOWUVMNoSCSISingleVPMemVHD starts an LCOW utility VM without a SCSI controller and // only a single VPMem device. Uses VPMEM VHD func TestLCOWUVMNoSCSISingleVPMemVHD(t *testing.T) { - scsiCount := 0 + var scsiCount uint32 = 0 var vpmemCount uint32 = 1 var prfst uvm.PreferredRootFSType = uvm.PreferredRootFSTypeVHD opts := &uvm.UVMOptions{ diff --git a/internal/uvm/create.go b/internal/uvm/create.go index d8650585b2..e3bc524876 100644 --- a/internal/uvm/create.go +++ b/internal/uvm/create.go @@ -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. @@ -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 diff --git a/internal/uvm/types.go b/internal/uvm/types.go index ef1749eb3a..c0e9a44065 100644 --- a/internal/uvm/types.go +++ b/internal/uvm/types.go @@ -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