Merge pull request #285 from red-hat-storage/sync_us--devel

Syncing latest changes from upstream devel for ceph-csi
This commit is contained in:
openshift-merge-bot[bot] 2024-04-03 08:07:47 +00:00 committed by GitHub
commit b01dec5183
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 90 additions and 109 deletions

View File

@ -18,24 +18,14 @@ jobs:
strategy:
matrix:
branch: [release-v3.9, release-v3.10, devel]
k8s: ["1.25", "1.26", "1.27", "1.28", "1.29"]
branch: [release-v3.10, release-v3.11, devel]
k8s: ["1.26", "1.27", "1.28", "1.29"]
exclude:
# the next Ceph-CSI version will not be tested with old Kubernetes
- k8s: "1.26"
branch: "devel"
- k8s: "1.25"
branch: "devel"
- k8s: "1.25"
branch: "release-v3.10"
# Ceph-CSI <= 3.9 was released before Kubernetes 1.28
- k8s: "1.28"
branch: "release-v3.9"
# Ceph-CSI <= 3.10 was released before Kubernetes 1.29
- k8s: "1.29"
branch: "release-v3.9"
- k8s: "1.29"
branch: "release-v3.10"

View File

@ -68,22 +68,25 @@ queue_rules:
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
- base=release-v3.9
- base=release-v3.11
- "status-success=codespell"
- "status-success=multi-arch-build"
- "status-success=go-test"
- "status-success=golangci-lint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.25"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
@ -162,15 +165,15 @@ pull_request_rules:
- "status-success=golangci-lint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.25"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
@ -246,7 +249,7 @@ pull_request_rules:
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
- label!=DNM
- base=release-v3.10
- base=release-v3.11
- "#approved-reviews-by>=2"
- "#changes-requested-reviews-by=0"
- "approved-reviews-by=@ceph/ceph-csi-contributors"
@ -262,17 +265,20 @@ pull_request_rules:
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- and:
- label!=DNM
- base=release-v3.9
- base=release-v3.10
- "#approved-reviews-by>=2"
- "#changes-requested-reviews-by=0"
- "approved-reviews-by=@ceph/ceph-csi-contributors"
@ -284,15 +290,15 @@ pull_request_rules:
- "status-success=commitlint"
- "status-success=mod-check"
- "status-success=lint-extras"
- "status-success=ci/centos/k8s-e2e-external-storage/1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.25"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
@ -343,15 +349,18 @@ pull_request_rules:
- "status-success=mod-check"
- "status-success=lint-extras"
- "#changes-requested-reviews-by=0"
- "status-success=ci/centos/k8s-e2e-external-storage/1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.26"
- "status-success=ci/centos/k8s-e2e-external-storage/1.27"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.25"
- "status-success=ci/centos/k8s-e2e-external-storage/1.28"
- "status-success=ci/centos/k8s-e2e-external-storage/1.29"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.26"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.25"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.28"
- "status-success=ci/centos/mini-e2e-helm/k8s-1.29"
- "status-success=ci/centos/mini-e2e/k8s-1.26"
- "status-success=ci/centos/mini-e2e/k8s-1.27"
- "status-success=ci/centos/mini-e2e/k8s-1.28"
- "status-success=ci/centos/mini-e2e/k8s-1.29"
- "status-success=ci/centos/upgrade-tests-cephfs"
- "status-success=ci/centos/upgrade-tests-rbd"
- "status-success=DCO"
@ -385,15 +394,6 @@ pull_request_rules:
name: default
delete_head_branch: {}
- name: backport patches to release-v3.9 branch
conditions:
- base=devel
- label=backport-to-release-v3.9
actions:
backport:
branches:
- release-v3.9
- name: backport patches to release-v3.10 branch
conditions:
- base=devel
@ -403,6 +403,15 @@ pull_request_rules:
branches:
- release-v3.10
- name: backport patches to release-v3.11 branch
conditions:
- base=devel
- label=backport-to-release-v3.11
actions:
backport:
branches:
- release-v3.11
- name: remove outdated approvals on ci/centos
conditions:
- base=ci/centos

View File

