mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
@ -96,7 +96,7 @@ func createCephUser(volOptions *volumeOptions, adminCr *credentials, volID volum
|
||||
"osd", caps.Osd,
|
||||
}
|
||||
|
||||
if err := execCommandJson(&ents, "ceph", args[:]...); err != nil {
|
||||
if err := execCommandJSON(&ents, "ceph", args[:]...); err != nil {
|
||||
return nil, fmt.Errorf("error creating ceph user: %v", err)
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ func NewNodeServer(d *csicommon.CSIDriver) *nodeServer {
|
||||
}
|
||||
}
|
||||
|
||||
func (fs *driver) Run(driverName, nodeId, endpoint, volumeMounter string, cachePersister util.CachePersister) {
|
||||
func (fs *driver) Run(driverName, nodeID, endpoint, volumeMounter string, cachePersister util.CachePersister) {
|
||||
glog.Infof("Driver: %v version: %v", driverName, Version)
|
||||
|
||||
// Configuration
|
||||
@ -91,7 +91,7 @@ func (fs *driver) Run(driverName, nodeId, endpoint, volumeMounter string, cacheP
|
||||
|
||||
// Initialize default library driver
|
||||
|
||||
fs.cd = csicommon.NewCSIDriver(driverName, Version, nodeId)
|
||||
fs.cd = csicommon.NewCSIDriver(driverName, Version, nodeID)
|
||||
if fs.cd == nil {
|
||||
glog.Fatalln("Failed to initialize CSI driver")
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ func execCommandAndValidate(program string, args ...string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func execCommandJson(v interface{}, program string, args ...string) error {
|
||||
func execCommandJSON(v interface{}, program string, args ...string) error {
|
||||
out, err := execCommand(program, args...)
|
||||
|
||||
if err != nil {
|
||||
|
@ -55,7 +55,7 @@ func loadAvailableMounters() error {
|
||||
}
|
||||
|
||||
type volumeMounter interface {
|
||||
mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volId volumeID) error
|
||||
mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volID volumeID) error
|
||||
name() string
|
||||
}
|
||||
|
||||
@ -99,12 +99,12 @@ func newMounter(volOptions *volumeOptions) (volumeMounter, error) {
|
||||
|
||||
type fuseMounter struct{}
|
||||
|
||||
func mountFuse(mountPoint string, cr *credentials, volOptions *volumeOptions, volId volumeID) error {
|
||||
func mountFuse(mountPoint string, cr *credentials, volOptions *volumeOptions, volID volumeID) error {
|
||||
args := [...]string{
|
||||
mountPoint,
|
||||
"-c", getCephConfPath(volId),
|
||||
"-c", getCephConfPath(volID),
|
||||
"-n", cephEntityClientPrefix + cr.id,
|
||||
"--keyring", getCephKeyringPath(volId, cr.id),
|
||||
"--keyring", getCephKeyringPath(volID, cr.id),
|
||||
"-r", volOptions.RootPath,
|
||||
"-o", "nonempty",
|
||||
}
|
||||
@ -121,19 +121,19 @@ func mountFuse(mountPoint string, cr *credentials, volOptions *volumeOptions, vo
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *fuseMounter) mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volId volumeID) error {
|
||||
func (m *fuseMounter) mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volID volumeID) error {
|
||||
if err := createMountPoint(mountPoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return mountFuse(mountPoint, cr, volOptions, volId)
|
||||
return mountFuse(mountPoint, cr, volOptions, volID)
|
||||
}
|
||||
|
||||
func (m *fuseMounter) name() string { return "Ceph FUSE driver" }
|
||||
|
||||
type kernelMounter struct{}
|
||||
|
||||
func mountKernel(mountPoint string, cr *credentials, volOptions *volumeOptions, volId volumeID) error {
|
||||
func mountKernel(mountPoint string, cr *credentials, volOptions *volumeOptions, volID volumeID) error {
|
||||
if err := execCommandAndValidate("modprobe", "ceph"); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -143,16 +143,16 @@ func mountKernel(mountPoint string, cr *credentials, volOptions *volumeOptions,
|
||||
fmt.Sprintf("%s:%s", volOptions.Monitors, volOptions.RootPath),
|
||||
mountPoint,
|
||||
"-o",
|
||||
fmt.Sprintf("name=%s,secretfile=%s", cr.id, getCephSecretPath(volId, cr.id)),
|
||||
fmt.Sprintf("name=%s,secretfile=%s", cr.id, getCephSecretPath(volID, cr.id)),
|
||||
)
|
||||
}
|
||||
|
||||
func (m *kernelMounter) mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volId volumeID) error {
|
||||
func (m *kernelMounter) mount(mountPoint string, cr *credentials, volOptions *volumeOptions, volID volumeID) error {
|
||||
if err := createMountPoint(mountPoint); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return mountKernel(mountPoint, cr, volOptions, volId)
|
||||
return mountKernel(mountPoint, cr, volOptions, volID)
|
||||
}
|
||||
|
||||
func (m *kernelMounter) name() string { return "Ceph kernel client" }
|
||||
|
Reference in New Issue
Block a user