mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
Merge branch 'csi-v1.0' into default_multiwrite_blockmode
This commit is contained in:
@ -19,19 +19,21 @@ package cephfs
|
||||
import (
|
||||
"k8s.io/klog"
|
||||
|
||||
"github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
"github.com/ceph/ceph-csi/pkg/util"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginFolder defines the location of ceph plugin
|
||||
PluginFolder = "/var/lib/kubelet/plugins/csi-cephfsplugin"
|
||||
|
||||
// version of ceph driver
|
||||
version = "1.0.0"
|
||||
)
|
||||
|
||||
// PluginFolder defines the location of ceph plugin
|
||||
var PluginFolder = "/var/lib/kubelet/plugins/"
|
||||
|
||||
// Driver contains the default identity,node and controller struct
|
||||
type Driver struct {
|
||||
cd *csicommon.CSIDriver
|
||||
|
@ -19,7 +19,7 @@ package cephfs
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
)
|
||||
|
@ -25,12 +25,15 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
cephRootPrefix = PluginFolder + "/controller/volumes/root-"
|
||||
cephVolumesRoot = "csi-volumes"
|
||||
|
||||
namespacePrefix = "ns-"
|
||||
)
|
||||
|
||||
var (
|
||||
cephRootPrefix = PluginFolder + "/controller/volumes/root-"
|
||||
)
|
||||
|
||||
func getCephRootPathLocal(volID volumeID) string {
|
||||
return cephRootPrefix + string(volID)
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ func parseVolCreateRequest(req *csi.CreateVolumeRequest) (*rbdVolume, error) {
|
||||
isMultiNode := false
|
||||
isBlock := false
|
||||
for _, cap := range req.VolumeCapabilities {
|
||||
// Only checking SINGLE_NODE_SINGLE_WRITER here because regardless of the other types (MULTI READER) we need to implement the same logic to ignore the in-use response
|
||||
if cap.GetAccessMode().GetMode() != csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER {
|
||||
// RO modes need to be handled indepedently (ie right now even if access mode is RO, they'll be RW upon attach)
|
||||
if cap.GetAccessMode().GetMode() == csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER {
|
||||
isMultiNode = true
|
||||
}
|
||||
if cap.GetBlock() != nil {
|
||||
|
@ -19,7 +19,7 @@ package rbd
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
)
|
||||
|
@ -78,8 +78,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis
|
||||
disableInUseChecks = true
|
||||
} else {
|
||||
klog.Warningf("MULTI_NODE_MULTI_WRITER currently only supported with volumes of access type `block`, invalid AccessMode for volume: %v", req.GetVolumeId())
|
||||
e := fmt.Errorf("rbd: MULTI_NODE_MULTI_WRITER access mode only allowed with BLOCK access type")
|
||||
return nil, status.Error(codes.InvalidArgument, e.Error())
|
||||
return nil, status.Error(codes.InvalidArgument, "rbd: RWX access mode request is only valid for volumes with access type `block`")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
package rbd
|
||||
|
||||
import (
|
||||
"github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
csicommon "github.com/ceph/ceph-csi/pkg/csi-common"
|
||||
"github.com/ceph/ceph-csi/pkg/util"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
@ -29,11 +29,13 @@ import (
|
||||
|
||||
// PluginFolder defines the location of rbdplugin
|
||||
const (
|
||||
PluginFolder = "/var/lib/kubelet/plugins/csi-rbdplugin"
|
||||
rbdDefaultAdminID = "admin"
|
||||
rbdDefaultUserID = rbdDefaultAdminID
|
||||
)
|
||||
|
||||
// PluginFolder defines the location of ceph plugin
|
||||
var PluginFolder = "/var/lib/kubelet/plugins/"
|
||||
|
||||
// Driver contains the default identity,node and controller struct
|
||||
type Driver struct {
|
||||
cd *csicommon.CSIDriver
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/klog"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
apierrs "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
k8s "k8s.io/client-go/kubernetes"
|
||||
|
@ -19,7 +19,10 @@ package util
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
@ -68,3 +71,23 @@ func CreatePersistanceStorage(sPath, metaDataStore, driverName string) (CachePer
|
||||
func createPersistentStorage(persistentStoragePath string) error {
|
||||
return os.MkdirAll(persistentStoragePath, os.FileMode(0755))
|
||||
}
|
||||
|
||||
// ValidateDriverName validates the driver name
|
||||
func ValidateDriverName(driverName string) error {
|
||||
if len(driverName) == 0 {
|
||||
return errors.New("driver name is empty")
|
||||
}
|
||||
|
||||
if len(driverName) > 63 {
|
||||
return errors.New("driver name length should be less than 63 chars")
|
||||
}
|
||||
var err error
|
||||
for _, msg := range validation.IsDNS1123Subdomain(strings.ToLower(driverName)) {
|
||||
if err == nil {
|
||||
err = errors.New(msg)
|
||||
continue
|
||||
}
|
||||
err = errors.Wrap(err, msg)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user