Skip to content

Commit

Permalink
[TESTING] rbd-group-snapshots use rbd.CloneImageByID()
Browse files Browse the repository at this point in the history
The new rbd_clone4() API is only available in Squid and newer. Squid is
not yet released, therefor it is required to use the container image
from the Ceph CI registry.

rbd_clone() is added in PR ceph/go-ceph#1000, that branch needs to be
vendored as well.
  • Loading branch information
nixpanic committed Jun 25, 2024
1 parent b397f90 commit 369b23b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ e2e.test: check-env

.PHONY: rbd-group-snapshot
rbd-group-snapshot:
go build -o _output/rbd-group-snapshot ./tools/rbd-group-snapshot
go build $(GO_TAGS) -o _output/rbd-group-snapshot ./tools/rbd-group-snapshot

#
# Update the generated deploy/ files when the template changed. This requires
Expand Down
4 changes: 2 additions & 2 deletions build.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ CSI_IMAGE_VERSION=canary
CSI_UPGRADE_VERSION=v3.11.0

# Ceph version to use
BASE_IMAGE=quay.io/ceph/ceph:v18
CEPH_VERSION=reef
BASE_IMAGE=quay.ceph.io/ceph-ci/ceph:squid
CEPH_VERSION=squid

# standard Golang options
GOLANG_VERSION=1.22.2
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/ceph/go-ceph => github.com/nixpanic/go-ceph v0.0.0-20240624135224-4596b70b9942

replace (
code.cloudfoundry.org/gofileutils => github.com/cloudfoundry/gofileutils v0.0.0-20170111115228-4d0c80011a0f
github.com/ceph/ceph-csi/api => ./api
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,6 @@ github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
github.com/ceph/go-ceph v0.28.0 h1:ZjlDV9XiVmBQIe9bKbT5j2Ft/bse3Jm+Ui65yE/oFFU=
github.com/ceph/go-ceph v0.28.0/go.mod h1:EwEITEDpuFCMnFrPLbV+/Vyi59jUihgCxBKvlTWGot0=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
Expand Down Expand Up @@ -1418,6 +1416,8 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nixpanic/go-ceph v0.0.0-20240624135224-4596b70b9942 h1:dCLB+k/q7G1nfeShzKIBGwFMz6vcijproXJs4wylfcY=
github.com/nixpanic/go-ceph v0.0.0-20240624135224-4596b70b9942/go.mod h1:EwEITEDpuFCMnFrPLbV+/Vyi59jUihgCxBKvlTWGot0=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
Expand Down
7 changes: 4 additions & 3 deletions tools/rbd-group-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (rgt *rbdGroupTest) restoreFromSnapshot() {
// panic(err)
// }

/*
fmt.Printf("restoring image %q from parent %q at snapshot %q\n", restoreName, imageNames[0], snaps[0].Name)
snap := img.GetSnapshot(snaps[0].Name)
err = snap.Protect()
Expand All @@ -214,11 +213,11 @@ func (rgt *rbdGroupTest) restoreFromSnapshot() {
}
defer snap.Unprotect()

err = rbd.CloneFromImage(img, snaps[0].Name, rgt.ioctx, restoreName, options)
//err = rbd.CloneFromImage(img, snaps[0].Name, rgt.ioctx, restoreName, options)
err = rbd.CloneImageByID(rgt.ioctx, imageNames[0], snaps[0].Id, rgt.ioctx, restoreName, options)
if err != nil {
panic(err)
}
*/

/*
// alternative to the above -- segfaults, needs a snapshot
Expand All @@ -243,6 +242,7 @@ func (rgt *rbdGroupTest) restoreFromSnapshot() {
*/

// alternative to the above
/*
snapname := "tmp-snap"
snap, err := img.CreateSnapshot(snapname)
if err != nil {
Expand Down Expand Up @@ -273,6 +273,7 @@ func (rgt *rbdGroupTest) restoreFromSnapshot() {
if err != nil {
panic(err)
}
*/
}

func (rgt *rbdGroupTest) removeRestoredImage() {
Expand Down
3 changes: 2 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ github.com/ceph/ceph-csi/api/deploy/kubernetes/cephfs
github.com/ceph/ceph-csi/api/deploy/kubernetes/nfs
github.com/ceph/ceph-csi/api/deploy/kubernetes/rbd
github.com/ceph/ceph-csi/api/deploy/ocp
# github.com/ceph/go-ceph v0.28.0
# github.com/ceph/go-ceph v0.28.0 => github.com/nixpanic/go-ceph v0.0.0-20240624135224-4596b70b9942
## explicit; go 1.19
github.com/ceph/go-ceph/cephfs
github.com/ceph/go-ceph/cephfs/admin
Expand Down Expand Up @@ -1804,6 +1804,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
## explicit; go 1.12
sigs.k8s.io/yaml
sigs.k8s.io/yaml/goyaml.v2
# github.com/ceph/go-ceph => github.com/nixpanic/go-ceph v0.0.0-20240624135224-4596b70b9942
# code.cloudfoundry.org/gofileutils => github.com/cloudfoundry/gofileutils v0.0.0-20170111115228-4d0c80011a0f
# github.com/ceph/ceph-csi/api => ./api
# github.com/portworx/sched-ops => github.com/portworx/sched-ops v0.20.4-openstorage-rc3
Expand Down

0 comments on commit 369b23b

Please sign in to comment.