@ -56,8 +56,10 @@ environments.
| Ceph CSI Version | Container Orchestrator Name | Version Tested |
| -----------------| --------------------------- | -------------------|
| v3.11.0 | Kubernetes | v1.26, v1.27, v1.28, v1.29|
| v3.10.2 | Kubernetes | v1.26, v1.27, v1.28|
| v3.10.1 | Kubernetes | v1.26, v1.27, v1.28|
| v3.10.0 | Kubernetes | v1.26, v1.27, v1.28|
| v3.9.0 | Kubernetes | v1.25, v1.26, v1.27|
There is work in progress to make this CO-independent and thus
support other orchestration environments (Nomad, Mesos..etc).
@ -128,11 +130,14 @@ in the Kubernetes documentation.
| Ceph CSI Release/Branch | Container image name | Image Tag |
| ----------------------- | ---------------------------- | --------- |
| devel (Branch) | quay.io/cephcsi/cephcsi | canary |
| v3.11.0 (Release) | quay.io/cephcsi/cephcsi | v3.11.0 |
| v3.10.2 (Release) | quay.io/cephcsi/cephcsi | v3.10.2 |
| v3.10.1 (Release) | quay.io/cephcsi/cephcsi | v3.10.1 |
| v3.10.0 (Release) | quay.io/cephcsi/cephcsi | v3.10.0 |
| v3.9.0 (Release) | quay.io/cephcsi/cephcsi | v3.9.0 |
| Deprecated Ceph CSI Release/Branch | Container image name | Image Tag |
| ----------------------- | --------------------------------| --------- |
| v3.9.0 (Release) | quay.io/cephcsi/cephcsi | v3.9.0 |
| v3.8.1 (Release) | quay.io/cephcsi/cephcsi | v3.8.1 |
| v3.8.0 (Release) | quay.io/cephcsi/cephcsi | v3.8.0 |
| v3.7.2 (Release) | quay.io/cephcsi/cephcsi | v3.7.2 |

View File

@ -1,5 +1,5 @@
ARG WORK_DIR="/home/src"
ARG BASE_IMAGE="golang:1.18"
ARG BASE_IMAGE="golang:1.21"
FROM ${BASE_IMAGE} as builder

View File

