From cb906a32b0d01a6b5059a9da91194714eac24099 Mon Sep 17 00:00:00 2001 From: Kevin Parsons Date: Wed, 26 Apr 2023 16:46:15 -0700 Subject: [PATCH] try new SCSIManager exports --- internal/devices/drivers.go | 7 +- internal/hcsoci/resources_lcow.go | 14 ++-- internal/hcsoci/resources_wcow.go | 25 +++--- internal/layers/layers.go | 19 +++-- internal/uvm/scsi/attach.go | 26 +++--- internal/uvm/scsi/backend.go | 40 +++++----- internal/uvm/scsi/manager.go | 128 +----------------------------- internal/uvm/scsi/mount.go | 30 +++---- 8 files changed, 92 insertions(+), 197 deletions(-) diff --git a/internal/devices/drivers.go b/internal/devices/drivers.go index e1e0b46e77..51eb654c0b 100644 --- a/internal/devices/drivers.go +++ b/internal/devices/drivers.go @@ -59,11 +59,10 @@ func InstallDrivers(ctx context.Context, vm *uvm.UtilityVM, share string, gpuDri if err := wclayer.GrantVmAccess(ctx, vm.ID(), share); err != nil { return closer, err } - mount, err := vm.SCSIManager.AddVirtualDisk( + mount, err := vm.SCSIManager.Add( ctx, - share, - true, - &scsi.MountConfig{}, + &scsi.AttachConfig{Path: share, ReadOnly: true, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{ReadOnly: true, Verity: scsi.ReadVerityInfo(ctx, share)}, ) if err != nil { return closer, fmt.Errorf("failed to add SCSI disk to utility VM for path %+v: %s", share, err) diff --git a/internal/hcsoci/resources_lcow.go b/internal/hcsoci/resources_lcow.go index 339a8db28e..f2745bf606 100644 --- a/internal/hcsoci/resources_lcow.go +++ b/internal/hcsoci/resources_lcow.go @@ -89,11 +89,10 @@ func allocateLinuxResources(ctx context.Context, coi *createOptionsInternal, r * if err := wclayer.GrantVmAccess(ctx, coi.HostingSystem.ID(), hostPath); err != nil { return err } - scsiMount, err := coi.HostingSystem.SCSIManager.AddPhysicalDisk( + scsiMount, err := coi.HostingSystem.SCSIManager.Add( ctx, - hostPath, - readOnly, - &scsi.MountConfig{Options: mount.Options}, + &scsi.AttachConfig{Path: hostPath, ReadOnly: readOnly, Type: scsi.AttachmentTypePassThru}, + &scsi.MountConfig{ReadOnly: readOnly, Verity: scsi.ReadVerityInfo(ctx, hostPath), Options: mount.Options}, ) if err != nil { return errors.Wrapf(err, "adding SCSI physical disk mount %+v", mount) @@ -110,11 +109,10 @@ func allocateLinuxResources(ctx context.Context, coi *createOptionsInternal, r * if err := wclayer.GrantVmAccess(ctx, coi.HostingSystem.ID(), hostPath); err != nil { return err } - scsiMount, err := coi.HostingSystem.SCSIManager.AddVirtualDisk( + scsiMount, err := coi.HostingSystem.SCSIManager.Add( ctx, - hostPath, - readOnly, - &scsi.MountConfig{Options: mount.Options}, + &scsi.AttachConfig{Path: hostPath, ReadOnly: readOnly, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{ReadOnly: readOnly, Verity: scsi.ReadVerityInfo(ctx, hostPath), Options: mount.Options}, ) if err != nil { return errors.Wrapf(err, "adding SCSI virtual disk mount %+v", mount) diff --git a/internal/hcsoci/resources_wcow.go b/internal/hcsoci/resources_wcow.go index 4d94d60782..d59a576cf2 100644 --- a/internal/hcsoci/resources_wcow.go +++ b/internal/hcsoci/resources_wcow.go @@ -165,30 +165,31 @@ func setupMounts(ctx context.Context, coi *createOptionsInternal, r *resources.R if err := wclayer.GrantVmAccess(ctx, coi.HostingSystem.ID(), mount.Source); err != nil { return err } - scsiMount, err = coi.HostingSystem.SCSIManager.AddPhysicalDisk( + scsiMount, err = coi.HostingSystem.SCSIManager.Add( ctx, - mount.Source, - readOnly, - &scsi.MountConfig{Options: mount.Options}, + &scsi.AttachConfig{Path: mount.Source, ReadOnly: readOnly, Type: scsi.AttachmentTypePassThru}, + &scsi.MountConfig{ReadOnly: readOnly, Verity: scsi.ReadVerityInfo(ctx, mount.Source), Options: mount.Options}, ) case "virtual-disk": l.Debug("hcsshim::allocateWindowsResources Hot-adding SCSI virtual disk for OCI mount") if err := wclayer.GrantVmAccess(ctx, coi.HostingSystem.ID(), mount.Source); err != nil { return err } - scsiMount, err = coi.HostingSystem.SCSIManager.AddVirtualDisk( + scsiMount, err = coi.HostingSystem.SCSIManager.Add( ctx, - mount.Source, - readOnly, - &scsi.MountConfig{Options: mount.Options}, + &scsi.AttachConfig{Path: mount.Source, ReadOnly: readOnly, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{ReadOnly: readOnly, Verity: scsi.ReadVerityInfo(ctx, mount.Source), Options: mount.Options}, ) case "extensible-virtual-disk": l.Debug("hcsshim::allocateWindowsResource Hot-adding ExtensibleVirtualDisk") - scsiMount, err = coi.HostingSystem.SCSIManager.AddExtensibleVirtualDisk( + evdType, path, err := scsi.ParseExtensibleVirtualDiskPath(mount.Source) + if err != nil { + return err + } + scsiMount, err = coi.HostingSystem.SCSIManager.Add( ctx, - mount.Source, - readOnly, - &scsi.MountConfig{}, + &scsi.AttachConfig{Path: path, ReadOnly: readOnly, Type: scsi.AttachmentTypeExtensibleVirtualDisk, EVDType: evdType}, + &scsi.MountConfig{ReadOnly: readOnly}, ) } if err != nil { diff --git a/internal/layers/layers.go b/internal/layers/layers.go index de2039db7a..81f4d66c4e 100644 --- a/internal/layers/layers.go +++ b/internal/layers/layers.go @@ -110,11 +110,10 @@ func MountLCOWLayers(ctx context.Context, containerID string, layerFolders []str if err := wclayer.GrantVmAccess(ctx, vm.ID(), hostPath); err != nil { return "", "", nil, err } - scsiMount, err := vm.SCSIManager.AddVirtualDisk( + scsiMount, err := vm.SCSIManager.Add( ctx, - hostPath, - false, - &scsi.MountConfig{Encrypted: vm.ScratchEncryptionEnabled()}, + &scsi.AttachConfig{Path: hostPath, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{Encrypted: vm.ScratchEncryptionEnabled(), Verity: scsi.ReadVerityInfo(ctx, hostPath)}, ) if err != nil { return "", "", nil, fmt.Errorf("failed to add SCSI scratch VHD: %s", err) @@ -342,7 +341,11 @@ func mountWCOWIsolatedLayers(ctx context.Context, containerID string, layerFolde if err := wclayer.GrantVmAccess(ctx, vm.ID(), hostPath); err != nil { return "", nil, err } - scsiMount, err := vm.SCSIManager.AddVirtualDisk(ctx, hostPath, false, &scsi.MountConfig{}) + scsiMount, err := vm.SCSIManager.Add( + ctx, + &scsi.AttachConfig{Path: hostPath, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{Verity: scsi.ReadVerityInfo(ctx, hostPath)}, + ) if err != nil { return "", nil, fmt.Errorf("failed to add SCSI scratch VHD: %s", err) } @@ -394,7 +397,11 @@ func addLCOWLayer(ctx context.Context, vm *uvm.UtilityVM, layerPath string) (uvm } } - sm, err := vm.SCSIManager.AddVirtualDisk(ctx, layerPath, true, &scsi.MountConfig{Options: []string{"ro"}}) + sm, err := vm.SCSIManager.Add( + ctx, + &scsi.AttachConfig{Path: layerPath, ReadOnly: true, Type: scsi.AttachmentTypeVirtualDisk}, + &scsi.MountConfig{ReadOnly: true, Verity: scsi.ReadVerityInfo(ctx, layerPath), Options: []string{"ro"}}, + ) if err != nil { return "", nil, fmt.Errorf("failed to add SCSI layer: %s", err) } diff --git a/internal/uvm/scsi/attach.go b/internal/uvm/scsi/attach.go index 9375ff754e..7e89b2e3df 100644 --- a/internal/uvm/scsi/attach.go +++ b/internal/uvm/scsi/attach.go @@ -39,20 +39,28 @@ func newAttachManager(attacher Attacher, unplugger Unplugger, numControllers, nu type attachment struct { controller uint lun uint - config *attachConfig + config *AttachConfig waitErr error waitCh chan struct{} refCount uint } -type attachConfig struct { - path string - readOnly bool - typ string - evdType string +type AttachConfig struct { + Path string + ReadOnly bool + Type AttachmentType + EVDType string // Only valid if Type is AttachmentTypeExtensibleVirtualDisk. } -func (am *attachManager) attach(ctx context.Context, c *attachConfig) (controller uint, lun uint, err error) { +type AttachmentType string + +const ( + AttachmentTypeVirtualDisk AttachmentType = "VirtualDisk" + AttachmentTypePassThru AttachmentType = "PassThru" + AttachmentTypeExtensibleVirtualDisk AttachmentType = "ExtensibleVirtualDisk" +) + +func (am *attachManager) attach(ctx context.Context, c *AttachConfig) (controller uint, lun uint, err error) { att, existed, err := am.trackAttachment(c) if err != nil { return 0, 0, err @@ -77,7 +85,7 @@ func (am *attachManager) attach(ctx context.Context, c *attachConfig) (controlle }() if err := am.attacher.attach(ctx, att.controller, att.lun, att.config); err != nil { - return 0, 0, fmt.Errorf("attach %s/%s at controller %d lun %d: %w", att.config.typ, att.config.path, att.controller, att.lun, err) + return 0, 0, fmt.Errorf("attach %s/%s at controller %d lun %d: %w", att.config.Type, att.config.Path, att.controller, att.lun, err) } return att.controller, att.lun, nil } @@ -108,7 +116,7 @@ func (am *attachManager) detach(ctx context.Context, controller, lun uint) (bool return true, nil } -func (am *attachManager) trackAttachment(c *attachConfig) (*attachment, bool, error) { +func (am *attachManager) trackAttachment(c *AttachConfig) (*attachment, bool, error) { am.m.Lock() defer am.m.Unlock() diff --git a/internal/uvm/scsi/backend.go b/internal/uvm/scsi/backend.go index 3f387b1ee1..787023c5a3 100644 --- a/internal/uvm/scsi/backend.go +++ b/internal/uvm/scsi/backend.go @@ -19,14 +19,14 @@ import ( // Attacher provides the low-level operations for attaching a SCSI device to a VM. type Attacher interface { - attach(ctx context.Context, controller, lun uint, config *attachConfig) error + attach(ctx context.Context, controller, lun uint, config *AttachConfig) error detach(ctx context.Context, controller, lun uint) error } // Mounter provides the low-level operations for mounting a SCSI device inside the guest OS. type Mounter interface { - mount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error - unmount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error + mount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error + unmount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error } // Unplugger provides the low-level operations for cleanly removing a SCSI device inside the guest OS. @@ -45,14 +45,14 @@ func NewHCSAttacher(system *hcs.System) Attacher { return &hcsAttacher{system} } -func (ha *hcsAttacher) attach(ctx context.Context, controller, lun uint, config *attachConfig) error { +func (ha *hcsAttacher) attach(ctx context.Context, controller, lun uint, config *AttachConfig) error { req := &hcsschema.ModifySettingRequest{ RequestType: guestrequest.RequestTypeAdd, Settings: hcsschema.Attachment{ - Path: config.path, - Type_: config.typ, - ReadOnly: config.readOnly, - ExtensibleVirtualDiskType: config.evdType, + Path: config.Path, + Type_: config.Type, + ReadOnly: config.ReadOnly, + ExtensibleVirtualDiskType: config.EVDType, }, ResourcePath: fmt.Sprintf(resourcepaths.SCSIResourceFormat, guestrequest.ScsiControllerGuids[controller], lun), } @@ -81,7 +81,7 @@ func NewBridgeMounter(gc *gcs.GuestConnection, osType string) Mounter { return &bridgeMounter{gc, osType} } -func (bm *bridgeMounter) mount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error { +func (bm *bridgeMounter) mount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error { req, err := mountRequest(controller, lun, path, config, bm.osType) if err != nil { return err @@ -89,7 +89,7 @@ func (bm *bridgeMounter) mount(ctx context.Context, controller, lun uint, path s return bm.gc.Modify(ctx, req) } -func (bm *bridgeMounter) unmount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error { +func (bm *bridgeMounter) unmount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error { req, err := unmountRequest(controller, lun, path, config, bm.osType) if err != nil { return err @@ -111,7 +111,7 @@ func NewHCSMounter(system *hcs.System, osType string) Mounter { return &hcsMounter{system, osType} } -func (hm *hcsMounter) mount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error { +func (hm *hcsMounter) mount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error { req, err := mountRequest(controller, lun, path, config, hm.osType) if err != nil { return err @@ -119,7 +119,7 @@ func (hm *hcsMounter) mount(ctx context.Context, controller, lun uint, path stri return hm.system.Modify(ctx, &hcsschema.ModifySettingRequest{GuestRequest: req}) } -func (hm *hcsMounter) unmount(ctx context.Context, controller, lun uint, path string, config *mountConfig) error { +func (hm *hcsMounter) unmount(ctx context.Context, controller, lun uint, path string, config *MountConfig) error { req, err := unmountRequest(controller, lun, path, config, hm.osType) if err != nil { return err @@ -177,7 +177,7 @@ func (hu *hcsUnplugger) unplug(ctx context.Context, controller, lun uint) error return hu.system.Modify(ctx, &hcsschema.ModifySettingRequest{GuestRequest: req}) } -func mountRequest(controller, lun uint, path string, config *mountConfig, osType string) (guestrequest.ModificationRequest, error) { +func mountRequest(controller, lun uint, path string, config *MountConfig, osType string) (guestrequest.ModificationRequest, error) { req := guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeMappedVirtualDisk, RequestType: guestrequest.RequestTypeAdd, @@ -188,7 +188,7 @@ func mountRequest(controller, lun uint, path string, config *mountConfig, osType if controller != 0 { return guestrequest.ModificationRequest{}, errors.New("WCOW only supports SCSI controller 0") } - if config.encrypted || config.verity != nil || len(config.options) != 0 { + if config.Encrypted || config.Verity != nil || len(config.Options) != 0 { return guestrequest.ModificationRequest{}, errors.New("WCOW does not support encrypted, verity, or guest options on mounts") } req.Settings = guestresource.WCOWMappedVirtualDisk{ @@ -200,10 +200,10 @@ func mountRequest(controller, lun uint, path string, config *mountConfig, osType MountPath: path, Controller: uint8(controller), Lun: uint8(lun), - ReadOnly: config.readOnly, - Encrypted: config.encrypted, - Options: config.options, - VerityInfo: config.verity, + ReadOnly: config.ReadOnly, + Encrypted: config.Encrypted, + Options: config.Options, + VerityInfo: config.Verity, } default: return guestrequest.ModificationRequest{}, fmt.Errorf("unsupported os type: %s", osType) @@ -211,7 +211,7 @@ func mountRequest(controller, lun uint, path string, config *mountConfig, osType return req, nil } -func unmountRequest(controller, lun uint, path string, config *mountConfig, osType string) (guestrequest.ModificationRequest, error) { +func unmountRequest(controller, lun uint, path string, config *MountConfig, osType string) (guestrequest.ModificationRequest, error) { req := guestrequest.ModificationRequest{ ResourceType: guestresource.ResourceTypeMappedVirtualDisk, RequestType: guestrequest.RequestTypeRemove, @@ -227,7 +227,7 @@ func unmountRequest(controller, lun uint, path string, config *mountConfig, osTy MountPath: path, Lun: uint8(lun), Controller: uint8(controller), - VerityInfo: config.verity, + VerityInfo: config.Verity, } default: return guestrequest.ModificationRequest{}, fmt.Errorf("unsupported os type: %s", osType) diff --git a/internal/uvm/scsi/manager.go b/internal/uvm/scsi/manager.go index 4c62597750..cfd0c1349c 100644 --- a/internal/uvm/scsi/manager.go +++ b/internal/uvm/scsi/manager.go @@ -60,13 +60,6 @@ func NewManager( return &Manager{am, mm} } -// MountConfig specifies the options to apply for mounting a SCSI device in -// the guest OS. -type MountConfig struct { - Encrypted bool - Options []string -} - // Mount represents a SCSI device that has been attached to a VM, and potentially // also mounted into the guest OS. type Mount struct { @@ -105,123 +98,10 @@ func (m *Mount) Release(ctx context.Context) (err error) { return } -// AddVirtualDisk attaches and mounts a VHD on the host to the VM. If the same -// VHD has already been attached to the VM, the existing attachment will -// be reused. If the same VHD has already been mounted in the guest OS -// with the same MountConfig, the same mount will be reused. -// -// vmAccess determines what ACL to apply to the physical disk before it is attached. -// If nil, no ACL is applied. -// -// mc determines the settings to apply on the guest OS mount. If -// it is nil, no guest OS mount is performed. -func (m *Manager) AddVirtualDisk( - ctx context.Context, - hostPath string, - readOnly bool, - mc *MountConfig, -) (*Mount, error) { +func (m *Manager) Add(ctx context.Context, attachConfig *AttachConfig, mountConfig *MountConfig) (_ *Mount, err error) { if m == nil { return nil, ErrNotInitialized } - var mcInternal *mountConfig - if mc != nil { - mcInternal = &mountConfig{ - readOnly: readOnly, - encrypted: mc.Encrypted, - options: mc.Options, - verity: readVerityInfo(ctx, hostPath), - } - } - return m.add(ctx, - &attachConfig{ - path: hostPath, - readOnly: readOnly, - typ: "VirtualDisk", - }, - mcInternal) -} - -// AddPhysicalDisk attaches and mounts a physical disk on the host to the VM. -// If the same physical disk has already been attached to the VM, the existing -// attachment will be reused. If the same physical disk has already been mounted -// in the guest OS with the same MountConfig, the same mount will be reused. -// -// vmAccess determines what ACL to apply to the physical disk before it is attached. -// If nil, no ACL is applied. -// -// mc determines the settings to apply on the guest OS mount. If -// it is nil, no guest OS mount is performed. -func (m *Manager) AddPhysicalDisk( - ctx context.Context, - hostPath string, - readOnly bool, - mc *MountConfig, -) (*Mount, error) { - if m == nil { - return nil, ErrNotInitialized - } - var mcInternal *mountConfig - if mc != nil { - mcInternal = &mountConfig{ - readOnly: readOnly, - encrypted: mc.Encrypted, - options: mc.Options, - verity: readVerityInfo(ctx, hostPath), - } - } - return m.add(ctx, - &attachConfig{ - path: hostPath, - readOnly: readOnly, - typ: "PassThru", - }, - mcInternal) -} - -// AddExtensibleVirtualDisk attaches and mounts an extensible virtual disk (EVD) to the VM. -// EVDs are made available by special drivers on the host which interact with the Hyper-V -// synthetic SCSI stack. -// If the same physical disk has already been attached to the VM, the existing -// attachment will be reused. If the same physical disk has already been mounted -// in the guest OS with the same MountConfig, the same mount will be reused. -// -// hostPath must adhere to the format "evd:///". -// -// mc determines the settings to apply on the guest OS mount. If -// it is nil, no guest OS mount is performed. -func (m *Manager) AddExtensibleVirtualDisk( - ctx context.Context, - hostPath string, - readOnly bool, - mc *MountConfig, -) (*Mount, error) { - if m == nil { - return nil, ErrNotInitialized - } - evdType, mountPath, err := parseExtensibleVirtualDiskPath(hostPath) - if err != nil { - return nil, err - } - var mcInternal *mountConfig - if mc != nil { - mcInternal = &mountConfig{ - readOnly: readOnly, - encrypted: mc.Encrypted, - options: mc.Options, - } - } - return m.add(ctx, - &attachConfig{ - path: mountPath, - readOnly: readOnly, - typ: "ExtensibleVirtualDisk", - evdType: evdType, - }, - mcInternal) -} - -func (m *Manager) add(ctx context.Context, attachConfig *attachConfig, mountConfig *mountConfig) (_ *Mount, err error) { controller, lun, err := m.attachManager.attach(ctx, attachConfig) if err != nil { return nil, err @@ -262,7 +142,7 @@ func (m *Manager) remove(ctx context.Context, controller, lun uint, guestPath st return nil } -func readVerityInfo(ctx context.Context, path string) *guestresource.DeviceVerityInfo { +func ReadVerityInfo(ctx context.Context, path string) *guestresource.DeviceVerityInfo { if v, iErr := verity.ReadVeritySuperBlock(ctx, path); iErr != nil { log.G(ctx).WithError(iErr).WithField("hostPath", path).Debug("unable to read dm-verity information from VHD") } else { @@ -277,10 +157,10 @@ func readVerityInfo(ctx context.Context, path string) *guestresource.DeviceVerit return nil } -// parseExtensibleVirtualDiskPath parses the evd path provided in the config. +// ParseExtensibleVirtualDiskPath parses the evd path provided in the config. // extensible virtual disk path has format "evd:///" // this function parses that and returns the `evdType` and `evd-mount-path`. -func parseExtensibleVirtualDiskPath(hostPath string) (evdType, mountPath string, err error) { +func ParseExtensibleVirtualDiskPath(hostPath string) (evdType, mountPath string, err error) { trimmedPath := strings.TrimPrefix(hostPath, "evd://") separatorIndex := strings.Index(trimmedPath, "/") if separatorIndex <= 0 { diff --git a/internal/uvm/scsi/mount.go b/internal/uvm/scsi/mount.go index 72fbb93677..f9410bce0e 100644 --- a/internal/uvm/scsi/mount.go +++ b/internal/uvm/scsi/mount.go @@ -30,24 +30,26 @@ type mount struct { index int controller uint lun uint - config *mountConfig + config *MountConfig waitErr error waitCh chan struct{} refCount uint } -type mountConfig struct { - readOnly bool - encrypted bool - verity *guestresource.DeviceVerityInfo - options []string +// MountConfig specifies the options to apply for mounting a SCSI device in +// the guest OS. +type MountConfig struct { + ReadOnly bool + Encrypted bool + Verity *guestresource.DeviceVerityInfo + Options []string } -func mountConfigEquals(a, b *mountConfig) bool { - return a.readOnly == b.readOnly && - a.encrypted == b.encrypted && - *a.verity == *b.verity && - strSliceEquals(a.options, b.options) +func mountConfigEquals(a, b *MountConfig) bool { + return a.ReadOnly == b.ReadOnly && + a.Encrypted == b.Encrypted && + *a.Verity == *b.Verity && + strSliceEquals(a.Options, b.Options) } func strSliceEquals(a, b []string) bool { @@ -65,12 +67,12 @@ func strSliceEquals(a, b []string) bool { return true } -func (mm *mountManager) mount(ctx context.Context, controller, lun uint, c *mountConfig) (_ string, err error) { +func (mm *mountManager) mount(ctx context.Context, controller, lun uint, c *MountConfig) (_ string, err error) { // Normalize the mount config for comparison. // Config equality relies on the options slices being compared element-wise. Sort the options // slice first so that two slices with different ordering compare as equal. We assume that // order will never matter for mount options. - sort.Strings(c.options) + sort.Strings(c.Options) mount, existed := mm.trackMount(controller, lun, c) if existed { @@ -122,7 +124,7 @@ func (mm *mountManager) unmount(ctx context.Context, path string) (bool, error) return true, nil } -func (mm *mountManager) trackMount(controller, lun uint, c *mountConfig) (*mount, bool) { +func (mm *mountManager) trackMount(controller, lun uint, c *MountConfig) (*mount, bool) { mm.m.Lock() defer mm.m.Unlock()