mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-04 04:00:21 +00:00
cephfs: support omap store in radosnamespace
This commit adds the support for storing the CephFS omap data in a namespace specified in the ceph-csi-config ConfigMap under cephFS.radosNamespace field. If the radosNamespace is not set, the default radosNamespace will be used i.e, csi. Signed-off-by: Praveen M <m.praveen@ibm.com>
This commit is contained in:
parent
c7f41cf84b
commit
86759d4653
@ -9,6 +9,7 @@
|
|||||||
- CSI metrics for sidecars are now exposed at `POD_IP`:`SIDECAR_ENDPOINT`/`metrics`
|
- CSI metrics for sidecars are now exposed at `POD_IP`:`SIDECAR_ENDPOINT`/`metrics`
|
||||||
path. Check sidecar container spec for `SIDECAR_ENDPOINT`
|
path. Check sidecar container spec for `SIDECAR_ENDPOINT`
|
||||||
value [PR](https://github.com/ceph/ceph-csi/pull/4887)
|
value [PR](https://github.com/ceph/ceph-csi/pull/4887)
|
||||||
|
- cephfs: support omap data store in radosnamespace [PR](https://github.com/ceph/ceph-csi/pull/4661)
|
||||||
- helm: Support setting nodepluigin and provisioner annotations
|
- helm: Support setting nodepluigin and provisioner annotations
|
||||||
|
|
||||||
## NOTE
|
## NOTE
|
||||||
|
@ -101,6 +101,7 @@ type SubVolume struct {
|
|||||||
VolID string // subvolume id.
|
VolID string // subvolume id.
|
||||||
FsName string // filesystem name.
|
FsName string // filesystem name.
|
||||||
SubvolumeGroup string // subvolume group name where subvolume will be created.
|
SubvolumeGroup string // subvolume group name where subvolume will be created.
|
||||||
|
RadosNamespace string // rados namespace where omap data will be stored.
|
||||||
Pool string // pool name where subvolume will be created.
|
Pool string // pool name where subvolume will be created.
|
||||||
Features []string // subvolume features.
|
Features []string // subvolume features.
|
||||||
Size int64 // subvolume size.
|
Size int64 // subvolume size.
|
||||||
|
@ -27,7 +27,6 @@ import (
|
|||||||
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
||||||
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
||||||
"github.com/ceph/ceph-csi/internal/cephfs/store"
|
"github.com/ceph/ceph-csi/internal/cephfs/store"
|
||||||
fsutil "github.com/ceph/ceph-csi/internal/cephfs/util"
|
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
|
|
||||||
@ -455,7 +454,7 @@ func (cs *ControllerServer) createSnapshotAndAddMapping(
|
|||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
j, err := store.VolumeGroupJournal.Connect(vgo.Monitors, fsutil.RadosNamespace, cr)
|
j, err := store.VolumeGroupJournal.Connect(vgo.Monitors, vgo.RadosNamespace, cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -637,7 +636,7 @@ func (cs *ControllerServer) deleteSnapshotsAndUndoReservation(ctx context.Contex
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
j, err := store.VolumeGroupJournal.Connect(vgo.Monitors, fsutil.RadosNamespace, cr)
|
j, err := store.VolumeGroupJournal.Connect(vgo.Monitors, vgo.RadosNamespace, cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,6 @@ package store
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
fsutil "github.com/ceph/ceph-csi/internal/cephfs/util"
|
|
||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
"github.com/ceph/ceph-csi/internal/util/reftracker"
|
"github.com/ceph/ceph-csi/internal/util/reftracker"
|
||||||
"github.com/ceph/ceph-csi/internal/util/reftracker/radoswrapper"
|
"github.com/ceph/ceph-csi/internal/util/reftracker/radoswrapper"
|
||||||
@ -45,7 +44,7 @@ func AddSnapshotBackedVolumeRef(
|
|||||||
}
|
}
|
||||||
defer ioctx.Destroy()
|
defer ioctx.Destroy()
|
||||||
|
|
||||||
ioctx.SetNamespace(fsutil.RadosNamespace)
|
ioctx.SetNamespace(volOptions.RadosNamespace)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
backingSnapID = volOptions.BackingSnapshotID
|
backingSnapID = volOptions.BackingSnapshotID
|
||||||
@ -90,7 +89,7 @@ func AddSnapshotBackedVolumeRef(
|
|||||||
|
|
||||||
if created && !deleted {
|
if created && !deleted {
|
||||||
log.ErrorLog(ctx, "orphaned reftracker object %s (pool %s, namespace %s)",
|
log.ErrorLog(ctx, "orphaned reftracker object %s (pool %s, namespace %s)",
|
||||||
backingSnapID, volOptions.MetadataPool, fsutil.RadosNamespace)
|
backingSnapID, volOptions.MetadataPool, volOptions.RadosNamespace)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -118,7 +117,7 @@ func UnrefSnapshotBackedVolume(
|
|||||||
}
|
}
|
||||||
defer ioctx.Destroy()
|
defer ioctx.Destroy()
|
||||||
|
|
||||||
ioctx.SetNamespace(fsutil.RadosNamespace)
|
ioctx.SetNamespace(volOptions.RadosNamespace)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
backingSnapID = volOptions.BackingSnapshotID
|
backingSnapID = volOptions.BackingSnapshotID
|
||||||
@ -159,7 +158,7 @@ func UnrefSelfInSnapshotBackedVolumes(
|
|||||||
}
|
}
|
||||||
defer ioctx.Destroy()
|
defer ioctx.Destroy()
|
||||||
|
|
||||||
ioctx.SetNamespace(fsutil.RadosNamespace)
|
ioctx.SetNamespace(snapParentVolOptions.RadosNamespace)
|
||||||
|
|
||||||
return reftracker.Remove(
|
return reftracker.Remove(
|
||||||
radoswrapper.NewIOContext(ioctx),
|
radoswrapper.NewIOContext(ioctx),
|
||||||
|
@ -23,7 +23,6 @@ import (
|
|||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
||||||
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
||||||
fsutil "github.com/ceph/ceph-csi/internal/cephfs/util"
|
|
||||||
"github.com/ceph/ceph-csi/internal/journal"
|
"github.com/ceph/ceph-csi/internal/journal"
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
@ -87,8 +86,7 @@ func CheckVolExists(ctx context.Context,
|
|||||||
setMetadata bool,
|
setMetadata bool,
|
||||||
) (*VolumeIdentifier, error) {
|
) (*VolumeIdentifier, error) {
|
||||||
var vid VolumeIdentifier
|
var vid VolumeIdentifier
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -228,8 +226,7 @@ func UndoVolReservation(
|
|||||||
}
|
}
|
||||||
defer cr.DeleteCredentials()
|
defer cr.DeleteCredentials()
|
||||||
|
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -283,8 +280,7 @@ func ReserveVol(ctx context.Context, volOptions *VolumeOptions, secret map[strin
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -329,8 +325,7 @@ func ReserveSnap(
|
|||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := SnapJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := SnapJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -368,8 +363,7 @@ func UndoSnapReservation(
|
|||||||
snapName string,
|
snapName string,
|
||||||
cr *util.Credentials,
|
cr *util.Credentials,
|
||||||
) error {
|
) error {
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := SnapJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := SnapJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -403,8 +397,7 @@ func CheckSnapExists(
|
|||||||
setMetadata bool,
|
setMetadata bool,
|
||||||
cr *util.Credentials,
|
cr *util.Credentials,
|
||||||
) (*SnapshotIdentifier, error) {
|
) (*SnapshotIdentifier, error) {
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := SnapJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := SnapJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ import (
|
|||||||
|
|
||||||
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
"github.com/ceph/ceph-csi/internal/cephfs/core"
|
||||||
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors"
|
||||||
fsutil "github.com/ceph/ceph-csi/internal/cephfs/util"
|
|
||||||
"github.com/ceph/ceph-csi/internal/util"
|
"github.com/ceph/ceph-csi/internal/util"
|
||||||
"github.com/ceph/ceph-csi/internal/util/log"
|
"github.com/ceph/ceph-csi/internal/util/log"
|
||||||
|
|
||||||
@ -130,6 +129,13 @@ func NewVolumeGroupOptionsFromID(
|
|||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if volOptions.RadosNamespace, err = util.GetCephFSRadosNamespace(util.CsiConfigFile, vi.ClusterID); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf(
|
||||||
|
"failed to fetch rados namespace using clusterID (%s): %w",
|
||||||
|
vi.ClusterID,
|
||||||
|
err)
|
||||||
|
}
|
||||||
|
|
||||||
err = volOptions.Connect(cr)
|
err = volOptions.Connect(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -154,7 +160,7 @@ func NewVolumeGroupOptionsFromID(
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -189,8 +195,7 @@ func CheckVolumeGroupSnapExists(
|
|||||||
volOptions *VolumeGroupOptions,
|
volOptions *VolumeGroupOptions,
|
||||||
cr *util.Credentials,
|
cr *util.Credentials,
|
||||||
) (*VolumeGroupSnapshotIdentifier, error) {
|
) (*VolumeGroupSnapshotIdentifier, error) {
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -237,8 +242,7 @@ func ReserveVolumeGroup(
|
|||||||
)
|
)
|
||||||
|
|
||||||
vgsi.RequestName = volOptions.RequestName
|
vgsi.RequestName = volOptions.RequestName
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -271,8 +275,7 @@ func UndoVolumeGroupReservation(
|
|||||||
vgsi *VolumeGroupSnapshotIdentifier,
|
vgsi *VolumeGroupSnapshotIdentifier,
|
||||||
cr *util.Credentials,
|
cr *util.Credentials,
|
||||||
) error {
|
) error {
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolumeGroupJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,13 @@ func GetClusterInformation(options map[string]string) (*cephcsi.ClusterInfo, err
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
radosNamespace, err := util.GetCephFSRadosNamespace(util.CsiConfigFile, clusterID)
|
||||||
|
if err != nil {
|
||||||
|
err = fmt.Errorf("failed to fetch rados namespace using clusterID (%s): %w", clusterID, err)
|
||||||
|
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
subvolumeGroup, err := util.CephFSSubvolumeGroup(util.CsiConfigFile, clusterID)
|
subvolumeGroup, err := util.CephFSSubvolumeGroup(util.CsiConfigFile, clusterID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = fmt.Errorf("failed to fetch subvolumegroup using clusterID (%s): %w", clusterID, err)
|
err = fmt.Errorf("failed to fetch subvolumegroup using clusterID (%s): %w", clusterID, err)
|
||||||
@ -199,6 +206,7 @@ func GetClusterInformation(options map[string]string) (*cephcsi.ClusterInfo, err
|
|||||||
Monitors: strings.Split(monitors, ","),
|
Monitors: strings.Split(monitors, ","),
|
||||||
}
|
}
|
||||||
clusterData.CephFS.SubvolumeGroup = subvolumeGroup
|
clusterData.CephFS.SubvolumeGroup = subvolumeGroup
|
||||||
|
clusterData.CephFS.RadosNamespace = radosNamespace
|
||||||
|
|
||||||
return clusterData, nil
|
return clusterData, nil
|
||||||
}
|
}
|
||||||
@ -229,6 +237,7 @@ func getVolumeOptions(vo map[string]string) (*VolumeOptions, error) {
|
|||||||
opts.ClusterID = clusterData.ClusterID
|
opts.ClusterID = clusterData.ClusterID
|
||||||
opts.Monitors = strings.Join(clusterData.Monitors, ",")
|
opts.Monitors = strings.Join(clusterData.Monitors, ",")
|
||||||
opts.SubvolumeGroup = clusterData.CephFS.SubvolumeGroup
|
opts.SubvolumeGroup = clusterData.CephFS.SubvolumeGroup
|
||||||
|
opts.RadosNamespace = clusterData.CephFS.RadosNamespace
|
||||||
|
|
||||||
if err = extractOption(&opts.FsName, "fsName", vo); err != nil {
|
if err = extractOption(&opts.FsName, "fsName", vo); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -405,6 +414,10 @@ func NewVolumeOptionsFromVolID(
|
|||||||
return nil, nil, fmt.Errorf("failed to fetch subvolumegroup list using clusterID (%s): %w", vi.ClusterID, err)
|
return nil, nil, fmt.Errorf("failed to fetch subvolumegroup list using clusterID (%s): %w", vi.ClusterID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if volOptions.RadosNamespace, err = util.GetCephFSRadosNamespace(util.CsiConfigFile, vi.ClusterID); err != nil {
|
||||||
|
return nil, nil, fmt.Errorf("failed to fetch rados namespace using clusterID (%s): %w", vi.ClusterID, err)
|
||||||
|
}
|
||||||
|
|
||||||
cr, err := util.NewAdminCredentials(secrets)
|
cr, err := util.NewAdminCredentials(secrets)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -434,8 +447,7 @@ func NewVolumeOptionsFromVolID(
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := VolJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := VolJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
@ -788,6 +800,13 @@ func NewSnapshotOptionsFromID(
|
|||||||
err)
|
err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if volOptions.RadosNamespace, err = util.GetCephFSRadosNamespace(util.CsiConfigFile, vi.ClusterID); err != nil {
|
||||||
|
return &volOptions, nil, &sid, fmt.Errorf(
|
||||||
|
"failed to fetch rados namespace using clusterID (%s): %w",
|
||||||
|
vi.ClusterID,
|
||||||
|
err)
|
||||||
|
}
|
||||||
|
|
||||||
err = volOptions.Connect(cr)
|
err = volOptions.Connect(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &volOptions, nil, &sid, err
|
return &volOptions, nil, &sid, err
|
||||||
@ -812,8 +831,7 @@ func NewSnapshotOptionsFromID(
|
|||||||
return &volOptions, nil, &sid, err
|
return &volOptions, nil, &sid, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to cephfs' default radosNamespace (csi)
|
j, err := SnapJournal.Connect(volOptions.Monitors, volOptions.RadosNamespace, cr)
|
||||||
j, err := SnapJournal.Connect(volOptions.Monitors, fsutil.RadosNamespace, cr)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &volOptions, nil, &sid, err
|
return &volOptions, nil, &sid, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user