mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-01-31 00:59:30 +00:00
cleanup: rename csiID
to driverInstance
The attribute and variable `csiID` ise used for at least two different things: - name of the driver instance, used for journalling metadata - objects of the CSIIdentifier struct, composing a volume-handle By changing the name of the `csiID` attribute for driver instances to `driverInstance`, any confusion should be prevented. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
parent
af0a223edb
commit
ecd15970de
@ -32,13 +32,13 @@ import (
|
||||
|
||||
type EncryptionKeyRotationServer struct {
|
||||
*ekr.UnimplementedEncryptionKeyRotationControllerServer
|
||||
driver string
|
||||
driverInstance string
|
||||
volLock *util.VolumeLocks
|
||||
}
|
||||
|
||||
func NewEncryptionKeyRotationServer(driver string, volLock *util.VolumeLocks) *EncryptionKeyRotationServer {
|
||||
func NewEncryptionKeyRotationServer(driverInstance string, volLock *util.VolumeLocks) *EncryptionKeyRotationServer {
|
||||
return &EncryptionKeyRotationServer{
|
||||
driver: driver,
|
||||
driverInstance: driverInstance,
|
||||
volLock: volLock,
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ func (ekrs *EncryptionKeyRotationServer) EncryptionKeyRotate(
|
||||
}
|
||||
defer ekrs.volLock.Release(volID)
|
||||
|
||||
mgr := rbd.NewManager(ekrs.driver, nil, req.GetSecrets())
|
||||
mgr := rbd.NewManager(ekrs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volID)
|
||||
|
@ -38,15 +38,18 @@ import (
|
||||
type ReclaimSpaceControllerServer struct {
|
||||
*rs.UnimplementedReclaimSpaceControllerServer
|
||||
|
||||
driver string
|
||||
driverInstance string
|
||||
volumeLocks *util.VolumeLocks
|
||||
}
|
||||
|
||||
// NewReclaimSpaceControllerServer creates a new ReclaimSpaceControllerServer which handles
|
||||
// the ReclaimSpace Service requests from the CSI-Addons specification.
|
||||
func NewReclaimSpaceControllerServer(driver string, volumeLocks *util.VolumeLocks) *ReclaimSpaceControllerServer {
|
||||
func NewReclaimSpaceControllerServer(
|
||||
driverInstance string,
|
||||
volumeLocks *util.VolumeLocks,
|
||||
) *ReclaimSpaceControllerServer {
|
||||
return &ReclaimSpaceControllerServer{
|
||||
driver: driver,
|
||||
driverInstance: driverInstance,
|
||||
volumeLocks: volumeLocks,
|
||||
}
|
||||
}
|
||||
@ -71,7 +74,7 @@ func (rscs *ReclaimSpaceControllerServer) ControllerReclaimSpace(
|
||||
}
|
||||
defer rscs.volumeLocks.Release(volumeID)
|
||||
|
||||
mgr := rbdutil.NewManager(rscs.driver, nil, req.GetSecrets())
|
||||
mgr := rbdutil.NewManager(rscs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
|
@ -95,8 +95,8 @@ type ReplicationServer struct {
|
||||
*replication.UnimplementedControllerServer
|
||||
// Embed ControllerServer as it implements helper functions
|
||||
*corerbd.ControllerServer
|
||||
// csiID is the unique ID for this CSI-driver deployment.
|
||||
csiID string
|
||||
// driverInstance is the unique ID for this CSI-driver deployment.
|
||||
driverInstance string
|
||||
}
|
||||
|
||||
// NewReplicationServer creates a new ReplicationServer which handles
|
||||
@ -104,7 +104,7 @@ type ReplicationServer struct {
|
||||
func NewReplicationServer(instanceID string, c *corerbd.ControllerServer) *ReplicationServer {
|
||||
return &ReplicationServer{
|
||||
ControllerServer: c,
|
||||
csiID: instanceID,
|
||||
driverInstance: instanceID,
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ func (rs *ReplicationServer) EnableVolumeReplication(ctx context.Context,
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
|
||||
mgr := rbd.NewManager(rs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
@ -347,7 +347,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context,
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
|
||||
mgr := rbd.NewManager(rs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
@ -415,7 +415,7 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
|
||||
mgr := rbd.NewManager(rs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
@ -508,7 +508,7 @@ func (rs *ReplicationServer) DemoteVolume(ctx context.Context,
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
|
||||
mgr := rbd.NewManager(rs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
@ -618,7 +618,7 @@ func (rs *ReplicationServer) ResyncVolume(ctx context.Context,
|
||||
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID)
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
mgr := rbd.NewManager(rs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
@ -827,7 +827,7 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
|
||||
return nil, status.Errorf(codes.Aborted, util.VolumeOperationAlreadyExistsFmt, volumeID)
|
||||
}
|
||||
defer rs.VolumeLocks.Release(volumeID)
|
||||
mgr := rbd.NewManager(rs.csiID, nil, req.GetSecrets())
|
||||
mgr := rbd.NewManager(rs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
rbdVol, err := mgr.GetVolumeByID(ctx, volumeID)
|
||||
|
@ -41,15 +41,15 @@ type VolumeGroupServer struct {
|
||||
// don't need to add all RPC methods leading to forward compatibility.
|
||||
*volumegroup.UnimplementedControllerServer
|
||||
|
||||
// csiID is the unique ID for this CSI-driver deployment.
|
||||
csiID string
|
||||
// driverInstance is the unique ID for this CSI-driver deployment.
|
||||
driverInstance string
|
||||
}
|
||||
|
||||
// NewVolumeGroupServer creates a new VolumeGroupServer which handles the
|
||||
// VolumeGroup Service requests from the CSI-Addons specification.
|
||||
func NewVolumeGroupServer(instanceID string) *VolumeGroupServer {
|
||||
return &VolumeGroupServer{
|
||||
csiID: instanceID,
|
||||
driverInstance: instanceID,
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ func (vs *VolumeGroupServer) CreateVolumeGroup(
|
||||
ctx context.Context,
|
||||
req *volumegroup.CreateVolumeGroupRequest,
|
||||
) (*volumegroup.CreateVolumeGroupResponse, error) {
|
||||
mgr := rbd.NewManager(vs.csiID, req.GetParameters(), req.GetSecrets())
|
||||
mgr := rbd.NewManager(vs.driverInstance, req.GetParameters(), req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
// resolve all volumes
|
||||
@ -188,7 +188,7 @@ func (vs *VolumeGroupServer) DeleteVolumeGroup(
|
||||
ctx context.Context,
|
||||
req *volumegroup.DeleteVolumeGroupRequest,
|
||||
) (*volumegroup.DeleteVolumeGroupResponse, error) {
|
||||
mgr := rbd.NewManager(vs.csiID, nil, req.GetSecrets())
|
||||
mgr := rbd.NewManager(vs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
// resolve the volume group
|
||||
@ -285,7 +285,7 @@ func (vs *VolumeGroupServer) ModifyVolumeGroupMembership(
|
||||
ctx context.Context,
|
||||
req *volumegroup.ModifyVolumeGroupMembershipRequest,
|
||||
) (*volumegroup.ModifyVolumeGroupMembershipResponse, error) {
|
||||
mgr := rbd.NewManager(vs.csiID, nil, req.GetSecrets())
|
||||
mgr := rbd.NewManager(vs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
// resolve the volume group
|
||||
@ -427,7 +427,7 @@ func (vs *VolumeGroupServer) ControllerGetVolumeGroup(
|
||||
ctx context.Context,
|
||||
req *volumegroup.ControllerGetVolumeGroupRequest,
|
||||
) (*volumegroup.ControllerGetVolumeGroupResponse, error) {
|
||||
mgr := rbd.NewManager(vs.csiID, nil, req.GetSecrets())
|
||||
mgr := rbd.NewManager(vs.driverInstance, nil, req.GetSecrets())
|
||||
defer mgr.Destroy(ctx)
|
||||
|
||||
// resolve the volume group
|
||||
|
@ -31,8 +31,8 @@ import (
|
||||
var _ types.Manager = &rbdManager{}
|
||||
|
||||
type rbdManager struct {
|
||||
// csiID is the instance id of the CSI-driver (driver name).
|
||||
csiID string
|
||||
// driverInstance is the instance id of the CSI-driver (driver name).
|
||||
driverInstance string
|
||||
// parameters can contain the parameters of a create request.
|
||||
parameters map[string]string
|
||||
// secrets contain the credentials to connect to the Ceph cluster.
|
||||
@ -46,9 +46,9 @@ type rbdManager struct {
|
||||
|
||||
// NewManager returns a new manager for handling Volume and Volume Group
|
||||
// operations, combining the requests for RBD and the journalling in RADOS.
|
||||
func NewManager(csiID string, parameters, secrets map[string]string) types.Manager {
|
||||
func NewManager(driverInstance string, parameters, secrets map[string]string) types.Manager {
|
||||
return &rbdManager{
|
||||
csiID: csiID,
|
||||
driverInstance: driverInstance,
|
||||
parameters: parameters,
|
||||
secrets: secrets,
|
||||
}
|
||||
@ -102,7 +102,7 @@ func (mgr *rbdManager) getVolumeGroupJournal(clusterID string) (journal.VolumeGr
|
||||
return nil, fmt.Errorf("failed to find the RADOS namespace for cluster %q: %w", clusterID, err)
|
||||
}
|
||||
|
||||
vgJournalConfig := journal.NewCSIVolumeGroupJournalWithNamespace(mgr.csiID, ns)
|
||||
vgJournalConfig := journal.NewCSIVolumeGroupJournalWithNamespace(mgr.driverInstance, ns)
|
||||
|
||||
vgJournal, err := vgJournalConfig.Connect(monitors, ns, creds)
|
||||
if err != nil {
|
||||
@ -221,7 +221,7 @@ func (mgr *rbdManager) GetVolumeGroupByID(ctx context.Context, id string) (types
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vg, err := rbd_group.GetVolumeGroup(ctx, id, mgr.csiID, creds, mgr)
|
||||
vg, err := rbd_group.GetVolumeGroup(ctx, id, mgr.driverInstance, creds, mgr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get volume group with id %q: %w", id, err)
|
||||
}
|
||||
@ -302,7 +302,7 @@ func (mgr *rbdManager) CreateVolumeGroup(ctx context.Context, name string) (type
|
||||
return nil, fmt.Errorf("failed to generate a unique CSI volume group with uuid for %q: %w", uuid, err)
|
||||
}
|
||||
|
||||
vg, err := rbd_group.GetVolumeGroup(ctx, csiID, mgr.csiID, creds, mgr)
|
||||
vg, err := rbd_group.GetVolumeGroup(ctx, csiID, mgr.driverInstance, creds, mgr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get volume group %q at cluster %q: %w", name, clusterID, err)
|
||||
}
|
||||
@ -329,7 +329,7 @@ func (mgr *rbdManager) GetVolumeGroupSnapshotByID(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, id, mgr.csiID, creds, mgr)
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, id, mgr.driverInstance, creds, mgr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get volume group with id %q: %w", id, err)
|
||||
}
|
||||
@ -382,7 +382,7 @@ func (mgr *rbdManager) GetVolumeGroupSnapshotByName(
|
||||
return nil, fmt.Errorf("failed to generate a unique CSI volume group with uuid %q: %w", uuid, err)
|
||||
}
|
||||
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, csiID, mgr.csiID, mgr.creds, mgr)
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, csiID, mgr.driverInstance, mgr.creds, mgr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get existing volume group snapshot with uuid %q: %w", uuid, err)
|
||||
}
|
||||
@ -445,7 +445,7 @@ func (mgr *rbdManager) CreateVolumeGroupSnapshot(
|
||||
return nil, fmt.Errorf("failed to generate a unique CSI volume group with uuid for %q: %w", uuid, err)
|
||||
}
|
||||
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, groupID, mgr.csiID, mgr.creds, mgr)
|
||||
vgs, err := rbd_group.GetVolumeGroupSnapshot(ctx, groupID, mgr.driverInstance, mgr.creds, mgr)
|
||||
if vgs != nil {
|
||||
log.DebugLog(ctx, "found existing volume group snapshot %q for id %q", vgs, groupID)
|
||||
|
||||
@ -494,7 +494,7 @@ func (mgr *rbdManager) CreateVolumeGroupSnapshot(
|
||||
|
||||
log.DebugLog(ctx, "volume group snapshot %q contains %d snapshots: %v", name, len(snapshots), snapshots)
|
||||
|
||||
vgs, err = rbd_group.NewVolumeGroupSnapshot(ctx, groupID, mgr.csiID, mgr.creds, snapshots)
|
||||
vgs, err = rbd_group.NewVolumeGroupSnapshot(ctx, groupID, mgr.driverInstance, mgr.creds, snapshots)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create new volume group snapshot %q: %w", name, err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user