@ -22,6 +22,7 @@ import (
"fmt"
"log"
"os"
"slices"
"strconv"
"strings"
@ -145,7 +146,7 @@ func main() {
failedTestFound := false
for _, r := range statusList {
log.Printf("found context %s with status %s\n", r.GetContext(), r.GetState())
if contains([]string{"failed", "failure"}, r.GetState()) {
if slices.Contains([]string{"failed", "failure"}, r.GetState()) {
log.Printf("found failed test %s\n", r.GetContext())
failedTestFound = true
// rebase the pr if it is behind the devel branch.
@ -253,17 +254,6 @@ func (c *retestConfig) checkRetestLimitReached(prNumber int, msg string) (bool,
return false, nil
}
// containers check if slice contains string.
func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
// filterStatusesList returns list of unique and recently updated github RepoStatuses.
// Raw github RepoStatus list may contain duplicate and older statuses.
func filterStatusList(rawStatusList []*github.RepoStatus) []*github.RepoStatus {

View File

@ -4,7 +4,7 @@
- [Pre-upgrade considerations](#pre-upgrade-considerations)
- [Snapshot-controller and snapshot crd](#snapshot-controller-and-snapshot-crd)
- [Upgrading from previous releases](#upgrading-from-previous-releases)
- [Upgrading from v3.9 to v3.10](#upgrading-from-v39-to-v310)
- [Upgrading from v3.10 to v3.11](#upgrading-from-v310-to-v311)
- [Upgrading CephFS](#upgrading-cephfs)
- [1. Upgrade CephFS Provisioner resources](#1-upgrade-cephfs-provisioner-resources)
- [1.1 Update the CephFS Provisioner RBAC](#11-update-the-cephfs-provisioner-rbac)
@ -49,7 +49,7 @@ To avoid this issue in future upgrades, we recommend that you do not use the
fuse client as of now.
This guide will walk you through the steps to upgrade the software in a cluster
from v3.9 to v3.10
from v3.10 to v3.11
### Snapshot-controller and snapshot crd
@ -77,8 +77,10 @@ To upgrade from previous releases, refer to the following:
to upgrade from cephcsi v3.7 to v3.8
- [upgrade-from-v3.8-v3.9](https://github.com/ceph/ceph-csi/blob/v3.9.0/docs/ceph-csi-upgrade.md)
to upgrade from cephcsi v3.8 to v3.9
- [upgrade-from-v3.9-v3.10](https://github.com/ceph/ceph-csi/blob/v3.10.0/docs/ceph-csi-upgrade.md)
to upgrade from cephcsi v3.9 to v3.10
## Upgrading from v3.9 to v3.10
## Upgrading from v3.10 to v3.11
**Ceph-csi releases from devel are expressly unsupported.** It is strongly
recommended that you use [official
@ -88,19 +90,19 @@ that will not be supported in the official releases. Builds from the devel
branch can have functionality changed and even removed at any time without
compatibility support and without prior notice.
**Also, we do not recommend any direct upgrades to 3.10 except from 3.9 to 3.10.**
For example, upgrading from 3.8 to 3.10 is not recommended.
**Also, we do not recommend any direct upgrades to 3.11 except from 3.10 to 3.11.**
For example, upgrading from 3.8 to 3.11 is not recommended.
**Refer to the Breaking Changes Section in the
[release notes](https://github.com/ceph/ceph-csi/releases/tag/v3.10.0) before
[release notes](https://github.com/ceph/ceph-csi/releases/tag/v3.11.0) before
proceeding further.**
git checkout v3.10.0 tag
git checkout v3.11.0 tag
```bash
git clone https://github.com/ceph/ceph-csi.git
cd ./ceph-csi
git checkout v3.10.0
git checkout v3.11.0
```
```console
@ -222,7 +224,7 @@ For each node:
- The pod deletion causes the pods to be restarted and updated automatically
on the node.
we have successfully upgraded cephfs csi from v3.9 to v3.10
we have successfully upgraded cephfs csi from v3.10 to v3.11
### Upgrading RBD
@ -286,7 +288,7 @@ daemonset.apps/csi-rbdplugin configured
service/csi-metrics-rbdplugin configured
```
we have successfully upgraded RBD csi from v3.9 to v3.10
we have successfully upgraded RBD csi from v3.10 to v3.11
### Upgrading NFS
@ -348,7 +350,7 @@ daemonset.apps/csi-nfsplugin configured
service/csi-metrics-nfsplugin configured
```
we have successfully upgraded nfs csi from v3.9 to v3.10
we have successfully upgraded nfs csi from v3.10 to v3.11
### CSI Sidecar containers consideration

View File

@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"slices"
"time"
appsv1 "k8s.io/api/apps/v1"
@ -349,17 +350,6 @@ func waitForDeploymentUpdate(
return nil
}
// contains check if slice contains string.
func contains(s []string, e string) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
func waitForContainersArgsUpdate(
c kubernetes.Interface,
ns,
@ -398,7 +388,7 @@ func waitForContainersArgsUpdate(
}
cid := deployment.Spec.Template.Spec.Containers // cid: read as containers in deployment
for i := range cid {
if contains(containers, cid[i].Name) {
if slices.Contains(containers, cid[i].Name) {
match := false
for j, ak := range cid[i].Args {
if ak == key {

View File

@ -2006,7 +2006,7 @@ var _ = Describe("RBD", func() {
"mapOptions": nbdMapOptions,
"cephLogStrategy": e2eDefaultCephLogStrategy,
"encrypted": "true",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
},
deletePolicy)
if err != nil {
@ -2041,7 +2041,7 @@ var _ = Describe("RBD", func() {
f,
defaultSCName,
nil,
map[string]string{"encrypted": "true", "encryptionType": util.EncryptionTypeString(encType)},
map[string]string{"encrypted": "true", "encryptionType": encType.String()},
deletePolicy)
if err != nil {
framework.Failf("failed to create storageclass: %v", err)
@ -2075,7 +2075,7 @@ var _ = Describe("RBD", func() {
f,
defaultSCName,
nil,
map[string]string{"encrypted": "true", "encryptionType": util.EncryptionTypeString(encType)},
map[string]string{"encrypted": "true", "encryptionType": encType.String()},
deletePolicy)
if err != nil {
framework.Failf("failed to create storageclass: %v", err)
@ -2120,7 +2120,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2153,7 +2153,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-tokens-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2207,7 +2207,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-tenant-sa-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2246,7 +2246,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "secrets-metadata-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2279,7 +2279,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "user-ns-secrets-metadata-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2333,7 +2333,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "user-secrets-metadata-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2460,7 +2460,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2494,7 +2494,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2504,7 +2504,7 @@ var _ = Describe("RBD", func() {
scOpts = map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-tenant-sa-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, restoreSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2554,7 +2554,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2564,7 +2564,7 @@ var _ = Describe("RBD", func() {
scOpts = map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-tenant-sa-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, restoreSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2617,7 +2617,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "secrets-metadata-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -2655,7 +2655,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err = createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -4202,7 +4202,7 @@ var _ = Describe("RBD", func() {
scOpts := map[string]string{
"encrypted": "true",
"encryptionKMSID": "vault-test",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
}
err := createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)
if err != nil {
@ -4264,7 +4264,7 @@ var _ = Describe("RBD", func() {
) {
scOpts := map[string]string{
"encrypted": "true",
"encryptionType": util.EncryptionTypeString(encType),
"encryptionType": encType.String(),
"encryptionKMSID": "vault-test",
}
err := createRBDStorageClass(f.ClientSet, f, defaultSCName, nil, scOpts, deletePolicy)

View File

@ -387,8 +387,8 @@ func (conn *Connection) CheckReservation(ctx context.Context,
if savedImageAttributes.EncryptionType != encryptionType {
return nil, fmt.Errorf("internal state inconsistent, omap encryption type"+
" mismatch, request type %q(%d) volume UUID (%s) volume omap encryption type %q (%d)",
util.EncryptionTypeString(encryptionType), encryptionType,
objUUID, util.EncryptionTypeString(savedImageAttributes.EncryptionType),
encryptionType, encryptionType,
objUUID, savedImageAttributes.EncryptionType,
savedImageAttributes.EncryptionType)
}
}
@ -561,7 +561,7 @@ func (conn *Connection) ReserveName(ctx context.Context,
imagePool string, imagePoolID int64,
reqName, namePrefix, parentName, kmsConf, volUUID, owner,
backingSnapshotID string,
encryptionType util.EncryptionType,
encryptionType util.EncryptionType, //nolint:interfacer // prefer util.EncryptionType over fmt.Stringer
) (string, string, error) {
// TODO: Take in-arg as ImageAttributes?
var (
@ -642,7 +642,7 @@ func (conn *Connection) ReserveName(ctx context.Context,
// Update UUID directory to store encryption values
if kmsConf != "" {
omapValues[cj.encryptKMSKey] = kmsConf
omapValues[cj.encryptionType] = util.EncryptionTypeString(encryptionType)
omapValues[cj.encryptionType] = encryptionType.String()
}
// if owner is passed, set it in the UUID directory too

View File

@ -183,6 +183,8 @@ func (rv *rbdVolume) doSnapClone(ctx context.Context, parentVol *rbdVolume) erro
// generate temp cloned volume
tempClone := rv.generateTempClone()
defer tempClone.Destroy()
// snapshot name is same as temporary cloned image, This helps to
// flatten the temporary cloned images as we cannot have more than 510
// snapshots on an rbd image

View File

@ -669,6 +669,7 @@ func (cs *ControllerServer) createVolumeFromSnapshot(
parentVol := rbdSnap.toVolume()
// as we are operating on single cluster reuse the connection
parentVol.conn = rbdVol.conn.Copy()
defer parentVol.Destroy()
// create clone image and delete snapshot
err = rbdVol.cloneRbdImageFromSnapshot(ctx, rbdSnap, parentVol)

View File

@ -1662,6 +1662,7 @@ func (ri *rbdImage) flattenParent(ctx context.Context, hardLimit, softLimit uint
if parentImage == nil {
return nil
}
defer parentImage.Destroy()
return parentImage.flattenRbdImage(ctx, false, hardLimit, softLimit)
}

View File

@ -111,7 +111,7 @@ func ParseEncryptionType(typeStr string) EncryptionType {
}
}
func EncryptionTypeString(encType EncryptionType) string {
func (encType EncryptionType) String() string {
switch encType {
case EncryptionTypeBlock:
return encryptionTypeBlockString

View File

@ -77,7 +77,7 @@ func TestEncryptionType(t *testing.T) {
assert.EqualValues(t, EncryptionTypeNone, ParseEncryptionType(""))
for _, s := range []string{"file", "block", ""} {
assert.EqualValues(t, s, EncryptionTypeString(ParseEncryptionType(s)))
assert.EqualValues(t, s, ParseEncryptionType(s).String())
}
}

View File

@ -23,6 +23,7 @@ import (
"math"
"os"
"runtime"
"slices"
"strings"
"time"
@ -363,7 +364,7 @@ func MountOptionsAdd(options string, add ...string) string {
}
for _, opt := range add {
if opt != "" && !contains(newOpts, opt) {
if opt != "" && !slices.Contains(newOpts, opt) {
newOpts = append(newOpts, opt)
}
}
@ -371,16 +372,6 @@ func MountOptionsAdd(options string, add ...string) string {
return strings.Join(newOpts, ",")
}
func contains(s []string, key string) bool {
for _, v := range s {
if v == key {
return true
}
}
return false
}
// CallStack returns the stack of the calls in the current goroutine. Useful
// for debugging or reporting errors. This is a friendly alternative to
// assert() or panic().