mirror of
https://github.com/kubernetes-csi/csi-driver-nvmf.git
synced 2025-05-31 10:25:06 +00:00
* fix: make multiple connections to one same nqn possible in a single node Multiple connections to one same nqn in a single node return -EALREADY error. So, we should use a hostnqn to make every connections seperate. It is appropriate to use a target path from a volume request as a hostnqn. * fix: make ro and rw mounts for one same nqn possible in a single node ReadOnly and ReadWrite mounts for one same nqn in a single node return -EBUSY error. So, we should remove readonly and readwrite options when mounting a block device in a csi driver. A cri runtime makes a mount as readonly inside containers if needed. * fix: add fallback supports for no hostnqn sysfs file supports Directories per each nqn will be created in /run/nvmf and files per each hostnqn will be created in /run/nvmf/{nqn}. If linux kernel has no hostnqn sysfs file supports, we will disconnect all connections for a nqn at once when a directory for the nqn is empty. * refactor: rename sysfs_nqn_path to sysfs_subsysnqn_path * refactor: use filepath.Join instead of strings.Join * fix: add explicitly UnsupportedHostnqnError for fallback supports If linux kernel has no hostnqn sysfs file supports, return UnsupportedHostnqnError and switch to fallback mode which will disconnect all connections at once when a last controller in a nqn is disconnected. * fix: return directly after fallback mode * fix: mount the host's /run/nvmf directory to csi-node-driver
37 lines
980 B
Go
37 lines
980 B
Go
/*
|
|
Copyright 2021 The Kubernetes Authors.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package nvmf
|
|
|
|
import "fmt"
|
|
|
|
type NoControllerError struct {
|
|
Nqn string
|
|
Hostnqn string
|
|
}
|
|
|
|
func (e *NoControllerError) Error() string {
|
|
return fmt.Sprintf("not found controller: nqn=%s, hostnqn=%s", e.Nqn, e.Hostnqn)
|
|
}
|
|
|
|
type UnsupportedHostnqnError struct {
|
|
Target string
|
|
}
|
|
|
|
func (e *UnsupportedHostnqnError) Error() string {
|
|
return fmt.Sprintf("unsupported hostnqn sysfs file: target=%s", e.Target)
|
|
}
|