Commit Graph

1116 Commits

Author SHA1 Message Date
Praveen M
e345b26340 cleanup: refactor functions to accept a context parameter
Signed-off-by: Praveen M <m.praveen@ibm.com>
2024-03-12 13:54:19 +00:00
Michael Fritch
3410687855 cephfs: create a new blank key sized according to the passphrase
Padding a passphrase with null chars to arrive at a 32-byte length
later forces a user to also pass null chars via the term when
attempting to manually unlock a subvolume via the fscrypt cli tools.

This also had a side-effect of truncating any longer length passphrase
down to a shorter 32-byte length.

fixup for:
cfea8d7562
dd0e1988c0

Signed-off-by: Michael Fritch <mfritch@suse.com>
2024-03-06 19:23:30 +00:00
Michael Fritch
2368df7e69 cephfs: return ErrBadAuth during keyFn retry
fscrypt will infinitely retry the keyFn during an auth failure,
preventing the csi driver from progressing when configured with
an invalid passphrase

See also:
8c12cd64ab/actions/callback.go (L102-L106)

Signed-off-by: Michael Fritch <mfritch@suse.com>
2024-03-06 19:23:30 +00:00
Yati Padia
fbaf9d5485 rbd: log sitestatuses and description
This commit logs sitestatues and description in
GetVolumeReplicationInfo RPC call for better
debuging.

Fixes: #4430

Signed-off-by: Yati Padia <ypadia@redhat.com>
2024-02-19 12:58:42 +00:00
Madhu Rajanna
4e296bf65e util: log repication RequestID
currently we are not logging the RequestID
for the replication RPC calls. This PR
adds the replication case to the getReqID
function.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-13 14:09:54 +00:00
Madhu Rajanna
5afc6fd0d2 util: register group controller server
Register group controller server
if its initialized.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:27:55 +00:00
Madhu Rajanna
2af26ca62d util: add ValidateGroupControllerServiceRequest helper
added ValidateGroupControllerServiceRequest
helper function which can be used to validate the
group controller service request.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:27:55 +00:00
Madhu Rajanna
5ecfa0660f util: add groupSnapshot details to getReqID
added CreateVolumeGroupSnapshotRequest and
DeleteVolumeGroupSnapshotRequest to the
getReqID so that we can get the ReqID for
the logging.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:27:55 +00:00
Madhu Rajanna
12bd269d5b util: add GroupControllerGetCapabilities RPC
added GroupControllerGetCapabilities RPC
to the default controller server which returns
the group capabilities which are already set.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:27:55 +00:00
Madhu Rajanna
aa39b3dc1f util: add helper for group controller
Added helper function to add the group
controller capabilities which needs to
be included by csi driver that wants to
implement group controller.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:27:55 +00:00
Madhu Rajanna
dd235d88e0 journal: omap implementation for volumegroup
Implement the required function to store/retrieve
the details from the omap for the volumegroup.

This adds a new omap object that contains the
mapping of the RequestName and all the volumeID
and its corresponding snapshotID belonging to a
group.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:20:37 +00:00
Madhu Rajanna
9e08a67b36 journal: implementation for listOmapVals
Added a implementation for the listOmapVals
which list the object keys and values from
the rados omap.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-02-09 07:20:37 +00:00
Niels de Vos
ab87045afb cephfs: do not run modprobe if support is compiled into the kernel
By reading the contents of /proc/filesystems, and checking if "ceph" is
included there, running "modprobe ceph" can be skipped.

Fixes: #4376
Signed-off-by: Niels de Vos <ndevos@ibm.com>
2024-01-17 17:48:45 +00:00
Madhu Rajanna
1d17600401 cephfs: make fsname as optional for static PVC
consider fsName optional for static volume
as it is not required to be set during mount
operation with fuse and kernel client.

fixes: #4311

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2024-01-12 18:27:45 +00:00
Niels de Vos
3bf5c0e478 cleanup: simplify rbdGetDeviceList()
The `rbdGetDeviceList()` function uses two very similar types for
converting krbd and NBD device information from JSON. There is no need
to use this distinction, and callers of `rbdGetDeviceList()` should not
need to care about it either.

