From 029276b569878f734ec91ffa889411bf2a54c1bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Jun 2023 20:59:30 +0000 Subject: [PATCH] rebase: Bump github.com/ceph/go-ceph from 0.21.0 to 0.22.0 Bumps [github.com/ceph/go-ceph](https://github.com/ceph/go-ceph) from 0.21.0 to 0.22.0. - [Release notes](https://github.com/ceph/go-ceph/releases) - [Changelog](https://github.com/ceph/go-ceph/blob/master/docs/release-process.md) - [Commits](https://github.com/ceph/go-ceph/compare/v0.21.0...v0.22.0) --- updated-dependencies: - dependency-name: github.com/ceph/go-ceph dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../ceph/go-ceph/cephfs/admin/metadata.go | 4 +- .../go-ceph/cephfs/admin/snapshot_metadata.go | 4 +- vendor/github.com/ceph/go-ceph/rbd/locks.go | 140 ++++++++++++++++++ .../github.com/ceph/go-ceph/rbd/migration.go | 4 +- .../ceph/go-ceph/rbd/mirror_peer_site.go | 5 +- vendor/modules.txt | 2 +- 8 files changed, 153 insertions(+), 12 deletions(-) create mode 100644 vendor/github.com/ceph/go-ceph/rbd/locks.go diff --git a/go.mod b/go.mod index 143694d42..ce3e74fbb 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/aws/aws-sdk-go-v2/service/sts v1.19.2 github.com/ceph/ceph-csi/api v0.0.0-00010101000000-000000000000 // TODO: API for managing subvolume metadata and snapshot metadata requires `ceph_ci_untested` build-tag - github.com/ceph/go-ceph v0.21.0 + github.com/ceph/go-ceph v0.22.0 github.com/container-storage-interface/spec v1.8.0 github.com/csi-addons/replication-lib-utils v0.2.0 github.com/csi-addons/spec v0.2.1-0.20230606140122-d20966d2e444 diff --git a/go.sum b/go.sum index c79aff850..57c8121ba 100644 --- a/go.sum +++ b/go.sum @@ -195,8 +195,8 @@ github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8 github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/centrify/cloud-golang-sdk v0.0.0-20190214225812-119110094d0f/go.mod h1:C0rtzmGXgN78pYR0tGJFhtHgkbAs0lIbHwkB81VxDQE= -github.com/ceph/go-ceph v0.21.0 h1:nx+6FARWQqQ3ctSVwljeeauh0wgyVvd17i23d75mpA8= -github.com/ceph/go-ceph v0.21.0/go.mod h1:574HYNbG0RZV7lBemoCIxrQEUlo/1BzN42y5NgDr4vg= +github.com/ceph/go-ceph v0.22.0 h1:neClxdgly+Bb2IfmC3vP4Rihh//BM0YpJW/685T+yT4= +github.com/ceph/go-ceph v0.22.0/go.mod h1:vyoYT04bHOlrjFfu1NmmtqKdH5uRBVKPKq7viyUL4sc= github.com/certifi/gocertifi v0.0.0-20191021191039-0944d244cd40/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054/go.mod h1:sGbDF6GwGcLpkNXPUTkMRoywsNa/ol15pxFe6ERfguA= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= diff --git a/vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go b/vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go index 4118311e8..ceed02321 100644 --- a/vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go +++ b/vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go @@ -1,5 +1,5 @@ -//go:build !(nautilus || octopus || pacific) && ceph_preview -// +build !nautilus,!octopus,!pacific,ceph_preview +//go:build !(nautilus || octopus || pacific) +// +build !nautilus,!octopus,!pacific package admin diff --git a/vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go b/vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go index 199f94316..62681ea62 100644 --- a/vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go +++ b/vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go @@ -1,5 +1,5 @@ -//go:build !(nautilus || octopus || pacific) && ceph_preview -// +build !nautilus,!octopus,!pacific,ceph_preview +//go:build !(nautilus || octopus || pacific) +// +build !nautilus,!octopus,!pacific package admin diff --git a/vendor/github.com/ceph/go-ceph/rbd/locks.go b/vendor/github.com/ceph/go-ceph/rbd/locks.go new file mode 100644 index 000000000..b4c9c097b --- /dev/null +++ b/vendor/github.com/ceph/go-ceph/rbd/locks.go @@ -0,0 +1,140 @@ +//go:build !nautilus && ceph_preview +// +build !nautilus,ceph_preview + +package rbd + +// #cgo LDFLAGS: -lrbd +// #include +// #include +// #include +import "C" + +import ( + "unsafe" +) + +// LockMode represents a group of configurable lock modes. +type LockMode C.rbd_lock_mode_t + +const ( + // LockModeExclusive is the representation of RBD_LOCK_MODE_EXCLUSIVE from librbd. + LockModeExclusive = LockMode(C.RBD_LOCK_MODE_EXCLUSIVE) + // LockModeShared is the representation of RBD_LOCK_MODE_SHARED from librbd. + LockModeShared = LockMode(C.RBD_LOCK_MODE_SHARED) +) + +// LockAcquire takes a lock on the given image as per the provided lock_mode. +// +// Implements: +// +// int rbd_lock_acquire(rbd_image_t image, rbd_lock_mode_t lock_mode); +func (image *Image) LockAcquire(lockMode LockMode) error { + if err := image.validate(imageIsOpen); err != nil { + return err + } + + ret := C.rbd_lock_acquire(image.image, C.rbd_lock_mode_t(lockMode)) + + return getError(ret) +} + +// LockBreak breaks the lock of lock_mode on the provided lock_owner. +// +// Implements: +// +// int rbd_lock_break(rbd_image_t image, rbd_lock_mode_t lock_mode, +// const char *lock_owner); +func (image *Image) LockBreak(lockMode LockMode, lockOwner string) error { + if err := image.validate(imageIsOpen); err != nil { + return err + } + + cLockOwner := C.CString(lockOwner) + defer C.free(unsafe.Pointer(cLockOwner)) + + ret := C.rbd_lock_break(image.image, C.rbd_lock_mode_t(lockMode), cLockOwner) + + return getError(ret) +} + +// LockOwner represents information about a lock owner. +type LockOwner struct { + Mode LockMode + Owner string +} + +// LockGetOwners fetches the list of lock owners. +// +// Implements: +// +// int rbd_lock_get_owners(rbd_image_t image, rbd_lock_mode_t *lock_mode, +// char **lock_owners, size_t *max_lock_owners); +func (image *Image) LockGetOwners() ([]*LockOwner, error) { + if err := image.validate(imageIsOpen); err != nil { + return nil, err + } + + var ( + maxLockOwners = C.size_t(8) + cLockOwners = make([]*C.char, 8) + lockMode LockMode + lockOwnersList []*LockOwner + ) + + for { + ret := C.rbd_lock_get_owners(image.image, (*C.rbd_lock_mode_t)(&lockMode), &cLockOwners[0], &maxLockOwners) + if ret >= 0 { + break + } else if ret == -C.ENOENT { + return nil, nil + } else if ret != -C.ERANGE { + return nil, getError(ret) + } + } + + defer C.rbd_lock_get_owners_cleanup(&cLockOwners[0], maxLockOwners) + + for i := 0; i < int(maxLockOwners); i++ { + lockOwnersList = append(lockOwnersList, &LockOwner{ + Mode: LockMode(lockMode), + Owner: C.GoString(cLockOwners[i]), + }) + } + + return lockOwnersList, nil +} + +// LockIsExclusiveOwner gets the status of the image exclusive lock. +// +// Implements: +// +// int rbd_is_exclusive_lock_owner(rbd_image_t image, int *is_owner); +func (image *Image) LockIsExclusiveOwner() (bool, error) { + if err := image.validate(imageIsOpen); err != nil { + return false, err + } + + cIsOwner := C.int(0) + + ret := C.rbd_is_exclusive_lock_owner(image.image, &cIsOwner) + if ret != 0 { + return false, getError(ret) + } + + return cIsOwner == 1, nil +} + +// LockRelease releases a lock on the image. +// +// Implements: +// +// int rbd_lock_release(rbd_image_t image); +func (image *Image) LockRelease() error { + if err := image.validate(imageIsOpen); err != nil { + return err + } + + ret := C.rbd_lock_release(image.image) + + return getError(ret) +} diff --git a/vendor/github.com/ceph/go-ceph/rbd/migration.go b/vendor/github.com/ceph/go-ceph/rbd/migration.go index 94b585253..5e567f3fb 100644 --- a/vendor/github.com/ceph/go-ceph/rbd/migration.go +++ b/vendor/github.com/ceph/go-ceph/rbd/migration.go @@ -1,5 +1,5 @@ -//go:build !(octopus || nautilus) && ceph_preview -// +build !octopus,!nautilus,ceph_preview +//go:build !(octopus || nautilus) +// +build !octopus,!nautilus package rbd diff --git a/vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go b/vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go index ad78accb4..05b08111d 100644 --- a/vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go +++ b/vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go @@ -149,14 +149,15 @@ func SetAttributesMirrorPeerSite(ioctx *rados.IOContext, uuid string, attributes return getError(ret) } -// MirrorPeerSite contains information about a mirroring peer site. +// MirrorPeerSite is go equivalent of rbd_mirror_peer_site_t struct and contains information +// about a mirroring peer site. Here, we are ignoring the "last_seen" as this property is redundant +// and not updated in the ceph API. Related Ceph issue: https://tracker.ceph.com/issues/59581 type MirrorPeerSite struct { UUID string Direction MirrorPeerDirection SiteName string MirrorUUID string ClientName string - LastSeen C.time_t } // ListMirrorPeerSite returns the list of peer sites diff --git a/vendor/modules.txt b/vendor/modules.txt index f7ebb2d4f..c516db132 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -130,7 +130,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.21.0 +# github.com/ceph/go-ceph v0.22.0 ## explicit; go 1.19 github.com/ceph/go-ceph/cephfs/admin github.com/ceph/go-ceph/common/admin/manager