Skip to content

Commit

Permalink
Remove redundant pool parameter from snapshot class
Browse files Browse the repository at this point in the history
The SnapshotClass for RBD requires a pool parameter. This is redundant
as a snapshot is not created on a different pool than the source image
of the snapshot (refer rbd man page).

Further, when a snapshot needs to be created its source CSI VolumeID
is passed to the creation call, and hence the source volumes pool
needs to be reused to create the snapshot.

Similarly to clone a snapshot, the create request would come in with a
SnapshotID to help identify the snapshot pool, and the same create
request parameters would contain the storage class based pool parameter
to create the clone into (as clones can be in different pools as
compared to their parent snapshots).

Thus, the parameter pool seems redundant in the snapshot class and
should be removed to improve ease of use.

Fixes #379

Signed-off-by: ShyamsundarR <srangana@redhat.com>
  • Loading branch information
ShyamsundarR authored and mergify[bot] committed Jun 4, 2019
1 parent 075861e commit 9a03d73
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ In the `examples/rbd` directory you will find two files related to snapshots:
[snapshot.yaml](./rbd/snapshot.yaml).

Once you created your RBD volume, you'll need to customize at least
`snapshotclass.yaml` and make sure the `clusterid` and `pool` parameters match
`snapshotclass.yaml` and make sure the `clusterid` parameter matches
your Ceph cluster setup.
If you followed the documentation to create the rbdplugin, you shouldn't
have to edit any other file.
Expand Down
2 changes: 0 additions & 2 deletions examples/rbd/snapshotclass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,5 @@ parameters:
# represent the Ceph cluster in clusterID below
clusterID: <cluster-id>

pool: rbd

csi.storage.k8s.io/snapshotter-secret-name: csi-rbd-secret
csi.storage.k8s.io/snapshotter-secret-namespace: default
10 changes: 2 additions & 8 deletions pkg/rbd/rbd_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,16 +477,10 @@ func getCredsFromVol(rbdVol *rbdVolume, volOptions map[string]string) {
}

func genSnapFromOptions(rbdVol *rbdVolume, snapOptions map[string]string) *rbdSnapshot {
var (
err error
ok bool
)
var err error

rbdSnap := &rbdSnapshot{}
rbdSnap.Pool, ok = snapOptions["pool"]
if !ok {
rbdSnap.Pool = rbdVol.Pool
}
rbdSnap.Pool = rbdVol.Pool

rbdSnap.Monitors, rbdSnap.ClusterID, err = getMonsAndClusterID(snapOptions)
if err != nil {
Expand Down

0 comments on commit 9a03d73

Please sign in to comment.