By introducing a `deviceInfo` interface with Get-functions, the
`rbdGetDeviceList()` function becomes a little simpler, with a clearly
defined API for the returned list.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
2024-01-11 18:00:41 +00:00
Praveen M
50e505619c deploy: added json field tags for csi config map
This commit adds the json field tags for csi config map for
encoding and decoding JSON.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-12-21 17:44:46 +00:00
Riya Singhal
bee77f7fac cephfs: fix fetchIP to support more formats
Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-12-15 18:21:20 +00:00
Riya Singhal
51faa2ad7f cephfs: fix network fencing admin id
this commit replaces user id requirement with
admin id

Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-12-12 18:23:57 +00:00
Jan Nemcik
3443546370 rbd: updated node labels fetching logic
node labels are fetched only if controller is running in k8s and is nodeserver

Signed-off-by: Jan Nemcik <jan.nemcik@solargis.com>
2023-12-11 10:59:50 +00:00
karthik-us
f6665294a1 cephfs: handle cephfs clone limit error
This is to pre-emptively add check for EAGAIN error returned from
ceph as part of https://github.com/ceph/ceph/pull/52670 if all the
clone threads are busy and return csi compatible error.

Fixes: #3996
Signed-off-by: karthik-us <ksubrahm@redhat.com>
2023-11-24 08:47:45 +00:00
karthik-us
31aeaf7e5b cleanup: cephfs resize code cleanup
The ceph fs subvolume resize support is available
in all the active ceph releases. Hence removing the
code to check the supportability of the feature.

