Change:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! If the matter is security related, please disclose it privately via --What happened: When a PVC is created and the PV mounted into a Pod using the StorageOS in-tree volume driver, the StorageOS CLI & UI do not report that the volume is mounted. The PV is created and mounted into the Pod successfully, and all k8s functionality works as expected. However, since the correct mount status is not visible to administrators using the StorageOS UI or CLI, they may make changes to or delete a mounted volume without realising, and the safeguards (must use to delete a mounted volume) do not trigger. This is a regression caused by , released in 1.14.0. What you expected to happen: The StorageOS CLI should report volume mount information (node name, mount timestamp). How to reproduce it (as minimally and precisely as possible): StorageOS node containers with CSI disabled: application Pod with a PVC using the StorageOS StorageClass: StorageOS to list volumes: Anything else we need to know?: Environment: Kubernetes version (use ): 1.14.0 and later Cloud provider or hardware configuration: any OS (e.g: ): any linux (incl. Ubuntu 18.04) Kernel (e.g. ): any linux (incl. 4.15.0-33-generic) Install tools: any (incl. minikube) Network plugin and version (if this is a network-related bug): N/A Others: Requires StorageOS deployment /sig storage /assign

Discussion:
apiPass:    defaultAPIPassword, apiVersion: defaultAPIVersion, } <del> klog.V(4).Infof("Using default StorageOS API settings: addr %s, version: %s", apiCfg.apiAddr, defaultAPIVersion) </del> <ins> klog.V(4).Infof("using default StorageOS API settings: addr %s, version: %s", apiCfg.apiAddr, defaultAPIVersion) </ins> } api, err := storageosapi.NewVersionedClient(apiCfg.apiAddr, defaultAPIVersion)

// Creates a new StorageOS volume and makes it available as a device within // /var/lib/storageos/volumes. func (u *storageosUtil) CreateVolume(p *storageosProvisioner) (*storageosVolume, error) { <ins> klog.V(4).Infof("creating StorageOS volume %q with namespace %q", p.volName, p.volNamespace) </ins> if err := u.NewAPI(p.apiCfg); err != nil { return nil, err }

// or a file device.  Block devices can be used directly, but file devices must // be made accessible as a block device before using. func (u *storageosUtil) AttachVolume(b *storageosMounter) (string, error) { <ins> klog.V(4).Infof("attaching StorageOS volume %q with namespace %q", b.volName, b.volNamespace) </ins> if err := u.NewAPI(b.apiCfg); err != nil { return "", err }

return "", err } <del> // Clear any existing mount reference from the API.  These may be leftover // from previous mounts where the unmount operation couldn't get access to // the API credentials. if vol.Mounted { opts := storageostypes.VolumeUnmountOptions{ Name:      vol.Name, Namespace: vol.Namespace, } if err := u.api.VolumeUnmount(opts); err != nil { klog.Warningf("Couldn't clear existing StorageOS mount reference: %v", err) } } </del> srcPath := filepath.Join(b.deviceDir, vol.ID) dt, err := pathDeviceType(srcPath) if err != nil {

// Detach detaches a volume from the host.  This is only needed when NBD is not // enabled and loop devices are used to simulate a block device. func (u *storageosUtil) DetachVolume(b *storageosUnmounter, devicePath string) error { <ins> klog.V(4).Infof("detaching StorageOS volume %q with namespace %q", b.volName, b.volNamespace) </ins> if !isLoopDevice(devicePath) { return nil }

// AttachDevice attaches the volume device to the host at a given mount path. func (u *storageosUtil) AttachDevice(b *storageosMounter, deviceMountPath string) error { <ins> klog.V(4).Infof("attaching StorageOS device for volume %q with namespace %q", b.volName, b.volNamespace) </ins> if err := u.NewAPI(b.apiCfg); err != nil { return err }

// Mount mounts the volume on the host. func (u *storageosUtil) MountVolume(b *storageosMounter, mntDevice, deviceMountPath string) error { <ins> klog.V(4).Infof("mounting StorageOS volume %q with namespace %q", b.volName, b.volNamespace) </ins> notMnt, err := b.mounter.IsLikelyNotMountPoint(deviceMountPath) if err != nil { if os.IsNotExist(err) {

// Unmount removes the mount reference from the volume allowing it to be // re-mounted elsewhere. func (u *storageosUtil) UnmountVolume(b *storageosUnmounter) error { <ins> klog.V(4).Infof("clearing StorageOS mount reference for volume %q with namespace %q", b.volName, b.volNamespace) </ins> if err := u.NewAPI(b.apiCfg); err != nil { // We can't always get the config we need, so allow the unmount to // succeed even if we can't remove the mount reference from the API. <del> klog.V(4).Infof("Could not remove mount reference in the StorageOS API as no credentials available to the unmount operation") </del> <ins> klog.Warningf("could not remove mount reference in the StorageOS API as no credentials available to the unmount operation") </ins> return nil }