Signed-off-by: karthik-us <ksubrahm@redhat.com>
2023-11-23 10:59:12 +00:00
Riya Singhal
4b5cdd5316 util: addresed few todo
this commit replaces string comparsion with error code
at few places

Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-11-23 00:55:17 +00:00
Praveen M
4d466843b9 cephfs: add read affinity mount option
This commit makes use of crush location labels from node
labels to supply `crush_location` and `read_from_replica=localize`
options during mount. Using these options, cephfs
will be able to redirect reads to the closest OSD,
improving performance.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-22 13:13:01 +00:00
Praveen M
e9983306d9 util: remove metrics argument from NewMiddlewareServerOption
This commit removes metrics argument from NewMiddlewareServerOption
as it always set to false.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-17 10:15:32 +00:00
Niels de Vos
0c13a70363 util: include request-IDs in all gRPC calls for the Controller
Snapshot procedures do not seem to contain the `Req-ID:` prefix in the
logs anymore (or weren't they there at all?) for some reason. This adds
them back.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
2023-11-16 16:50:16 +00:00
Praveen M
fb8bb3f576 cephfs: support for kernelMountOptions & fuseMountOptions per cluster
Implemented the capability to include kernel mount options and
fuse mount options for individual clusters within the ceph-csi-config
ConfigMap.This allows users to configure the kernel/fuse mount options
for each cluster separately. The mount options specified in the ConfigMap
will supersede those provided via command line arguments.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-15 11:43:27 +00:00
Praveen M
1e4ff115a7 util: added GetCephFSMountOptions method
This commit adds GetCephFSMountOptions util method which returns
KernelMountOptions and fuseMountOptions for cluster `clusterID`.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-15 11:43:27 +00:00
Praveen M
6f9b1ab04d cephfs: remove subvolumegroup creation
Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-10 11:41:35 +00:00
Praveen M
c4e373c72f deploy: support for read affinity options per cluster
Implemented the capability to include read affinity options
for individual clusters within the ceph-csi-config ConfigMap.
This allows users to configure the crush location for each
cluster separately. The read affinity options specified in
the ConfigMap will supersede those provided via command line arguments.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-08 21:17:00 +00:00
Praveen M
93f2ed681f util: added RunsOnKubernetes() function
Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-08 21:17:00 +00:00
Praveen M
9cec05f484 util: added read affinity related functions and unit testcases
This commit adds util functions related to read affinity
and unit testcases for the same.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-08 21:17:00 +00:00
Praveen M
a93f3e24ba util: moved GetNodeLabels() under internal/util/k8s
Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-08 21:17:00 +00:00
Madhu Rajanna
1b39b82a85 cephfs: avoid variable shadowing
Avoiding variable shadowing as it
becomes hard to debug this kind of
issues in real enviroment.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-08 19:25:51 +00:00
Madhu Rajanna
c25f572ae0 cephfs: remove subvolume during clone
If any operations like Resize, Deleting
snapshot fails, we need to remove
both snapshot and the clone to avoid
resource leak.

closes: #4218

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-08 19:25:51 +00:00
Riya Singhal
2598300f66 cephfs: add test case for ipv6 address
Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-11-08 15:43:58 +00:00
Riya Singhal
0631c15025 cephfs: update fetchIP to support ipv6 addresses
Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-11-08 15:43:58 +00:00
Madhu Rajanna
304462c7cc cleanup: fix spellcheck errors
fixed spellcheck errors caught in
CI.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-08 12:32:06 +00:00
Niels de Vos
76d9400725 cleanup: remove left-overs of ReplicationServer in csi-common
The ReplicationServer is not used anymore, the functionality has moved
to CSI-Addons and the `internal/csi-addons/rbd` package. These last
references were not activated anywhere, so can be removed without any
impact.

See-also: #3314
Signed-off-by: Niels de Vos <ndevos@ibm.com>
2023-11-07 07:37:16 +00:00
Madhu Rajanna
9f753889ed rbd: remove deprecated rbdImageRequiresEncryption
remove support for deprecated
rbdImageRequiresEncryption case.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-04 08:14:51 +00:00
Madhu Rajanna
1e05a0da7c util: remove RadosNamespace from configmap
remove RadosNamespace from the configmap main
section as its already added to the rbd section

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-04 08:14:51 +00:00
Niels de Vos
4d3b1fc46f util: if FilesystemNodeGetVolumeStats succeeds the volume is healthy
When FilesystemNodeGetVolumeStats() succeeds, the volume must be
healthy. This can be included in the VolumeCondition CSI message by
default.

Checks that detect an abnormal VolumeCondition should prevent calling
FilesystemNodeGetVolumeStats() as it is possible that the function will
hang.

Signed-off-by: Niels de Vos <ndevos@ibm.com>
2023-11-03 13:41:44 +00:00
Niels de Vos
7d96cafad7 cephfs: enable VolumeCondition with new health-checker
The HealthChecker is configured to use the Staging path pf the volume,
with a `.csi/` subdirectory. In the future this directory could be a
directory that is not under the Published directory.

Fixes: #4219
Signed-off-by: Niels de Vos <ndevos@ibm.com>
2023-11-03 13:41:44 +00:00
Niels de Vos
54fc65a561 util: add health-checker for periodic filesystem checks
Signed-off-by: Niels de Vos <ndevos@ibm.com>
2023-11-03 13:41:44 +00:00
Madhu Rajanna
00d6971dbd util: rearrange struct to fix lint
re-arrange the struct members to
fix below lint issue

```
struct of size 336 bytes could be of size 328 bytes
```

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-03 10:04:50 +00:00
Madhu Rajanna
3ea540bf0f util: remove deprecated grpc metrics
This commit removes the deprecated
grpc related code from cephcsi.

fixes: #4122

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
2023-11-03 10:04:50 +00:00
Praveen M
c09700b568 cleanup: removed unused SnapshotInfo from CheckSnapExists()
Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-01 11:32:07 +00:00
Praveen M
ad3a3d704a cephfs: remove snapshot protect/unprotect
This commit eliminates the code for protecting and unprotecting
snapshots, as the functionality to protect and unprotect snapshots
is being deprecated.

Signed-off-by: Praveen M <m.praveen@ibm.com>
2023-11-01 11:32:07 +00:00
Riya Singhal
1fc9678342 cephfs: expose FenceControllerServer in driver.go to handle the requests
Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-10-24 16:36:41 +00:00
Riya Singhal
74dfb7b913 cephfs: adds unit testing for unfencing procedure
Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-10-24 16:36:41 +00:00
Riya Singhal
14b06837d0 cephfs: implement the logic for unfencing procedure
this commit un-blocklists the clients provided in cidr
for unfencing operation.

Signed-off-by: Riya Singhal <rsinghal@redhat.com>
2023-10-24 16:36:41 +00:00