mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-22 14:20:19 +00:00
rebase: bump github.com/ceph/go-ceph from 0.20.0 to 0.21.0
Bumps [github.com/ceph/go-ceph](https://github.com/ceph/go-ceph) from 0.20.0 to 0.21.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.20.0...v0.21.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] <support@github.com>
This commit is contained in:
parent
c8f6878570
commit
d05847ee73
2
go.mod
2
go.mod
@ -8,7 +8,7 @@ require (
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.18.6
|
||||
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.20.0
|
||||
github.com/ceph/go-ceph v0.21.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.0
|
||||
|
4
go.sum
4
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.20.0 h1:weYE7zoVrIBk9bIVq8jS9z3RukGlnZwFGCth7Tu1ssU=
|
||||
github.com/ceph/go-ceph v0.20.0/go.mod h1:/4iZyaN5wTpIFMEKO6GU3xX3vHnyvd2Fcdf05n9VuD0=
|
||||
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/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=
|
||||
|
3
vendor/github.com/ceph/go-ceph/cephfs/admin/clone.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/cephfs/admin/clone.go
generated
vendored
@ -28,6 +28,7 @@ type CloneOptions struct {
|
||||
// specified using the clone options parameter.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot clone <volume> --group_name=<group> <subvolume> <snapshot> <name> [...]
|
||||
func (fsa *FSAdmin) CloneSubVolumeSnapshot(volume, group, subvolume, snapshot, name string, o *CloneOptions) error {
|
||||
m := map[string]string{
|
||||
@ -114,6 +115,7 @@ func parseCloneStatus(res response) (*CloneStatus, error) {
|
||||
// CloneStatus returns data reporting the status of a subvolume clone.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs clone status <volume> --group_name=<group> <clone>
|
||||
func (fsa *FSAdmin) CloneStatus(volume, group, clone string) (*CloneStatus, error) {
|
||||
m := map[string]string{
|
||||
@ -132,6 +134,7 @@ func (fsa *FSAdmin) CloneStatus(volume, group, clone string) (*CloneStatus, erro
|
||||
// CancelClone does not delete the clone.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs clone cancel <volume> --group_name=<group> <clone>
|
||||
func (fsa *FSAdmin) CancelClone(volume, group, clone string) error {
|
||||
m := map[string]string{
|
||||
|
1
vendor/github.com/ceph/go-ceph/cephfs/admin/clone_nautilus.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/cephfs/admin/clone_nautilus.go
generated
vendored
@ -3,6 +3,7 @@ package admin
|
||||
// GetFailure returns details about the CloneStatus when in CloneFailed state.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// Reading the .failure object from the JSON returned by "ceph fs subvolume
|
||||
// snapshot clone"
|
||||
func (cs *CloneStatus) GetFailure() *CloneFailure {
|
||||
|
3
vendor/github.com/ceph/go-ceph/cephfs/admin/fsadmin.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/cephfs/admin/fsadmin.go
generated
vendored
@ -21,6 +21,9 @@ type FSAdmin struct {
|
||||
// configuration file. If more customization is needed, create a
|
||||
// *rados.Conn as you see fit and use NewFromConn to use that
|
||||
// connection with these administrative functions.
|
||||
//
|
||||
// Deprecated: Use NewFromConn instead of New. The New function does not expose
|
||||
// the rados connection and therefore can not be deterministically cleaned up.
|
||||
func New() (*FSAdmin, error) {
|
||||
conn, err := rados.NewConn()
|
||||
if err != nil {
|
||||
|
5
vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go
generated
vendored
5
vendor/github.com/ceph/go-ceph/cephfs/admin/metadata.go
generated
vendored
@ -7,6 +7,7 @@ package admin
|
||||
// an optional subvolume group based on provided key name.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume metadata get <vol_name> <sub_name> <key_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) GetMetadata(volume, group, subvolume, key string) (string, error) {
|
||||
m := map[string]string{
|
||||
@ -28,6 +29,7 @@ func (fsa *FSAdmin) GetMetadata(volume, group, subvolume, key string) (string, e
|
||||
// an optional subvolume group as a key-value pair.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume metadata set <vol_name> <sub_name> <key_name> <value> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) SetMetadata(volume, group, subvolume, key, value string) error {
|
||||
m := map[string]string{
|
||||
@ -50,6 +52,7 @@ func (fsa *FSAdmin) SetMetadata(volume, group, subvolume, key, value string) err
|
||||
// belonging to an optional subvolume group using the metadata key.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume metadata rm <vol_name> <sub_name> <key_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) RemoveMetadata(volume, group, subvolume, key string) error {
|
||||
return fsa.rmSubVolumeMetadata(volume, group, subvolume, key, commonRmFlags{})
|
||||
@ -60,6 +63,7 @@ func (fsa *FSAdmin) RemoveMetadata(volume, group, subvolume, key string) error {
|
||||
// the metadata key.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume metadata rm <vol_name> <sub_name> <key_name> [--group_name <subvol_group_name>] --force
|
||||
func (fsa *FSAdmin) ForceRemoveMetadata(volume, group, subvolume, key string) error {
|
||||
return fsa.rmSubVolumeMetadata(volume, group, subvolume, key, commonRmFlags{force: true})
|
||||
@ -85,6 +89,7 @@ func (fsa *FSAdmin) rmSubVolumeMetadata(volume, group, subvolume, key string, o
|
||||
// in a volume belonging to an optional subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume metadata ls <vol_name> <sub_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) ListMetadata(volume, group, subvolume string) (map[string]string, error) {
|
||||
m := map[string]string{
|
||||
|
2
vendor/github.com/ceph/go-ceph/cephfs/admin/mgrmodule.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/cephfs/admin/mgrmodule.go
generated
vendored
@ -9,6 +9,7 @@ const mirroring = "mirroring"
|
||||
// EnableMirroringModule will enable the mirroring module for cephfs.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph mgr module enable mirroring [--force]
|
||||
func (fsa *FSAdmin) EnableMirroringModule(force bool) error {
|
||||
mgradmin := manager.NewFromConn(fsa.conn)
|
||||
@ -18,6 +19,7 @@ func (fsa *FSAdmin) EnableMirroringModule(force bool) error {
|
||||
// DisableMirroringModule will disable the mirroring module for cephfs.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph mgr module disable mirroring
|
||||
func (fsa *FSAdmin) DisableMirroringModule() error {
|
||||
mgradmin := manager.NewFromConn(fsa.conn)
|
||||
|
8
vendor/github.com/ceph/go-ceph/cephfs/admin/mirror.go
generated
vendored
8
vendor/github.com/ceph/go-ceph/cephfs/admin/mirror.go
generated
vendored
@ -20,6 +20,7 @@ func (fsa *FSAdmin) SnapshotMirror() *SnapshotMirrorAdmin {
|
||||
// Enable snapshot mirroring for the given file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror enable <fs_name>
|
||||
func (sma *SnapshotMirrorAdmin) Enable(fsname string) error {
|
||||
m := map[string]string{
|
||||
@ -33,6 +34,7 @@ func (sma *SnapshotMirrorAdmin) Enable(fsname string) error {
|
||||
// Disable snapshot mirroring for the given file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror disable <fs_name>
|
||||
func (sma *SnapshotMirrorAdmin) Disable(fsname string) error {
|
||||
m := map[string]string{
|
||||
@ -46,6 +48,7 @@ func (sma *SnapshotMirrorAdmin) Disable(fsname string) error {
|
||||
// Add a path in the file system to be mirrored.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror add <fs_name> <path>
|
||||
func (sma *SnapshotMirrorAdmin) Add(fsname, path string) error {
|
||||
m := map[string]string{
|
||||
@ -60,6 +63,7 @@ func (sma *SnapshotMirrorAdmin) Add(fsname, path string) error {
|
||||
// Remove a path in the file system from mirroring.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror remove <fs_name> <path>
|
||||
func (sma *SnapshotMirrorAdmin) Remove(fsname, path string) error {
|
||||
m := map[string]string{
|
||||
@ -79,6 +83,7 @@ type bootstrapTokenResponse struct {
|
||||
// a peering association between this site an another site.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror peer_bootstrap create <fs_name> <client_entity> <site-name>
|
||||
func (sma *SnapshotMirrorAdmin) CreatePeerBootstrapToken(
|
||||
fsname, client, site string) (string, error) {
|
||||
@ -100,6 +105,7 @@ func (sma *SnapshotMirrorAdmin) CreatePeerBootstrapToken(
|
||||
// that has provided a token, with the current site.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror peer_bootstrap import <fs_name> <token>
|
||||
func (sma *SnapshotMirrorAdmin) ImportPeerBoostrapToken(fsname, token string) error {
|
||||
m := map[string]string{
|
||||
@ -170,6 +176,7 @@ func parseDaemonStatus(res response) (DaemonStatusResults, error) {
|
||||
// associated with the given file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror daemon status <fs_name>
|
||||
func (sma *SnapshotMirrorAdmin) DaemonStatus(fsname string) (
|
||||
DaemonStatusResults, error) {
|
||||
@ -204,6 +211,7 @@ func parsePeerList(res response) (PeerListResults, error) {
|
||||
// PeerList returns information about peers associated with the given file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs snapshot mirror peer_list <fs_name>
|
||||
func (sma *SnapshotMirrorAdmin) PeerList(fsname string) (
|
||||
PeerListResults, error) {
|
||||
|
46
vendor/github.com/ceph/go-ceph/cephfs/admin/pin.go
generated
vendored
Normal file
46
vendor/github.com/ceph/go-ceph/cephfs/admin/pin.go
generated
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package admin
|
||||
|
||||
// PinSubVolume pins subvolume to ranks according to policies. A valid pin
|
||||
// setting value depends on the type of pin as described in the docs from
|
||||
// https://docs.ceph.com/en/latest/cephfs/multimds/#cephfs-pinning and
|
||||
// https://docs.ceph.com/en/latest/cephfs/multimds/#setting-subtree-partitioning-policies
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume pin <vol_name> <sub_name> <pin_type> <pin_setting>
|
||||
func (fsa *FSAdmin) PinSubVolume(volume, subvolume, pintype, pinsetting string) (string, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolume pin",
|
||||
"format": "json",
|
||||
"vol_name": volume,
|
||||
"sub_name": subvolume,
|
||||
"pin_type": pintype,
|
||||
"pin_setting": pinsetting,
|
||||
}
|
||||
|
||||
return parsePathResponse(fsa.marshalMgrCommand(m))
|
||||
}
|
||||
|
||||
// PinSubVolumeGroup pins subvolume to ranks according to policies. A valid pin
|
||||
// setting value depends on the type of pin as described in the docs from
|
||||
// https://docs.ceph.com/en/latest/cephfs/multimds/#cephfs-pinning and
|
||||
// https://docs.ceph.com/en/latest/cephfs/multimds/#setting-subtree-partitioning-policies
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup pin <vol_name> <group_name> <pin_type> <pin_setting>
|
||||
func (fsa *FSAdmin) PinSubVolumeGroup(volume, group, pintype, pinsetting string) (string, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolumegroup pin",
|
||||
"format": "json",
|
||||
"vol_name": volume,
|
||||
"group_name": group,
|
||||
"pin_type": pintype,
|
||||
"pin_setting": pinsetting,
|
||||
}
|
||||
|
||||
return parsePathResponse(fsa.marshalMgrCommand(m))
|
||||
}
|
5
vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go
generated
vendored
5
vendor/github.com/ceph/go-ceph/cephfs/admin/snapshot_metadata.go
generated
vendored
@ -7,6 +7,7 @@ package admin
|
||||
// volume belonging to an optional subvolume group based on provided key name.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot metadata get <vol_name> <sub_name> <snap_name> <key_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) GetSnapshotMetadata(volume, group, subvolume, snapname, key string) (string, error) {
|
||||
m := map[string]string{
|
||||
@ -29,6 +30,7 @@ func (fsa *FSAdmin) GetSnapshotMetadata(volume, group, subvolume, snapname, key
|
||||
// volume belonging to an optional subvolume group as a key-value pair.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot metadata set <vol_name> <sub_name> <snap_name> <key_name> <value> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) SetSnapshotMetadata(volume, group, subvolume, snapname, key, value string) error {
|
||||
m := map[string]string{
|
||||
@ -53,6 +55,7 @@ func (fsa *FSAdmin) SetSnapshotMetadata(volume, group, subvolume, snapname, key,
|
||||
// metadata key.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot metadata rm <vol_name> <sub_name> <snap_name> <key_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) RemoveSnapshotMetadata(volume, group, subvolume, snapname, key string) error {
|
||||
return fsa.rmSubVolumeSnapShotMetadata(volume, group, subvolume, snapname, key, commonRmFlags{})
|
||||
@ -63,6 +66,7 @@ func (fsa *FSAdmin) RemoveSnapshotMetadata(volume, group, subvolume, snapname, k
|
||||
// subvolume group using the metadata key.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot metadata rm <vol_name> <sub_name> <snap_name> <key_name> [--group_name <subvol_group_name>] --force
|
||||
func (fsa *FSAdmin) ForceRemoveSnapshotMetadata(volume, group, subvolume, snapname, key string) error {
|
||||
return fsa.rmSubVolumeSnapShotMetadata(volume, group, subvolume, snapname, key, commonRmFlags{force: true})
|
||||
@ -89,6 +93,7 @@ func (fsa *FSAdmin) rmSubVolumeSnapShotMetadata(volume, group, subvolume, snapna
|
||||
// snapshot in a volume belonging to an optional subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot metadata ls <vol_name> <sub_name> <snap_name> [--group_name <subvol_group_name>]
|
||||
func (fsa *FSAdmin) ListSnapshotMetadata(volume, group, subvolume, snapname string) (map[string]string, error) {
|
||||
m := map[string]string{
|
||||
|
15
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolume.go
generated
vendored
15
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolume.go
generated
vendored
@ -53,6 +53,7 @@ const NoGroup = ""
|
||||
// belonging to an optional subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume create <volume> --group-name=<group> <name> ...
|
||||
func (fsa *FSAdmin) CreateSubVolume(volume, group, name string, o *SubVolumeOptions) error {
|
||||
if o == nil {
|
||||
@ -66,6 +67,7 @@ func (fsa *FSAdmin) CreateSubVolume(volume, group, name string, o *SubVolumeOpti
|
||||
// optional subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume ls <volume> --group-name=<group>
|
||||
func (fsa *FSAdmin) ListSubVolumes(volume, group string) ([]string, error) {
|
||||
m := map[string]string{
|
||||
@ -83,6 +85,7 @@ func (fsa *FSAdmin) ListSubVolumes(volume, group string) ([]string, error) {
|
||||
// subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume rm <volume> --group-name=<group> <name>
|
||||
func (fsa *FSAdmin) RemoveSubVolume(volume, group, name string) error {
|
||||
return fsa.RemoveSubVolumeWithFlags(volume, group, name, SubVolRmFlags{})
|
||||
@ -92,6 +95,7 @@ func (fsa *FSAdmin) RemoveSubVolume(volume, group, name string) error {
|
||||
// subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume rm <volume> --group-name=<group> <name> --force
|
||||
func (fsa *FSAdmin) ForceRemoveSubVolume(volume, group, name string) error {
|
||||
return fsa.RemoveSubVolumeWithFlags(volume, group, name, SubVolRmFlags{Force: true})
|
||||
@ -104,6 +108,7 @@ func (fsa *FSAdmin) ForceRemoveSubVolume(volume, group, name string) error {
|
||||
// Equivalent to ForceRemoveSubVolume if only the "Force" flag is set.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume rm <volume> --group-name=<group> <name> [...flags...]
|
||||
func (fsa *FSAdmin) RemoveSubVolumeWithFlags(volume, group, name string, o SubVolRmFlags) error {
|
||||
m := map[string]string{
|
||||
@ -141,6 +146,7 @@ type SubVolumeResizeResult struct {
|
||||
// prevent reducing the size of the volume below the current used size.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume resize <volume> --group-name=<group> <name> ...
|
||||
func (fsa *FSAdmin) ResizeSubVolume(
|
||||
volume, group, name string,
|
||||
@ -166,6 +172,7 @@ func (fsa *FSAdmin) ResizeSubVolume(
|
||||
// SubVolumePath returns the path to the subvolume from the root of the file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume getpath <volume> --group-name=<group> <name>
|
||||
func (fsa *FSAdmin) SubVolumePath(volume, group, name string) (string, error) {
|
||||
m := map[string]string{
|
||||
@ -258,6 +265,7 @@ func parseSubVolumeInfo(res response) (*SubVolumeInfo, error) {
|
||||
// SubVolumeInfo returns information about the specified subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume info <volume> --group-name=<group> <name>
|
||||
func (fsa *FSAdmin) SubVolumeInfo(volume, group, name string) (*SubVolumeInfo, error) {
|
||||
m := map[string]string{
|
||||
@ -275,6 +283,7 @@ func (fsa *FSAdmin) SubVolumeInfo(volume, group, name string) (*SubVolumeInfo, e
|
||||
// CreateSubVolumeSnapshot creates a new snapshot from the source subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot create <volume> --group-name=<group> <source> <name>
|
||||
func (fsa *FSAdmin) CreateSubVolumeSnapshot(volume, group, source, name string) error {
|
||||
m := map[string]string{
|
||||
@ -293,6 +302,7 @@ func (fsa *FSAdmin) CreateSubVolumeSnapshot(volume, group, source, name string)
|
||||
// RemoveSubVolumeSnapshot removes the specified snapshot from the subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot rm <volume> --group-name=<group> <subvolume> <name>
|
||||
func (fsa *FSAdmin) RemoveSubVolumeSnapshot(volume, group, subvolume, name string) error {
|
||||
return fsa.rmSubVolumeSnapshot(volume, group, subvolume, name, commonRmFlags{})
|
||||
@ -301,6 +311,7 @@ func (fsa *FSAdmin) RemoveSubVolumeSnapshot(volume, group, subvolume, name strin
|
||||
// ForceRemoveSubVolumeSnapshot removes the specified snapshot from the subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot rm <volume> --group-name=<group> <subvolume> <name> --force
|
||||
func (fsa *FSAdmin) ForceRemoveSubVolumeSnapshot(volume, group, subvolume, name string) error {
|
||||
return fsa.rmSubVolumeSnapshot(volume, group, subvolume, name, commonRmFlags{force: true})
|
||||
@ -324,6 +335,7 @@ func (fsa *FSAdmin) rmSubVolumeSnapshot(volume, group, subvolume, name string, o
|
||||
// ListSubVolumeSnapshots returns a listing of snapshots for a given subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot ls <volume> --group-name=<group> <name>
|
||||
func (fsa *FSAdmin) ListSubVolumeSnapshots(volume, group, name string) ([]string, error) {
|
||||
m := map[string]string{
|
||||
@ -358,6 +370,7 @@ func parseSubVolumeSnapshotInfo(res response) (*SubVolumeSnapshotInfo, error) {
|
||||
// SubVolumeSnapshotInfo returns information about the specified subvolume snapshot.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot info <volume> --group-name=<group> <subvolume> <name>
|
||||
func (fsa *FSAdmin) SubVolumeSnapshotInfo(volume, group, subvolume, name string) (*SubVolumeSnapshotInfo, error) {
|
||||
m := map[string]string{
|
||||
@ -376,6 +389,7 @@ func (fsa *FSAdmin) SubVolumeSnapshotInfo(volume, group, subvolume, name string)
|
||||
// ProtectSubVolumeSnapshot protects the specified snapshot.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot protect <volume> --group-name=<group> <subvolume> <name>
|
||||
func (fsa *FSAdmin) ProtectSubVolumeSnapshot(volume, group, subvolume, name string) error {
|
||||
m := map[string]string{
|
||||
@ -394,6 +408,7 @@ func (fsa *FSAdmin) ProtectSubVolumeSnapshot(volume, group, subvolume, name stri
|
||||
// UnprotectSubVolumeSnapshot removes protection from the specified snapshot.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot unprotect <volume> --group-name=<group> <subvolume> <name>
|
||||
func (fsa *FSAdmin) UnprotectSubVolumeSnapshot(volume, group, subvolume, name string) error {
|
||||
m := map[string]string{
|
||||
|
5
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolumegroup.go
generated
vendored
5
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolumegroup.go
generated
vendored
@ -40,6 +40,7 @@ func (s *SubVolumeGroupOptions) toFields(v, g string) *subVolumeGroupFields {
|
||||
// CreateSubVolumeGroup sends a request to create a subvolume group in a volume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup create <volume> <group_name> ...
|
||||
func (fsa *FSAdmin) CreateSubVolumeGroup(volume, name string, o *SubVolumeGroupOptions) error {
|
||||
if o == nil {
|
||||
@ -53,6 +54,7 @@ func (fsa *FSAdmin) CreateSubVolumeGroup(volume, name string, o *SubVolumeGroupO
|
||||
// specified volume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup ls cephfs <volume>
|
||||
func (fsa *FSAdmin) ListSubVolumeGroups(volume string) ([]string, error) {
|
||||
res := fsa.marshalMgrCommand(map[string]string{
|
||||
@ -65,6 +67,7 @@ func (fsa *FSAdmin) ListSubVolumeGroups(volume string) ([]string, error) {
|
||||
|
||||
// RemoveSubVolumeGroup will delete a subvolume group in a volume.
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup rm <volume> <group_name>
|
||||
func (fsa *FSAdmin) RemoveSubVolumeGroup(volume, name string) error {
|
||||
return fsa.rmSubVolumeGroup(volume, name, commonRmFlags{})
|
||||
@ -72,6 +75,7 @@ func (fsa *FSAdmin) RemoveSubVolumeGroup(volume, name string) error {
|
||||
|
||||
// ForceRemoveSubVolumeGroup will delete a subvolume group in a volume.
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup rm <volume> <group_name> --force
|
||||
func (fsa *FSAdmin) ForceRemoveSubVolumeGroup(volume, name string) error {
|
||||
return fsa.rmSubVolumeGroup(volume, name, commonRmFlags{force: true})
|
||||
@ -91,6 +95,7 @@ func (fsa *FSAdmin) rmSubVolumeGroup(volume, name string, o commonRmFlags) error
|
||||
// file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolumegroup getpath <volume> <group_name>
|
||||
func (fsa *FSAdmin) SubVolumeGroupPath(volume, name string) (string, error) {
|
||||
m := map[string]string{
|
||||
|
3
vendor/github.com/ceph/go-ceph/cephfs/admin/volume.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/cephfs/admin/volume.go
generated
vendored
@ -14,6 +14,7 @@ var (
|
||||
// ListVolumes return a list of volumes in this Ceph cluster.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs volume ls
|
||||
func (fsa *FSAdmin) ListVolumes() ([]string, error) {
|
||||
res := fsa.rawMgrCommand(listVolumesCmd)
|
||||
@ -34,6 +35,7 @@ type FSPoolInfo struct {
|
||||
// file systems.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs ls
|
||||
func (fsa *FSAdmin) ListFileSystems() ([]FSPoolInfo, error) {
|
||||
res := fsa.rawMonCommand(listFsCmd)
|
||||
@ -168,6 +170,7 @@ func parseVolumeStatus(res response) (*volumeStatusResponse, error) {
|
||||
// VolumeStatus returns a VolumeStatus object for the given volume name.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs status cephfs <name>
|
||||
func (fsa *FSAdmin) VolumeStatus(name string) (*VolumeStatus, error) {
|
||||
res := fsa.marshalMgrCommand(map[string]string{
|
||||
|
48
vendor/github.com/ceph/go-ceph/cephfs/admin/volume_info.go
generated
vendored
Normal file
48
vendor/github.com/ceph/go-ceph/cephfs/admin/volume_info.go
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
//go:build !(nautilus || octopus) && ceph_preview
|
||||
// +build !nautilus,!octopus,ceph_preview
|
||||
|
||||
package admin
|
||||
|
||||
// PoolInfo reports various properties of a pool.
|
||||
type PoolInfo struct {
|
||||
Available int `json:"avail"`
|
||||
Name string `json:"name"`
|
||||
Used int `json:"used"`
|
||||
}
|
||||
|
||||
// PoolType indicates the type of pool related to a volume.
|
||||
type PoolType struct {
|
||||
DataPool []PoolInfo `json:"data"`
|
||||
MetadataPool []PoolInfo `json:"metadata"`
|
||||
}
|
||||
|
||||
// VolInfo holds various informational values about a volume.
|
||||
type VolInfo struct {
|
||||
MonAddrs []string `json:"mon_addrs"`
|
||||
PendingSubvolDels int `json:"pending_subvolume_deletions"`
|
||||
Pools PoolType `json:"pools"`
|
||||
UsedSize int `json:"used_size"`
|
||||
}
|
||||
|
||||
func parseVolumeInfo(res response) (*VolInfo, error) {
|
||||
var info VolInfo
|
||||
if err := res.NoStatus().Unmarshal(&info).End(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
// FetchVolumeInfo fetches the information of a CephFS volume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs volume info <vol_name>
|
||||
func (fsa *FSAdmin) FetchVolumeInfo(volume string) (*VolInfo, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "fs volume info",
|
||||
"vol_name": volume,
|
||||
"format": "json",
|
||||
}
|
||||
|
||||
return parseVolumeInfo(fsa.marshalMgrCommand(m))
|
||||
}
|
2
vendor/github.com/ceph/go-ceph/common/admin/manager/module.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/common/admin/manager/module.go
generated
vendored
@ -7,6 +7,7 @@ import (
|
||||
// EnableModule will enable the specified manager module.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph mgr module enable <module> [--force]
|
||||
func (fsa *MgrAdmin) EnableModule(module string, force bool) error {
|
||||
m := map[string]string{
|
||||
@ -25,6 +26,7 @@ func (fsa *MgrAdmin) EnableModule(module string, force bool) error {
|
||||
// DisableModule will disable the specified manager module.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph mgr module disable <module>
|
||||
func (fsa *MgrAdmin) DisableModule(module string) error {
|
||||
m := map[string]string{
|
||||
|
4
vendor/github.com/ceph/go-ceph/common/admin/nfs/export.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/common/admin/nfs/export.go
generated
vendored
@ -135,6 +135,7 @@ func parseExportInfo(res commands.Response) (ExportInfo, error) {
|
||||
// CreateCephFSExport will create a new NFS export for a CephFS file system.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph nfs export create cephfs
|
||||
func (nfsa *Admin) CreateCephFSExport(spec CephFSExportSpec) (
|
||||
*ExportResult, error) {
|
||||
@ -152,6 +153,7 @@ const delSucc = "Successfully deleted export"
|
||||
// RemoveExport will remove an NFS export based on the pseudo-path of the export.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph nfs export rm
|
||||
func (nfsa *Admin) RemoveExport(clusterID, pseudoPath string) error {
|
||||
m := map[string]string{
|
||||
@ -167,6 +169,7 @@ func (nfsa *Admin) RemoveExport(clusterID, pseudoPath string) error {
|
||||
// ListDetailedExports will return a list of exports with details.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph nfs export ls --detailed
|
||||
func (nfsa *Admin) ListDetailedExports(clusterID string) ([]ExportInfo, error) {
|
||||
/*
|
||||
@ -190,6 +193,7 @@ func (nfsa *Admin) ListDetailedExports(clusterID string) ([]ExportInfo, error) {
|
||||
// pseudo-path.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph nfs export info
|
||||
func (nfsa *Admin) ExportInfo(clusterID, pseudoPath string) (ExportInfo, error) {
|
||||
m := map[string]string{
|
||||
|
5
vendor/github.com/ceph/go-ceph/rados/command.go
generated
vendored
5
vendor/github.com/ceph/go-ceph/rados/command.go
generated
vendored
@ -44,6 +44,7 @@ func (c *Conn) MonCommandWithInputBuffer(args, inputBuffer []byte) ([]byte, stri
|
||||
// PGCommand sends a command to one of the PGs
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_pg_command(rados_t cluster, const char *pgstr,
|
||||
// const char **cmd, size_t cmdlen,
|
||||
// const char *inbuf, size_t inbuflen,
|
||||
@ -56,6 +57,7 @@ func (c *Conn) PGCommand(pgid []byte, args [][]byte) ([]byte, string, error) {
|
||||
// PGCommandWithInputBuffer sends a command to one of the PGs, with an input buffer
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_pg_command(rados_t cluster, const char *pgstr,
|
||||
// const char **cmd, size_t cmdlen,
|
||||
// const char *inbuf, size_t inbuflen,
|
||||
@ -92,6 +94,7 @@ func (c *Conn) MgrCommand(args [][]byte) ([]byte, string, error) {
|
||||
// MgrCommandWithInputBuffer sends a command, with an input buffer, to a ceph-mgr.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_mgr_command(rados_t cluster, const char **cmd,
|
||||
// size_t cmdlen, const char *inbuf,
|
||||
// size_t inbuflen, char **outbuf,
|
||||
@ -126,6 +129,7 @@ func (c *Conn) OsdCommand(osd int, args [][]byte) ([]byte, string, error) {
|
||||
// specified ceph OSD.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_osd_command(rados_t cluster, int osdid,
|
||||
// const char **cmd, size_t cmdlen,
|
||||
// const char *inbuf, size_t inbuflen,
|
||||
@ -162,6 +166,7 @@ func (c *Conn) MonCommandTarget(name string, args [][]byte) ([]byte, string, err
|
||||
// MonCommandTargetWithInputBuffer sends a command, with an input buffer, to a specified monitor.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_mon_command_target(rados_t cluster, const char *name,
|
||||
// const char **cmd, size_t cmdlen,
|
||||
// const char *inbuf, size_t inbuflen,
|
||||
|
2
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
@ -95,6 +95,7 @@ func (c *Conn) ReadDefaultConfigFile() error {
|
||||
// OpenIOContext creates and returns a new IOContext for the given pool.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_create(rados_t cluster, const char *pool_name,
|
||||
// rados_ioctx_t *ioctx);
|
||||
func (c *Conn) OpenIOContext(pool string) (*IOContext, error) {
|
||||
@ -200,6 +201,7 @@ func (c *Conn) GetClusterStats() (stat ClusterStat, err error) {
|
||||
// argument vector.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_conf_parse_argv(rados_t cluster, int argc,
|
||||
// const char **argv);
|
||||
func (c *Conn) ParseConfigArgv(argv []string) error {
|
||||
|
10
vendor/github.com/ceph/go-ceph/rados/ioctx.go
generated
vendored
10
vendor/github.com/ceph/go-ceph/rados/ioctx.go
generated
vendored
@ -125,6 +125,7 @@ func (ioctx *IOContext) Pointer() unsafe.Pointer {
|
||||
// Setting namespace to a empty or zero length string sets the pool to the default namespace.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_ioctx_set_namespace(rados_ioctx_t io,
|
||||
// const char *nspace);
|
||||
func (ioctx *IOContext) SetNamespace(namespace string) {
|
||||
@ -139,6 +140,7 @@ func (ioctx *IOContext) SetNamespace(namespace string) {
|
||||
// Create a new object with key oid.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_create(rados_write_op_t write_op, int exclusive,
|
||||
// const char* category)
|
||||
func (ioctx *IOContext) Create(oid string, exclusive CreateOption) error {
|
||||
@ -247,6 +249,7 @@ func (ioctx *IOContext) Destroy() {
|
||||
// context.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_pool_stat(rados_ioctx_t io,
|
||||
// struct rados_pool_stat_t *stats);
|
||||
func (ioctx *IOContext) GetPoolStats() (stat PoolStat, err error) {
|
||||
@ -274,6 +277,7 @@ func (ioctx *IOContext) GetPoolStats() (stat PoolStat, err error) {
|
||||
// GetPoolID returns the pool ID associated with the I/O context.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int64_t rados_ioctx_get_id(rados_ioctx_t io)
|
||||
func (ioctx *IOContext) GetPoolID() int64 {
|
||||
ret := C.rados_ioctx_get_id(ioctx.ioctx)
|
||||
@ -328,7 +332,8 @@ func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error {
|
||||
defer C.rados_object_list_cursor_free(ioctx.ioctx, finish)
|
||||
|
||||
for {
|
||||
ret := C.rados_object_list(ioctx.ioctx, next, finish, pageResults, nil, filterLen, (*C.rados_object_list_item)(unsafe.Pointer(&results[0])), &next)
|
||||
res := (*C.rados_object_list_item)(unsafe.Pointer(&results[0]))
|
||||
ret := C.rados_object_list(ioctx.ioctx, next, finish, pageResults, nil, filterLen, res, &next)
|
||||
if ret < 0 {
|
||||
return getError(ret)
|
||||
}
|
||||
@ -338,6 +343,7 @@ func (ioctx *IOContext) ListObjects(listFn ObjectListFunc) error {
|
||||
item := results[i]
|
||||
listFn(C.GoStringN(item.oid, (C.int)(item.oid_length)))
|
||||
}
|
||||
C.rados_object_list_free(C.size_t(ret), res)
|
||||
|
||||
if C.rados_object_list_is_end(ioctx.ioctx, next) == listEndSentinel {
|
||||
return nil
|
||||
@ -678,6 +684,7 @@ func (ioctx *IOContext) BreakLock(oid, name, client, cookie string) (int, error)
|
||||
// written to.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// uint64_t rados_get_last_version(rados_ioctx_t io);
|
||||
func (ioctx *IOContext) GetLastVersion() (uint64, error) {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -690,6 +697,7 @@ func (ioctx *IOContext) GetLastVersion() (uint64, error) {
|
||||
// GetNamespace gets the namespace used for objects within this IO context.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_get_namespace(rados_ioctx_t io, char *buf,
|
||||
// unsigned maxlen);
|
||||
func (ioctx *IOContext) GetNamespace() (string, error) {
|
||||
|
2
vendor/github.com/ceph/go-ceph/rados/ioctx_nautilus.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rados/ioctx_nautilus.go
generated
vendored
@ -13,6 +13,7 @@ import "C"
|
||||
// or return EDQUOT or ENOSPC.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_set_osdmap_full_try(rados_ioctx_t io);
|
||||
func (ioctx *IOContext) SetPoolFullTry() error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -25,6 +26,7 @@ func (ioctx *IOContext) SetPoolFullTry() error {
|
||||
// UnsetPoolFullTry unsets the flag set by SetPoolFullTry()
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_unset_osdmap_full_try(rados_ioctx_t io);
|
||||
func (ioctx *IOContext) UnsetPoolFullTry() error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
|
2
vendor/github.com/ceph/go-ceph/rados/ioctx_octopus.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rados/ioctx_octopus.go
generated
vendored
@ -16,6 +16,7 @@ import "C"
|
||||
// or return EDQUOT or ENOSPC.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_set_pool_full_try(rados_ioctx_t io);
|
||||
func (ioctx *IOContext) SetPoolFullTry() error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -28,6 +29,7 @@ func (ioctx *IOContext) SetPoolFullTry() error {
|
||||
// UnsetPoolFullTry unsets the flag set by SetPoolFullTry()
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_unset_pool_full_try(rados_ioctx_t io);
|
||||
func (ioctx *IOContext) UnsetPoolFullTry() error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_alignment.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_alignment.go
generated
vendored
@ -11,6 +11,7 @@ import "C"
|
||||
// alignment or not, use RequiresAlignment.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_pool_required_alignment2(rados_ioctx_t io, uint64_t *alignment)
|
||||
func (ioctx *IOContext) Alignment() (uint64, error) {
|
||||
var alignSizeBytes C.uint64_t
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_requires_alignment.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/ioctx_pool_requires_alignment.go
generated
vendored
@ -11,6 +11,7 @@ import "C"
|
||||
// Alignment to know how to get the stripe size for pools requiring it.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_pool_requires_alignment2(rados_ioctx_t io, int *req)
|
||||
func (ioctx *IOContext) RequiresAlignment() (bool, error) {
|
||||
var alignRequired C.int
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/ioctx_set_alloc_hint.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/ioctx_set_alloc_hint.go
generated
vendored
@ -16,6 +16,7 @@ import (
|
||||
// the backend.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_set_alloc_hint2(rados_ioctx_t io,
|
||||
// const char *o,
|
||||
// uint64_t expected_object_size,
|
||||
|
2
vendor/github.com/ceph/go-ceph/rados/object_iter.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rados/object_iter.go
generated
vendored
@ -42,13 +42,13 @@ func (iter *Iter) Seek(token IterToken) {
|
||||
// end of the iterator was reached, or the iterator received an error.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// iter := pool.Iter()
|
||||
// defer iter.Close()
|
||||
// for iter.Next() {
|
||||
// fmt.Printf("%v\n", iter.Value())
|
||||
// }
|
||||
// return iter.Err()
|
||||
//
|
||||
func (iter *Iter) Next() bool {
|
||||
var cEntry *C.char
|
||||
var cNamespace *C.char
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/rados_read_op_assert_version.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/rados_read_op_assert_version.go
generated
vendored
@ -11,6 +11,7 @@ import "C"
|
||||
// previously obtained with IOContext.GetLastVersion().
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_read_op_assert_version(rados_read_op_t read_op,
|
||||
// uint64_t ver)
|
||||
func (r *ReadOp) AssertVersion(ver uint64) {
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/rados_set_locator.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/rados_set_locator.go
generated
vendored
@ -15,6 +15,7 @@ import (
|
||||
// To reset the locator, an empty string must be set.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_ioctx_locator_set_key(rados_ioctx_t io, const char *key);
|
||||
func (ioctx *IOContext) SetLocator(locator string) {
|
||||
if locator == "" {
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_assert_version.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_assert_version.go
generated
vendored
@ -11,6 +11,7 @@ import "C"
|
||||
// previously obtained with IOContext.GetLastVersion().
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_read_op_assert_version(rados_read_op_t read_op,
|
||||
// uint64_t ver)
|
||||
func (w *WriteOp) AssertVersion(ver uint64) {
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_remove.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_remove.go
generated
vendored
@ -9,6 +9,7 @@ import "C"
|
||||
// Remove object.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_remove(rados_write_op_t write_op)
|
||||
func (w *WriteOp) Remove() {
|
||||
C.rados_write_op_remove(w.op)
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_setxattr.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/rados_write_op_setxattr.go
generated
vendored
@ -13,6 +13,7 @@ import (
|
||||
// SetXattr sets an xattr.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_setxattr(rados_write_op_t write_op,
|
||||
// const char * name,
|
||||
// const char * value,
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/read_op.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/read_op.go
generated
vendored
@ -59,6 +59,7 @@ func (r *ReadOp) operateCompat(ioctx *IOContext, oid string) error {
|
||||
// AssertExists assures the object targeted by the read op exists.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_read_op_assert_exists(rados_read_op_t read_op);
|
||||
func (r *ReadOp) AssertExists() {
|
||||
C.rados_read_op_assert_exists(r.op)
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/read_op_omap_get_vals_by_keys.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/read_op_omap_get_vals_by_keys.go
generated
vendored
@ -86,6 +86,7 @@ func (s *ReadOpOmapGetValsByKeysStep) Next() (*OmapKeyValue, error) {
|
||||
// GetOmapValuesByKeys starts iterating over specific key/value pairs.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_read_op_omap_get_vals_by_keys2(rados_read_op_t read_op,
|
||||
// char const * const * keys,
|
||||
// size_t num_keys,
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/read_op_read.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/read_op_read.go
generated
vendored
@ -48,6 +48,7 @@ func newReadOpReadStep() *ReadOpReadStep {
|
||||
// buffer[:ReadOpReadStep.BytesRead] then contains object data.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_read_op_read(rados_read_op_t read_op,
|
||||
// uint64_t offset,
|
||||
// size_t len,
|
||||
|
7
vendor/github.com/ceph/go-ceph/rados/snapshot.go
generated
vendored
7
vendor/github.com/ceph/go-ceph/rados/snapshot.go
generated
vendored
@ -31,6 +31,7 @@ func (ioctx *IOContext) CreateSnap(snapName string) error {
|
||||
// RemoveSnap deletes the pool snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_remove(rados_ioctx_t io, const char *snapname)
|
||||
func (ioctx *IOContext) RemoveSnap(snapName string) error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -50,6 +51,7 @@ type SnapID C.rados_snap_t
|
||||
// LookupSnap returns the ID of a pool snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_lookup(rados_ioctx_t io, const char *name, rados_snap_t *id)
|
||||
func (ioctx *IOContext) LookupSnap(snapName string) (SnapID, error) {
|
||||
var snapID SnapID
|
||||
@ -71,6 +73,7 @@ func (ioctx *IOContext) LookupSnap(snapName string) (SnapID, error) {
|
||||
// GetSnapName returns the name of a pool snapshot with the given snapshot ID.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_get_name(rados_ioctx_t io, rados_snap_t id, char *name, int maxlen)
|
||||
func (ioctx *IOContext) GetSnapName(snapID SnapID) (string, error) {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -103,6 +106,7 @@ func (ioctx *IOContext) GetSnapName(snapID SnapID) (string, error) {
|
||||
// GetSnapStamp returns the time of the pool snapshot creation.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_get_stamp(rados_ioctx_t io, rados_snap_t id, time_t *t)
|
||||
func (ioctx *IOContext) GetSnapStamp(snapID SnapID) (time.Time, error) {
|
||||
var cTime C.time_t
|
||||
@ -121,6 +125,7 @@ func (ioctx *IOContext) GetSnapStamp(snapID SnapID) (time.Time, error) {
|
||||
// ListSnaps returns a slice containing the SnapIDs of existing pool snapshots.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_list(rados_ioctx_t io, rados_snap_t *snaps, int maxlen)
|
||||
func (ioctx *IOContext) ListSnaps() ([]SnapID, error) {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -154,6 +159,7 @@ func (ioctx *IOContext) ListSnaps() ([]SnapID, error) {
|
||||
// The contents of the object will be the same as when the snapshot was taken.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_ioctx_snap_rollback(rados_ioctx_t io, const char *oid, const char *snapname);
|
||||
func (ioctx *IOContext) RollbackSnap(oid, snapName string) error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
@ -178,6 +184,7 @@ const SnapHead = SnapID(C.LIBRADOS_SNAP_HEAD)
|
||||
// Pass SnapHead for no snapshot (i.e. normal operation).
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_ioctx_snap_set_read(rados_ioctx_t io, rados_snap_t snap);
|
||||
func (ioctx *IOContext) SetReadSnap(snapID SnapID) error {
|
||||
if err := ioctx.validate(); err != nil {
|
||||
|
8
vendor/github.com/ceph/go-ceph/rados/watcher.go
generated
vendored
8
vendor/github.com/ceph/go-ceph/rados/watcher.go
generated
vendored
@ -91,6 +91,7 @@ var (
|
||||
// IOContext is being destroyed.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_watch2(rados_ioctx_t io, const char* o, uint64_t* cookie,
|
||||
// rados_watchcb2_t watchcb, rados_watcherrcb_t watcherrcb, void* arg)
|
||||
func (ioctx *IOContext) Watch(obj string) (*Watcher, error) {
|
||||
@ -101,6 +102,7 @@ func (ioctx *IOContext) Watch(obj string) (*Watcher, error) {
|
||||
// different timeout than the default can be specified.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_watch3(rados_ioctx_t io, const char *o, uint64_t *cookie,
|
||||
// rados_watchcb2_t watchcb, rados_watcherrcb_t watcherrcb, uint32_t timeout,
|
||||
// void *arg);
|
||||
@ -158,6 +160,7 @@ func (w *Watcher) Errors() <-chan error {
|
||||
// Watcher is no longer valid, and should be destroyed with the Delete() method.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_watch_check(rados_ioctx_t io, uint64_t cookie)
|
||||
func (w *Watcher) Check() (time.Duration, error) {
|
||||
ret := C.rados_watch_check(w.ioctx.ioctx, C.uint64_t(w.id))
|
||||
@ -170,6 +173,7 @@ func (w *Watcher) Check() (time.Duration, error) {
|
||||
// Delete the watcher. This closes both the event and error channel.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_unwatch2(rados_ioctx_t io, uint64_t cookie)
|
||||
func (w *Watcher) Delete() error {
|
||||
watchersMtx.Lock()
|
||||
@ -204,6 +208,7 @@ func (ioctx *IOContext) Notify(obj string, data []byte) ([]NotifyAck, []NotifyTi
|
||||
// default.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_notify2(rados_ioctx_t io, const char* o, const char* buf, int buf_len,
|
||||
// uint64_t timeout_ms, char** reply_buffer, size_t* reply_buffer_len)
|
||||
func (ioctx *IOContext) NotifyWithTimeout(obj string, data []byte, timeout time.Duration) ([]NotifyAck,
|
||||
@ -236,6 +241,7 @@ func (ioctx *IOContext) NotifyWithTimeout(obj string, data []byte, timeout time.
|
||||
// blocks and eventiually times out.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_notify_ack(rados_ioctx_t io, const char *o, uint64_t notify_id,
|
||||
// uint64_t cookie, const char *buf, int buf_len)
|
||||
func (ne *NotifyEvent) Ack(response []byte) error {
|
||||
@ -265,6 +271,7 @@ func (ne *NotifyEvent) Ack(response []byte) error {
|
||||
// WatcherFlush flushes all pending notifications of the cluster.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rados_watch_flush(rados_t cluster)
|
||||
func (c *Conn) WatcherFlush() error {
|
||||
if !c.connected {
|
||||
@ -275,6 +282,7 @@ func (c *Conn) WatcherFlush() error {
|
||||
}
|
||||
|
||||
// decoder for this notify response format:
|
||||
//
|
||||
// le32 num_acks
|
||||
// {
|
||||
// le64 gid global id for the client (for client.1234 that's 1234)
|
||||
|
4
vendor/github.com/ceph/go-ceph/rados/write_op.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rados/write_op.go
generated
vendored
@ -136,6 +136,7 @@ func (w *WriteOp) CleanOmap() {
|
||||
// AssertExists assures the object targeted by the write op exists.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_assert_exists(rados_write_op_t write_op);
|
||||
func (w *WriteOp) AssertExists() {
|
||||
C.rados_write_op_assert_exists(w.op)
|
||||
@ -144,6 +145,7 @@ func (w *WriteOp) AssertExists() {
|
||||
// Write a given byte slice at the supplied offset.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_write(rados_write_op_t write_op,
|
||||
// const char *buffer,
|
||||
// size_t len,
|
||||
@ -162,6 +164,7 @@ func (w *WriteOp) Write(b []byte, offset uint64) {
|
||||
// atomically replacing it.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_write_full(rados_write_op_t write_op,
|
||||
// const char *buffer,
|
||||
// size_t len);
|
||||
@ -178,6 +181,7 @@ func (w *WriteOp) WriteFull(b []byte) {
|
||||
// writeLen is satisfied.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_writesame(rados_write_op_t write_op,
|
||||
// const char *buffer,
|
||||
// size_t data_len,
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/write_op_cmpext.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/write_op_cmpext.go
generated
vendored
@ -39,6 +39,7 @@ func newWriteOpCmpExtStep() *WriteOpCmpExtStep {
|
||||
// CmpExt ensures that given object range (extent) satisfies comparison.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_cmpext(rados_write_op_t write_op,
|
||||
// const char * cmp_buf,
|
||||
// size_t cmp_len,
|
||||
|
1
vendor/github.com/ceph/go-ceph/rados/write_op_set_alloc_hint.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rados/write_op_set_alloc_hint.go
generated
vendored
@ -12,6 +12,7 @@ import "C"
|
||||
// the backend.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rados_write_op_set_alloc_hint2(rados_write_op_t write_op,
|
||||
// uint64_t expected_object_size,
|
||||
// uint64_t expected_write_size,
|
||||
|
4
vendor/github.com/ceph/go-ceph/rbd/admin/msschedule.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rbd/admin/msschedule.go
generated
vendored
@ -40,6 +40,7 @@ func (ra *RBDAdmin) MirrorSnashotSchedule() *MirrorSnashotScheduleAdmin {
|
||||
// level spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd mirror snapshot schedule add <level_spec> <interval> <start_time>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Add(l LevelSpec, i Interval, s StartTime) error {
|
||||
m := map[string]string{
|
||||
@ -59,6 +60,7 @@ func (mss *MirrorSnashotScheduleAdmin) Add(l LevelSpec, i Interval, s StartTime)
|
||||
// List the snapshot schedules based on the supplied level spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd mirror snapshot schedule list <level_spec>
|
||||
func (mss *MirrorSnashotScheduleAdmin) List(l LevelSpec) ([]SnapshotSchedule, error) {
|
||||
m := map[string]string{
|
||||
@ -114,6 +116,7 @@ func parseMirrorSnapshotScheduleList(res commands.Response) (
|
||||
// Remove a snapshot schedule matching the supplied arguments.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd mirror snapshot schedule remove <level_spec> <interval> <start_time>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Remove(
|
||||
l LevelSpec, i Interval, s StartTime) error {
|
||||
@ -136,6 +139,7 @@ func (mss *MirrorSnashotScheduleAdmin) Remove(
|
||||
// matching the supplied level spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd mirror snapshot schedule status <level_spec>
|
||||
func (mss *MirrorSnashotScheduleAdmin) Status(l LevelSpec) ([]ScheduledImage, error) {
|
||||
m := map[string]string{
|
||||
|
6
vendor/github.com/ceph/go-ceph/rbd/admin/task.go
generated
vendored
6
vendor/github.com/ceph/go-ceph/rbd/admin/task.go
generated
vendored
@ -56,6 +56,7 @@ func parseTaskResponseList(res commands.Response) ([]TaskResponse, error) {
|
||||
// supplied image spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task add flatten <image_spec>
|
||||
func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
@ -70,6 +71,7 @@ func (ta *TaskAdmin) AddFlatten(img ImageSpec) (TaskResponse, error) {
|
||||
// image spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task add remove <image_spec>
|
||||
func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
@ -84,6 +86,7 @@ func (ta *TaskAdmin) AddRemove(img ImageSpec) (TaskResponse, error) {
|
||||
// on the supplied image id spec.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task add trash remove <image_id_spec>
|
||||
func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
@ -97,6 +100,7 @@ func (ta *TaskAdmin) AddTrashRemove(img ImageSpec) (TaskResponse, error) {
|
||||
// List pending or running asynchronous tasks.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task list
|
||||
func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
@ -109,6 +113,7 @@ func (ta *TaskAdmin) List() ([]TaskResponse, error) {
|
||||
// GetTaskByID returns pending or running asynchronous task using id.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task list <task_id>
|
||||
func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
@ -122,6 +127,7 @@ func (ta *TaskAdmin) GetTaskByID(taskID string) (TaskResponse, error) {
|
||||
// Cancel a pending or running asynchronous task.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// rbd task cancel <task_id>
|
||||
func (ta *TaskAdmin) Cancel(taskID string) (TaskResponse, error) {
|
||||
m := map[string]string{
|
||||
|
1
vendor/github.com/ceph/go-ceph/rbd/diff_iterate.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rbd/diff_iterate.go
generated
vendored
@ -84,6 +84,7 @@ const (
|
||||
// arguments to the callback and the return behavior.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_diff_iterate2(rbd_image_t image,
|
||||
// const char *fromsnapname,
|
||||
// uint64_t ofs, uint64_t len,
|
||||
|
2
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rbd/encryption.go
generated
vendored
@ -91,6 +91,7 @@ func (opts EncryptionOptionsLUKS2) allocateEncryptionOptions() cEncryptionData {
|
||||
// EncryptionFormat creates an encryption format header
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_encryption_format(rbd_image_t image,
|
||||
// rbd_encryption_format_t format,
|
||||
// rbd_encryption_options_t opts,
|
||||
@ -119,6 +120,7 @@ func (image *Image) EncryptionFormat(opts EncryptionOptions) error {
|
||||
// EncryptionLoad enables IO on an open encrypted image
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_encryption_load(rbd_image_t image,
|
||||
// rbd_encryption_format_t format,
|
||||
// rbd_encryption_options_t opts,
|
||||
|
2
vendor/github.com/ceph/go-ceph/rbd/features.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rbd/features.go
generated
vendored
@ -154,6 +154,7 @@ func (fs *FeatureSet) Names() []string {
|
||||
// GetFeatures returns the features bitmask for the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_features(rbd_image_t image, uint64_t *features);
|
||||
func (image *Image) GetFeatures() (features uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -170,6 +171,7 @@ func (image *Image) GetFeatures() (features uint64, err error) {
|
||||
// UpdateFeatures updates the features on the Image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_update_features(rbd_image_t image, uint64_t features,
|
||||
// uint8_t enabled);
|
||||
func (image *Image) UpdateFeatures(features uint64, enabled bool) error {
|
||||
|
9
vendor/github.com/ceph/go-ceph/rbd/group.go
generated
vendored
9
vendor/github.com/ceph/go-ceph/rbd/group.go
generated
vendored
@ -18,6 +18,7 @@ import (
|
||||
// GroupCreate is used to create an image group.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_create(rados_ioctx_t p, const char *name);
|
||||
func GroupCreate(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
@ -30,6 +31,7 @@ func GroupCreate(ioctx *rados.IOContext, name string) error {
|
||||
// GroupRemove is used to remove an image group.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_remove(rados_ioctx_t p, const char *name);
|
||||
func GroupRemove(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
@ -42,6 +44,7 @@ func GroupRemove(ioctx *rados.IOContext, name string) error {
|
||||
// GroupRename will rename an existing image group.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_rename(rados_ioctx_t p, const char *src_name,
|
||||
// const char *dest_name);
|
||||
func GroupRename(ioctx *rados.IOContext, src, dest string) error {
|
||||
@ -57,6 +60,7 @@ func GroupRename(ioctx *rados.IOContext, src, dest string) error {
|
||||
// GroupList returns a slice of image group names.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_list(rados_ioctx_t p, char *names, size_t *size);
|
||||
func GroupList(ioctx *rados.IOContext) ([]string, error) {
|
||||
var (
|
||||
@ -89,6 +93,7 @@ func GroupList(ioctx *rados.IOContext) ([]string, error) {
|
||||
// An io context must be supplied for both the group and image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_image_add(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rados_ioctx_t image_p,
|
||||
@ -113,6 +118,7 @@ func GroupImageAdd(groupIoctx *rados.IOContext, groupName string,
|
||||
// An io context must be supplied for both the group and image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_image_remove(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rados_ioctx_t image_p,
|
||||
@ -137,6 +143,7 @@ func GroupImageRemove(groupIoctx *rados.IOContext, groupName string,
|
||||
// An io context must be supplied for both the group and image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// CEPH_RBD_API int rbd_group_image_remove_by_id(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rados_ioctx_t image_p,
|
||||
@ -178,6 +185,7 @@ type GroupImageInfo struct {
|
||||
// images that are part of the named group.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_image_list(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rbd_group_image_info_t *images,
|
||||
@ -233,6 +241,7 @@ type GroupInfo struct {
|
||||
// GetGroup returns group info for the group this image is part of.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_group(rbd_image_t image, rbd_group_info_t *group_info,
|
||||
// size_t group_info_size);
|
||||
func (image *Image) GetGroup() (GroupInfo, error) {
|
||||
|
6
vendor/github.com/ceph/go-ceph/rbd/group_snap.go
generated
vendored
6
vendor/github.com/ceph/go-ceph/rbd/group_snap.go
generated
vendored
@ -29,6 +29,7 @@ import (
|
||||
// GroupSnapCreate will create a group snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_create(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
@ -45,6 +46,7 @@ func GroupSnapCreate(ioctx *rados.IOContext, group, snap string) error {
|
||||
// GroupSnapRemove removes an existing group snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_remove(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
@ -61,6 +63,7 @@ func GroupSnapRemove(ioctx *rados.IOContext, group, snap string) error {
|
||||
// GroupSnapRename will rename an existing group snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_rename(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *old_snap_name,
|
||||
@ -98,6 +101,7 @@ type GroupSnapInfo struct {
|
||||
// GroupSnapList returns a slice of snapshots in a group.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_list(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// rbd_group_snap_info_t *snaps,
|
||||
@ -147,6 +151,7 @@ func GroupSnapList(ioctx *rados.IOContext, group string) ([]GroupSnapInfo, error
|
||||
// given snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_rollback(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name);
|
||||
@ -174,6 +179,7 @@ var groupSnapRollbackCallbacks = callbacks.New()
|
||||
// to report on the progress of the snapshot rollback.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_group_snap_rollback_with_progress(rados_ioctx_t group_p,
|
||||
// const char *group_name,
|
||||
// const char *snap_name,
|
||||
|
4
vendor/github.com/ceph/go-ceph/rbd/metadata.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rbd/metadata.go
generated
vendored
@ -15,6 +15,7 @@ import (
|
||||
// GetMetadata returns the metadata string associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_metadata_get(rbd_image_t image, const char *key, char *value, size_t *vallen)
|
||||
func (image *Image) GetMetadata(key string) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -47,6 +48,7 @@ func (image *Image) GetMetadata(key string) (string, error) {
|
||||
// SetMetadata updates the metadata string associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_metadata_set(rbd_image_t image, const char *key, const char *value)
|
||||
func (image *Image) SetMetadata(key string, value string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -69,6 +71,7 @@ func (image *Image) SetMetadata(key string, value string) error {
|
||||
// RemoveMetadata clears the metadata associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_metadata_remove(rbd_image_t image, const char *key)
|
||||
func (image *Image) RemoveMetadata(key string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -89,6 +92,7 @@ func (image *Image) RemoveMetadata(key string) error {
|
||||
// ListMetadata returns a map containing all metadata assigned to the RBD image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_metadata_list(rbd_image_t image, const char *start, uint64_t max,
|
||||
// char *keys, size_t *key_len, char *values, size_t *vals_len);
|
||||
func (image *Image) ListMetadata() (map[string]string, error) {
|
||||
|
12
vendor/github.com/ceph/go-ceph/rbd/migration.go
generated
vendored
12
vendor/github.com/ceph/go-ceph/rbd/migration.go
generated
vendored
@ -62,12 +62,12 @@ type MigrationImageStatus struct {
|
||||
// to source and making source read-only.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_prepare(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
//
|
||||
func MigrationPrepare(ioctx *rados.IOContext, sourceImageName string, destIoctx *rados.IOContext, destImageName string, rio *ImageOptions) error {
|
||||
cSourceImageName := C.CString(sourceImageName)
|
||||
cDestImageName := C.CString(destImageName)
|
||||
@ -90,11 +90,11 @@ func MigrationPrepare(ioctx *rados.IOContext, sourceImageName string, destIoctx
|
||||
// from a specified source to a new target image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_prepare_import(const char *source_spec,
|
||||
// rados_ioctx_t dest_ioctx,
|
||||
// const char *dest_image_name,
|
||||
// rbd_image_options_t opts);
|
||||
//
|
||||
func MigrationPrepareImport(sourceSpec string, ioctx *rados.IOContext, destImageName string, rio *ImageOptions) error {
|
||||
cSourceSpec := C.CString(sourceSpec)
|
||||
cDestImageName := C.CString(destImageName)
|
||||
@ -116,9 +116,9 @@ func MigrationPrepareImport(sourceSpec string, ioctx *rados.IOContext, destImage
|
||||
// from the source image to the target image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_execute(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
func MigrationExecute(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -136,9 +136,9 @@ func MigrationExecute(ioctx *rados.IOContext, name string) error {
|
||||
// breaking the relationship of image to the source.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_commit(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
func MigrationCommit(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -156,9 +156,9 @@ func MigrationCommit(ioctx *rados.IOContext, name string) error {
|
||||
// breaking the relationship of image to the source.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_abort(rados_ioctx_t ioctx,
|
||||
// const char *image_name);
|
||||
//
|
||||
func MigrationAbort(ioctx *rados.IOContext, name string) error {
|
||||
cName := C.CString(name)
|
||||
|
||||
@ -176,11 +176,11 @@ func MigrationAbort(ioctx *rados.IOContext, name string) error {
|
||||
// for the specified image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_migration_status(rados_ioctx_t ioctx,
|
||||
// const char *image_name,
|
||||
// rbd_image_migration_status_t *status,
|
||||
// size_t status_size);
|
||||
//
|
||||
func MigrationStatus(ioctx *rados.IOContext, name string) (*MigrationImageStatus, error) {
|
||||
cName := C.CString(name)
|
||||
|
||||
|
21
vendor/github.com/ceph/go-ceph/rbd/mirror.go
generated
vendored
21
vendor/github.com/ceph/go-ceph/rbd/mirror.go
generated
vendored
@ -81,6 +81,7 @@ func (imm ImageMirrorMode) String() string {
|
||||
// associated with the ioctx.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_uuid_get(rados_ioctx_t io_ctx, char *uuid, size_t
|
||||
// *max_len);
|
||||
func GetMirrorUUID(ioctx *rados.IOContext) (string, error) {
|
||||
@ -109,6 +110,7 @@ func GetMirrorUUID(ioctx *rados.IOContext) (string, error) {
|
||||
// an automatic or per-image behavior.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_mode_set(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_mode_t mirror_mode);
|
||||
func SetMirrorMode(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
@ -121,6 +123,7 @@ func SetMirrorMode(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
// GetMirrorMode is used to fetch the current mirroring mode for a pool.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_mode_get(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_mode_t *mirror_mode);
|
||||
func GetMirrorMode(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
@ -138,6 +141,7 @@ func GetMirrorMode(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
// MirrorEnable will enable mirroring for an image using the specified mode.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_enable2(rbd_image_t image,
|
||||
// rbd_mirror_image_mode_t mode);
|
||||
func (image *Image) MirrorEnable(mode ImageMirrorMode) error {
|
||||
@ -151,6 +155,7 @@ func (image *Image) MirrorEnable(mode ImageMirrorMode) error {
|
||||
// MirrorDisable will disable mirroring for the image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force);
|
||||
func (image *Image) MirrorDisable(force bool) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -163,6 +168,7 @@ func (image *Image) MirrorDisable(force bool) error {
|
||||
// MirrorPromote will promote the image to primary status.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force);
|
||||
func (image *Image) MirrorPromote(force bool) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -175,6 +181,7 @@ func (image *Image) MirrorPromote(force bool) error {
|
||||
// MirrorDemote will demote the image to secondary status.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_demote(rbd_image_t image);
|
||||
func (image *Image) MirrorDemote() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -188,6 +195,7 @@ func (image *Image) MirrorDemote() error {
|
||||
// resynchronization.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_resync(rbd_image_t image);
|
||||
func (image *Image) MirrorResync() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -200,6 +208,7 @@ func (image *Image) MirrorResync() error {
|
||||
// MirrorInstanceID returns a string naming the instance id for the image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_get_instance_id(rbd_image_t image,
|
||||
// char *instance_id,
|
||||
// size_t *id_max_length);
|
||||
@ -275,6 +284,7 @@ func convertMirrorImageInfo(cInfo *C.rbd_mirror_image_info_t) MirrorImageInfo {
|
||||
// GetMirrorImageInfo fetches the mirroring status information of a RBD image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_get_info(rbd_image_t image,
|
||||
// rbd_mirror_image_info_t *mirror_image_info,
|
||||
// size_t info_size)
|
||||
@ -303,6 +313,7 @@ func (image *Image) GetMirrorImageInfo() (*MirrorImageInfo, error) {
|
||||
// GetImageMirrorMode fetches the mirroring approach for an RBD image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_get_mode(rbd_image_t image, rbd_mirror_image_mode_t *mode);
|
||||
func (image *Image) GetImageMirrorMode() (ImageMirrorMode, error) {
|
||||
var mode C.rbd_mirror_image_mode_t
|
||||
@ -404,6 +415,7 @@ type siteArray [cutil.MaxIdx]C.rbd_mirror_image_site_status_t
|
||||
// of the images's mirroring.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_get_global_status(
|
||||
// rbd_image_t image,
|
||||
// rbd_mirror_image_global_status_t *mirror_image_global_status,
|
||||
@ -453,6 +465,7 @@ func newGlobalMirrorImageStatus(
|
||||
// CreateMirrorSnapshot creates a snapshot for image propagation to mirrors.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_create_snapshot(rbd_image_t image,
|
||||
// uint64_t *snap_id);
|
||||
func (image *Image) CreateMirrorSnapshot() (uint64, error) {
|
||||
@ -467,6 +480,7 @@ func (image *Image) CreateMirrorSnapshot() (uint64, error) {
|
||||
// of images with said status.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_status_summary(
|
||||
// rados_ioctx_t io_ctx, rbd_mirror_image_status_state_t *states, int *counts,
|
||||
// size_t *maxlen);
|
||||
@ -513,6 +527,7 @@ func MirrorImageStatusSummary(
|
||||
// cluster associated with the provided rados connection.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_site_name_set(rados_t cluster,
|
||||
// const char *name);
|
||||
func SetMirrorSiteName(conn *rados.Conn, name string) error {
|
||||
@ -530,6 +545,7 @@ func SetMirrorSiteName(conn *rados.Conn, name string) error {
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_site_name_get(rados_t cluster,
|
||||
//
|
||||
// char *name, size_t *max_len);
|
||||
func GetMirrorSiteName(conn *rados.Conn) (string, error) {
|
||||
|
||||
@ -562,6 +578,7 @@ func GetMirrorSiteName(conn *rados.Conn) (string, error) {
|
||||
// pools.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_bootstrap_create(
|
||||
// rados_ioctx_t io_ctx, char *token, size_t *max_len);
|
||||
func CreateMirrorPeerBootstrapToken(ioctx *rados.IOContext) (string, error) {
|
||||
@ -606,6 +623,7 @@ const (
|
||||
// source, destination, or both.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_bootstrap_import(
|
||||
// rados_ioctx_t io_ctx, rbd_mirror_peer_direction_t direction,
|
||||
// const char *token);
|
||||
@ -644,6 +662,7 @@ var iterBufSize = 64
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_status_list(rados_ioctx_t p,
|
||||
//
|
||||
// const char *start_id, size_t max, char **image_ids,
|
||||
// rbd_mirror_image_status_t *images, size_t *len)
|
||||
func MirrorImageGlobalStatusList(
|
||||
@ -781,6 +800,7 @@ type MirrorImageInfoItem struct {
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_info_list(
|
||||
//
|
||||
// rados_ioctx_t p, rbd_mirror_image_mode_t *mode_filter,
|
||||
// const char *start_id, size_t max, char **image_ids,
|
||||
// rbd_mirror_image_mode_t *mode_entries,
|
||||
@ -921,6 +941,7 @@ type MirrorImageInstanceIDItem struct {
|
||||
//
|
||||
// Implements:
|
||||
// int rbd_mirror_image_instance_id_list(
|
||||
//
|
||||
// rados_ioctx_t io_ctx,
|
||||
// const char *start_id,
|
||||
// size_t max, char **image_ids,
|
||||
|
71
vendor/github.com/ceph/go-ceph/rbd/mirror_desc_status.go
generated
vendored
Normal file
71
vendor/github.com/ceph/go-ceph/rbd/mirror_desc_status.go
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
// #cgo LDFLAGS: -lrbd
|
||||
// #include <stdlib.h>
|
||||
// #include <rbd/librbd.h>
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// MirrorDescriptionReplayStatus contains information pertaining to the status
|
||||
// of snapshot based RBD image mirroring.
|
||||
type MirrorDescriptionReplayStatus struct {
|
||||
ReplayState string `json:"replay_state"`
|
||||
RemoteSnapshotTimestamp int64 `json:"remote_snapshot_timestamp"`
|
||||
LocalSnapshotTimestamp int64 `json:"local_snapshot_timestamp"`
|
||||
SyncingSnapshotTimestamp int64 `json:"syncing_snapshot_timestamp"`
|
||||
SyncingPercent int `json:"syncing_percent"`
|
||||
BytesPerSecond float64 `json:"bytes_per_second"`
|
||||
BytesPerSnapshot float64 `json:"bytes_per_snapshot"`
|
||||
LastSnapshotSyncSeconds int64 `json:"last_snapshot_sync_seconds"`
|
||||
LastSnapshotBytes int64 `json:"last_snapshot_bytes"`
|
||||
}
|
||||
|
||||
// extractDescriptionJSON will extract one string containing a JSON object from
|
||||
// the description if one can be found.
|
||||
func (s *SiteMirrorImageStatus) extractDescriptionJSON() (string, error) {
|
||||
start := strings.Index(s.Description, "{")
|
||||
if start == -1 {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
end := strings.LastIndex(s.Description, "}")
|
||||
if end == -1 {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
if start >= end {
|
||||
return "", ErrNotExist
|
||||
}
|
||||
return s.Description[start : end+1], nil
|
||||
}
|
||||
|
||||
// UnmarshalDescriptionJSON parses an embedded JSON string that may be found in
|
||||
// the description of the SiteMirrorImageStatus. It will store the result in
|
||||
// the value pointed to by v. If no embedded JSON string is found an
|
||||
// ErrNotExist error is returned. An error may also be returned if the contents
|
||||
// can not be parsed.
|
||||
func (s *SiteMirrorImageStatus) UnmarshalDescriptionJSON(v interface{}) error {
|
||||
desc, err := s.extractDescriptionJSON()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return json.Unmarshal([]byte(desc), v)
|
||||
}
|
||||
|
||||
// DescriptionReplayStatus parses a MirrorDescriptionReplayStatus result out of
|
||||
// the image status description field if available. If the embedded status JSON
|
||||
// is not found or fails to parse and error will be returned.
|
||||
func (s *SiteMirrorImageStatus) DescriptionReplayStatus() (
|
||||
*MirrorDescriptionReplayStatus, error) {
|
||||
// ---
|
||||
mdrs := MirrorDescriptionReplayStatus{}
|
||||
if err := s.UnmarshalDescriptionJSON(&mdrs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &mdrs, nil
|
||||
}
|
12
vendor/github.com/ceph/go-ceph/rbd/mirror_nautilus.go
generated
vendored
12
vendor/github.com/ceph/go-ceph/rbd/mirror_nautilus.go
generated
vendored
@ -35,6 +35,7 @@ const (
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_mode_get(rados_ioctx_t p, rbd_mirror_mode_t *mirror_mode)
|
||||
func MirrorModeGet(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
var rmm C.rbd_mirror_mode_t
|
||||
@ -53,6 +54,7 @@ func MirrorModeGet(ioctx *rados.IOContext) (MirrorMode, error) {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// rbd_mirror_mode_set(rados_ioctx_t p, rbd_mirror_mode_t mirror_mode)
|
||||
func MirrorModeSet(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
cMode := C.rbd_mirror_mode_t(mode)
|
||||
@ -70,6 +72,7 @@ func MirrorModeSet(ioctx *rados.IOContext, mode MirrorMode) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_add(rados_ioctx_t p, char *uuid,
|
||||
// size_t uuid_max_length,
|
||||
// const char *cluster_name,
|
||||
@ -98,6 +101,7 @@ func MirrorPeerAdd(ioctx *rados.IOContext, clusterName, clientName string) (stri
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_remove(rados_ioctx_t io_ctx, const char *uuid)
|
||||
func MirrorPeerRemove(ioctx *rados.IOContext, uuid string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
@ -121,6 +125,7 @@ type MirrorPeerInfo struct {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_list(rados_ioctx_t io_ctx,
|
||||
// rbd_mirror_peer_list_t *peers,
|
||||
// int *max_peers);
|
||||
@ -218,6 +223,7 @@ type MirrorImageInfo struct {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// rbd_mirror_image_get_info(rbd_image_t image,
|
||||
// rbd_mirror_image_info_t *mirror_image_info,
|
||||
// size_t info_size)
|
||||
@ -250,6 +256,7 @@ func (image *Image) MirrorGetImage() (*MirrorImageInfo, error) {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_status_list(rados_ioctx_t io_ctx,
|
||||
// const char *start_id, size_t max,
|
||||
// char **image_ids,
|
||||
@ -327,6 +334,7 @@ func iterateImageList(ioctx *rados.IOContext, imageInfos *[]*MirrorImageInfo, st
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_enable(rbd_image_t image)
|
||||
func (image *Image) MirrorEnable() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
@ -344,6 +352,7 @@ func (image *Image) MirrorEnable() error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_disable(rbd_image_t image, bool force)
|
||||
func (image *Image) MirrorDisable(force bool) error {
|
||||
err := image.validate(imageIsOpen)
|
||||
@ -361,6 +370,7 @@ func (image *Image) MirrorDisable(force bool) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_promote(rbd_image_t image, bool force)
|
||||
func (image *Image) MirrorPromote(force bool) error {
|
||||
err := image.validate(imageIsOpen)
|
||||
@ -378,6 +388,7 @@ func (image *Image) MirrorPromote(force bool) error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_demote(rbd_image_t image)
|
||||
func (image *Image) MirrorDemote() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
@ -396,6 +407,7 @@ func (image *Image) MirrorDemote() error {
|
||||
// tag.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_image_resync(rbd_image_t image)
|
||||
func (image *Image) MirrorResync() error {
|
||||
err := image.validate(imageIsOpen)
|
||||
|
255
vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go
generated
vendored
Normal file
255
vendor/github.com/ceph/go-ceph/rbd/mirror_peer_site.go
generated
vendored
Normal file
@ -0,0 +1,255 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
// #cgo LDFLAGS: -lrbd
|
||||
// #include <stdlib.h>
|
||||
// #include <rbd/librbd.h>
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
|
||||
"github.com/ceph/go-ceph/internal/cutil"
|
||||
"github.com/ceph/go-ceph/internal/retry"
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
)
|
||||
|
||||
// AddMirrorPeerSite adds a peer site to the list of existing sites
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_add(rados_ioctx_t p, char *uuid, size_t uuid_max_length,
|
||||
// rbd_mirror_peer_direction_t direction,
|
||||
// const char *site_name,
|
||||
// const char *client_name);
|
||||
func AddMirrorPeerSite(ioctx *rados.IOContext, siteName string, clientName string,
|
||||
direction MirrorPeerDirection) (string, error) {
|
||||
|
||||
var (
|
||||
err error
|
||||
buf []byte
|
||||
cSize C.size_t
|
||||
)
|
||||
|
||||
cSiteName := C.CString(siteName)
|
||||
defer C.free(unsafe.Pointer(cSiteName))
|
||||
cClientName := C.CString(clientName)
|
||||
defer C.free(unsafe.Pointer(cClientName))
|
||||
|
||||
retry.WithSizes(512, 1<<16, func(size int) retry.Hint {
|
||||
cSize = C.size_t(size)
|
||||
buf = make([]byte, cSize)
|
||||
ret := C.rbd_mirror_peer_site_add(
|
||||
cephIoctx(ioctx),
|
||||
(*C.char)(unsafe.Pointer(&buf[0])),
|
||||
cSize, C.rbd_mirror_peer_direction_t(direction),
|
||||
cSiteName, cClientName)
|
||||
err = getError(ret)
|
||||
return retry.Size(int(cSize)).If(err != nil)
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(bytes.Trim(buf[:cSize], "\x00")), nil
|
||||
}
|
||||
|
||||
// RemoveMirrorPeerSite removes the site with the provided uuid
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_remove(rados_ioctx_t p, const char *uuid)
|
||||
func RemoveMirrorPeerSite(ioctx *rados.IOContext, uuid string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_remove(cephIoctx(ioctx), cUUID)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// GetAttributesMirrorPeerSite fetches the list of key,value pair of attributes of a peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_get_attributes(rados_ioctx_t p, const char *uuid, char *keys,
|
||||
// size_t *max_key_len, char *values, size_t *max_val_len,
|
||||
// size_t *key_value_count);
|
||||
func GetAttributesMirrorPeerSite(ioctx *rados.IOContext, uuid string) (map[string]string, error) {
|
||||
|
||||
var (
|
||||
err error
|
||||
keys []byte
|
||||
vals []byte
|
||||
keySize C.size_t
|
||||
valSize C.size_t
|
||||
count = C.size_t(0)
|
||||
)
|
||||
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
retry.WithSizes(1024, 1<<16, func(size int) retry.Hint {
|
||||
keySize = C.size_t(size)
|
||||
valSize = C.size_t(size)
|
||||
keys = make([]byte, keySize)
|
||||
vals = make([]byte, valSize)
|
||||
ret := C.rbd_mirror_peer_site_get_attributes(
|
||||
cephIoctx(ioctx), cUUID, (*C.char)(unsafe.Pointer(&keys[0])),
|
||||
&keySize, (*C.char)(unsafe.Pointer(&vals[0])), &valSize,
|
||||
&count)
|
||||
err = getErrorIfNegative(ret)
|
||||
return retry.Size(int(keySize)).If(err == errRange)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
keyList := cutil.SplitBuffer(keys[:keySize])
|
||||
valList := cutil.SplitBuffer(vals[:valSize])
|
||||
attributes := map[string]string{}
|
||||
for i := 0; i < int(len(keyList)); i++ {
|
||||
attributes[keyList[i]] = valList[i]
|
||||
}
|
||||
return attributes, nil
|
||||
}
|
||||
|
||||
// SetAttributesMirrorPeerSite sets the attributes for the site with the given uuid
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_attributes(rados_ioctx_t p, const char *uuid,
|
||||
// const char *keys, const char *values,
|
||||
// size_t count) ;
|
||||
func SetAttributesMirrorPeerSite(ioctx *rados.IOContext, uuid string, attributes map[string]string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
var (
|
||||
key string
|
||||
val string
|
||||
count = C.size_t(len(attributes))
|
||||
)
|
||||
|
||||
for k, v := range attributes {
|
||||
key += k + "\000"
|
||||
val += v + "\000"
|
||||
}
|
||||
|
||||
cKey := C.CString(key)
|
||||
defer C.free(unsafe.Pointer(cKey))
|
||||
|
||||
cVal := C.CString(val)
|
||||
defer C.free(unsafe.Pointer(cVal))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_attributes(cephIoctx(ioctx), cUUID, cKey, cVal, count)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// MirrorPeerSite contains information about a mirroring peer site.
|
||||
type MirrorPeerSite struct {
|
||||
UUID string
|
||||
Direction MirrorPeerDirection
|
||||
SiteName string
|
||||
MirrorUUID string
|
||||
ClientName string
|
||||
LastSeen C.time_t
|
||||
}
|
||||
|
||||
// ListMirrorPeerSite returns the list of peer sites
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_list(rados_ioctx_t p, rbd_mirror_peer_site_t *peers, int *max_peers)
|
||||
func ListMirrorPeerSite(ioctx *rados.IOContext) ([]*MirrorPeerSite, error) {
|
||||
var mps []*MirrorPeerSite
|
||||
cMaxPeers := C.int(10)
|
||||
|
||||
var cSites []C.rbd_mirror_peer_site_t
|
||||
for {
|
||||
cSites = make([]C.rbd_mirror_peer_site_t, cMaxPeers)
|
||||
ret := C.rbd_mirror_peer_site_list(cephIoctx(ioctx), &cSites[0], &cMaxPeers)
|
||||
err := getError(ret)
|
||||
if err == errRange {
|
||||
// There are too many peer sites to fit in the list, and the number of peer sites has been
|
||||
// returned in cMaxPeers. Try again with the returned value.
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// ret == 0
|
||||
break
|
||||
}
|
||||
|
||||
defer C.rbd_mirror_peer_site_list_cleanup(&cSites[0], cMaxPeers)
|
||||
cSites = cSites[:cMaxPeers]
|
||||
|
||||
for _, cSite := range cSites {
|
||||
mps = append(mps, &MirrorPeerSite{
|
||||
UUID: C.GoString(cSite.uuid),
|
||||
Direction: MirrorPeerDirection(cSite.direction),
|
||||
SiteName: C.GoString(cSite.site_name),
|
||||
MirrorUUID: C.GoString(cSite.mirror_uuid),
|
||||
ClientName: C.GoString(cSite.client_name),
|
||||
})
|
||||
}
|
||||
|
||||
return mps, nil
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteClientName sets the client name for a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_client_name(rados_ioctx_t p, const char *uuid,
|
||||
// const char *client_name);
|
||||
func SetMirrorPeerSiteClientName(ioctx *rados.IOContext, uuid string, clientName string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
cClientName := C.CString(clientName)
|
||||
defer C.free(unsafe.Pointer(cClientName))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_client_name(cephIoctx(ioctx), cUUID, cClientName)
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteDirection sets the direction of a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_direction(rados_ioctx_t p, const char *uuid,
|
||||
// rbd_mirror_peer_direction_t direction);
|
||||
func SetMirrorPeerSiteDirection(ioctx *rados.IOContext, uuid string, direction MirrorPeerDirection) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_direction(cephIoctx(ioctx), cUUID,
|
||||
C.rbd_mirror_peer_direction_t(direction))
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
// SetMirrorPeerSiteName sets the name of a mirror peer site
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_mirror_peer_site_set_name(rados_ioctx_t p, const char *uuid,
|
||||
// const char *site_name);
|
||||
func SetMirrorPeerSiteName(ioctx *rados.IOContext, uuid string, siteName string) error {
|
||||
cUUID := C.CString(uuid)
|
||||
defer C.free(unsafe.Pointer(cUUID))
|
||||
|
||||
cSiteName := C.CString(siteName)
|
||||
defer C.free(unsafe.Pointer(cSiteName))
|
||||
|
||||
ret := C.rbd_mirror_peer_site_set_name(cephIoctx(ioctx), cUUID, cSiteName)
|
||||
|
||||
return getError(ret)
|
||||
}
|
4
vendor/github.com/ceph/go-ceph/rbd/namespace_nautilus.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rbd/namespace_nautilus.go
generated
vendored
@ -22,6 +22,7 @@ import (
|
||||
// NamespaceCreate creates the namespace for a given Rados IOContext.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_namespace_create(rados_ioctx_t io, const char *namespace_name);
|
||||
func NamespaceCreate(ioctx *rados.IOContext, namespaceName string) error {
|
||||
if ioctx == nil {
|
||||
@ -40,6 +41,7 @@ func NamespaceCreate(ioctx *rados.IOContext, namespaceName string) error {
|
||||
// NamespaceRemove removes a given namespace.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_namespace_remove(rados_ioctx_t io, const char *namespace_name);
|
||||
func NamespaceRemove(ioctx *rados.IOContext, namespaceName string) error {
|
||||
if ioctx == nil {
|
||||
@ -58,6 +60,7 @@ func NamespaceRemove(ioctx *rados.IOContext, namespaceName string) error {
|
||||
// NamespaceExists checks whether a given namespace exists or not.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name, bool *exists);
|
||||
func NamespaceExists(ioctx *rados.IOContext, namespaceName string) (bool, error) {
|
||||
if ioctx == nil {
|
||||
@ -77,6 +80,7 @@ func NamespaceExists(ioctx *rados.IOContext, namespaceName string) (bool, error)
|
||||
// NamespaceList returns a slice containing the names of existing rbd namespaces.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_namespace_list(rados_ioctx_t io, char *namespace_names, size_t *size);
|
||||
func NamespaceList(ioctx *rados.IOContext) (names []string, err error) {
|
||||
if ioctx == nil {
|
||||
|
10
vendor/github.com/ceph/go-ceph/rbd/options.go
generated
vendored
10
vendor/github.com/ceph/go-ceph/rbd/options.go
generated
vendored
@ -99,6 +99,7 @@ type RbdImageOption = ImageOption
|
||||
// RbdImageOptions.Destroy() to free the resources.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rbd_image_options_create(rbd_image_options_t* opts)
|
||||
func NewRbdImageOptions() *ImageOptions {
|
||||
rio := &ImageOptions{}
|
||||
@ -109,6 +110,7 @@ func NewRbdImageOptions() *ImageOptions {
|
||||
// Destroy a RbdImageOptions struct and free the associated resources.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rbd_image_options_destroy(rbd_image_options_t opts);
|
||||
func (rio *ImageOptions) Destroy() {
|
||||
C.rbd_image_options_destroy(rio.options)
|
||||
@ -117,6 +119,7 @@ func (rio *ImageOptions) Destroy() {
|
||||
// SetString sets the value of the RbdImageOption to the given string.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_set_string(rbd_image_options_t opts, int optname,
|
||||
// const char* optval);
|
||||
func (rio *ImageOptions) SetString(option ImageOption, value string) error {
|
||||
@ -135,6 +138,7 @@ func (rio *ImageOptions) SetString(option ImageOption, value string) error {
|
||||
// GetString returns the string value of the RbdImageOption.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_get_string(rbd_image_options_t opts, int optname,
|
||||
// char* optval, size_t maxlen);
|
||||
func (rio *ImageOptions) GetString(option ImageOption) (string, error) {
|
||||
@ -153,6 +157,7 @@ func (rio *ImageOptions) GetString(option ImageOption) (string, error) {
|
||||
// SetUint64 sets the value of the RbdImageOption to the given uint64.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_set_uint64(rbd_image_options_t opts, int optname,
|
||||
// const uint64_t optval);
|
||||
func (rio *ImageOptions) SetUint64(option ImageOption, value uint64) error {
|
||||
@ -170,6 +175,7 @@ func (rio *ImageOptions) SetUint64(option ImageOption, value uint64) error {
|
||||
// GetUint64 returns the uint64 value of the RbdImageOption.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_get_uint64(rbd_image_options_t opts, int optname,
|
||||
// uint64_t* optval);
|
||||
func (rio *ImageOptions) GetUint64(option ImageOption) (uint64, error) {
|
||||
@ -186,6 +192,7 @@ func (rio *ImageOptions) GetUint64(option ImageOption) (uint64, error) {
|
||||
// IsSet returns a true if the RbdImageOption is set, false otherwise.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_is_set(rbd_image_options_t opts, int optname,
|
||||
// bool* is_set);
|
||||
func (rio *ImageOptions) IsSet(option ImageOption) (bool, error) {
|
||||
@ -202,6 +209,7 @@ func (rio *ImageOptions) IsSet(option ImageOption) (bool, error) {
|
||||
// Unset a given RbdImageOption.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_unset(rbd_image_options_t opts, int optname)
|
||||
func (rio *ImageOptions) Unset(option ImageOption) error {
|
||||
ret := C.rbd_image_options_unset(rio.options, C.int(option))
|
||||
@ -215,6 +223,7 @@ func (rio *ImageOptions) Unset(option ImageOption) error {
|
||||
// Clear all options in the RbdImageOptions.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rbd_image_options_clear(rbd_image_options_t opts)
|
||||
func (rio *ImageOptions) Clear() {
|
||||
C.rbd_image_options_clear(rio.options)
|
||||
@ -224,6 +233,7 @@ func (rio *ImageOptions) Clear() {
|
||||
// false otherwise.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_image_options_is_empty(rbd_image_options_t opts)
|
||||
func (rio *ImageOptions) IsEmpty() bool {
|
||||
ret := C.rbd_image_options_is_empty(rio.options)
|
||||
|
8
vendor/github.com/ceph/go-ceph/rbd/pool_nautilus.go
generated
vendored
8
vendor/github.com/ceph/go-ceph/rbd/pool_nautilus.go
generated
vendored
@ -20,6 +20,7 @@ import (
|
||||
// GetPoolMetadata returns pool metadata associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_metadata_get(rados_ioctx_t io_ctx, const char *key, char *value, size_t *val_len);
|
||||
func GetPoolMetadata(ioctx *rados.IOContext, key string) (string, error) {
|
||||
if ioctx == nil {
|
||||
@ -53,6 +54,7 @@ func GetPoolMetadata(ioctx *rados.IOContext, key string) (string, error) {
|
||||
// SetPoolMetadata updates the pool metadata string associated with the given key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_metadata_set(rados_ioctx_t io_ctx, const char *key, const char *value);
|
||||
func SetPoolMetadata(ioctx *rados.IOContext, key, value string) error {
|
||||
if ioctx == nil {
|
||||
@ -71,6 +73,7 @@ func SetPoolMetadata(ioctx *rados.IOContext, key, value string) error {
|
||||
// RemovePoolMetadata removes the pool metadata value for a given pool metadata key.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_metadata_remove(rados_ioctx_t io_ctx, const char *key)
|
||||
func RemovePoolMetadata(ioctx *rados.IOContext, key string) error {
|
||||
if ioctx == nil {
|
||||
@ -89,6 +92,7 @@ func RemovePoolMetadata(ioctx *rados.IOContext, key string) error {
|
||||
// to host rbd images.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_init(rados_ioctx_t io, bool force)
|
||||
func PoolInit(ioctx *rados.IOContext, force bool) error {
|
||||
if ioctx == nil {
|
||||
@ -107,6 +111,7 @@ type poolStats struct {
|
||||
// poolStatsCreate creates a new poolStats struct.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rbd_pool_stats_create(rbd_pool_stats_t *stats)
|
||||
func poolStatsCreate() *poolStats {
|
||||
poolstats := &poolStats{}
|
||||
@ -117,6 +122,7 @@ func poolStatsCreate() *poolStats {
|
||||
// destroy a poolStats struct and free the associated resources.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// void rbd_pool_stats_destroy(rbd_pool_stats_t stats)
|
||||
func (poolstats *poolStats) destroy() {
|
||||
C.rbd_pool_stats_destroy(poolstats.stats)
|
||||
@ -159,6 +165,7 @@ const (
|
||||
// addPoolStatOption adds the given PoolStatOption to PoolStats.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_stats_option_add_uint64(rbd_pool_stats_t stats, int stat_option, uint64_t* stat_val)
|
||||
func (poolstats *poolStats) addPoolStatOption(option PoolStatOption, val *uint64) error {
|
||||
ret := C.rbd_pool_stats_option_add_uint64(
|
||||
@ -171,6 +178,7 @@ func (poolstats *poolStats) addPoolStatOption(option PoolStatOption, val *uint64
|
||||
// GetAllPoolStats returns a map of all PoolStatOption(s) to their respective values.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_pool_stats_get(rados_ioctx_t io, rbd_pool_stats_t stats);
|
||||
func GetAllPoolStats(ioctx *rados.IOContext) (map[PoolStatOption]uint64, error) {
|
||||
var omap = make(map[PoolStatOption]uint64)
|
||||
|
39
vendor/github.com/ceph/go-ceph/rbd/rbd.go
generated
vendored
39
vendor/github.com/ceph/go-ceph/rbd/rbd.go
generated
vendored
@ -145,9 +145,11 @@ func GetImage(ioctx *rados.IOContext, name string) *Image {
|
||||
// Create a new rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_create(rados_ioctx_t io, const char *name, uint64_t size, int *order);
|
||||
//
|
||||
// Also implements (for backward compatibility):
|
||||
//
|
||||
// int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// uint64_t features, int *order);
|
||||
// int rbd_create3(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
@ -188,6 +190,7 @@ func Create(ioctx *rados.IOContext, name string, size uint64, order int,
|
||||
// Create2 creates a new rbd image using provided features.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// uint64_t features, int *order);
|
||||
func Create2(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
@ -215,6 +218,7 @@ func Create2(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
// parameters.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_create3(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// uint64_t features, int *order,
|
||||
// uint64_t stripe_unit, uint64_t stripe_count);
|
||||
@ -243,6 +247,7 @@ func Create3(ioctx *rados.IOContext, name string, size uint64, features uint64,
|
||||
// Clone a new rbd image from a snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_clone(rados_ioctx_t p_ioctx, const char *p_name,
|
||||
// const char *p_snapname, rados_ioctx_t c_ioctx,
|
||||
// const char *c_name, uint64_t features, int *c_order);
|
||||
@ -281,6 +286,7 @@ func (image *Image) Clone(snapname string, cIoctx *rados.IOContext, cName string
|
||||
// Remove the specified rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
func (image *Image) Remove() error {
|
||||
if err := image.validate(imageNeedsIOContext | imageNeedsName | imageIsNotOpen); err != nil {
|
||||
@ -306,6 +312,7 @@ func (image *Image) Trash(delay time.Duration) error {
|
||||
// Rename an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);
|
||||
func (image *Image) Rename(destname string) error {
|
||||
if err := image.validate(imageNeedsIOContext | imageNeedsName); err != nil {
|
||||
@ -370,6 +377,7 @@ func (image *Image) Open(args ...interface{}) error {
|
||||
// Close an open rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_close(rbd_image_t image);
|
||||
func (image *Image) Close() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -387,6 +395,7 @@ func (image *Image) Close() error {
|
||||
// Resize an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_resize(rbd_image_t image, uint64_t size);
|
||||
func (image *Image) Resize(size uint64) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -399,6 +408,7 @@ func (image *Image) Resize(size uint64) error {
|
||||
// Stat an rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);
|
||||
func (image *Image) Stat() (info *ImageInfo, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -422,6 +432,7 @@ func (image *Image) Stat() (info *ImageInfo, err error) {
|
||||
// IsOldFormat returns true if the rbd image uses the old format.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_old_format(rbd_image_t image, uint8_t *old);
|
||||
func (image *Image) IsOldFormat() (bool, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -441,6 +452,7 @@ func (image *Image) IsOldFormat() (bool, error) {
|
||||
// GetSize returns the size of the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_size(rbd_image_t image, uint64_t *size);
|
||||
func (image *Image) GetSize() (size uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -457,6 +469,7 @@ func (image *Image) GetSize() (size uint64, err error) {
|
||||
// GetStripeUnit returns the stripe-unit value for the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);
|
||||
func (image *Image) GetStripeUnit() (uint64, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -474,6 +487,7 @@ func (image *Image) GetStripeUnit() (uint64, error) {
|
||||
// GetStripeCount returns the stripe-count value for the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count);
|
||||
func (image *Image) GetStripeCount() (uint64, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -492,6 +506,7 @@ func (image *Image) GetStripeCount() (uint64, error) {
|
||||
// parent.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);
|
||||
func (image *Image) GetOverlap() (overlap uint64, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -508,6 +523,7 @@ func (image *Image) GetOverlap() (overlap uint64, err error) {
|
||||
// Copy one rbd image to another.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname);
|
||||
func (image *Image) Copy(ioctx *rados.IOContext, destname string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -528,6 +544,7 @@ func (image *Image) Copy(ioctx *rados.IOContext, destname string) error {
|
||||
// Copy2 copies one rbd image to another, using an image handle.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_copy2(rbd_image_t src, rbd_image_t dest);
|
||||
func (image *Image) Copy2(dest *Image) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -542,6 +559,7 @@ func (image *Image) Copy2(dest *Image) error {
|
||||
// DeepCopy an rbd image to a new image with specific options.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_deep_copy(rbd_image_t src, rados_ioctx_t dest_io_ctx,
|
||||
// const char *destname, rbd_image_options_t dest_opts);
|
||||
func (image *Image) DeepCopy(ioctx *rados.IOContext, destname string, rio *ImageOptions) error {
|
||||
@ -569,6 +587,7 @@ func (image *Image) DeepCopy(ioctx *rados.IOContext, destname string, rio *Image
|
||||
// Flatten removes snapshot references from the image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_flatten(rbd_image_t image);
|
||||
func (image *Image) Flatten() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -581,6 +600,7 @@ func (image *Image) Flatten() error {
|
||||
// ListLockers returns a list of clients that have locks on the image.
|
||||
//
|
||||
// Impelemnts:
|
||||
//
|
||||
// ssize_t rbd_list_lockers(rbd_image_t image, int *exclusive,
|
||||
// char *tag, size_t *tag_len,
|
||||
// char *clients, size_t *clients_len,
|
||||
@ -645,6 +665,7 @@ func (image *Image) ListLockers() (tag string, lockers []Locker, err error) {
|
||||
// LockExclusive acquires an exclusive lock on the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_lock_exclusive(rbd_image_t image, const char *cookie);
|
||||
func (image *Image) LockExclusive(cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -660,6 +681,7 @@ func (image *Image) LockExclusive(cookie string) error {
|
||||
// LockShared acquires a shared lock on the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
|
||||
func (image *Image) LockShared(cookie string, tag string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -677,6 +699,7 @@ func (image *Image) LockShared(cookie string, tag string) error {
|
||||
// Unlock releases a lock on the image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
|
||||
func (image *Image) Unlock(cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -692,6 +715,7 @@ func (image *Image) Unlock(cookie string) error {
|
||||
// BreakLock forces the release of a lock held by another client.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_break_lock(rbd_image_t image, const char *client, const char *cookie);
|
||||
func (image *Image) BreakLock(client string, cookie string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -711,6 +735,7 @@ func (image *Image) BreakLock(client string, cookie string) error {
|
||||
// offset which is not safe in concurrent code. Prefer ReadAt when possible.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// char *buf);
|
||||
func (image *Image) Read(data []byte) (int, error) {
|
||||
@ -745,6 +770,7 @@ func (image *Image) Read(data []byte) (int, error) {
|
||||
// offset which is not safe in concurrent code. Prefer WriteAt when possible.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// const char *buf);
|
||||
func (image *Image) Write(data []byte) (n int, err error) {
|
||||
@ -790,6 +816,7 @@ func (image *Image) Seek(offset int64, whence int) (int64, error) {
|
||||
// space.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len);
|
||||
func (image *Image) Discard(ofs uint64, length uint64) (int, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -855,6 +882,7 @@ func (image *Image) WriteAt(data []byte, off int64) (n int, err error) {
|
||||
// been written.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// ssize_t rbd_writesame(rbd_image_t image, uint64_t ofs, size_t len,
|
||||
// const char *buf, size_t data_len, int op_flags);
|
||||
func (image *Image) WriteSame(ofs, n uint64, data []byte, flags rados.OpFlags) (int64, error) {
|
||||
@ -884,6 +912,7 @@ func (image *Image) WriteSame(ofs, n uint64, data []byte, flags rados.OpFlags) (
|
||||
// Flush all cached writes to storage.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_flush(rbd_image_t image);
|
||||
func (image *Image) Flush() error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -897,6 +926,7 @@ func (image *Image) Flush() error {
|
||||
// associated with the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps);
|
||||
func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -929,6 +959,7 @@ func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error) {
|
||||
// GetId returns the internal image ID string.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_id(rbd_image_t image, char *id, size_t id_len);
|
||||
func (image *Image) GetId() (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -964,6 +995,7 @@ func (image *Image) GetName() string {
|
||||
// is the source of readable data.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
func (image *Image) SetSnapshot(snapname string) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -1033,6 +1065,7 @@ func TrashRestore(ioctx *rados.IOContext, id, name string) error {
|
||||
// snapName to explicitly indicate that no snapshot name is being provided.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_open(rados_ioctx_t io, const char *name,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImage(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
@ -1076,6 +1109,7 @@ func OpenImage(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
// provided.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_open_read_only(rados_ioctx_t io, const char *name,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageReadOnly(ioctx *rados.IOContext, name, snapName string) (*Image, error) {
|
||||
@ -1120,6 +1154,7 @@ func OpenImageReadOnly(ioctx *rados.IOContext, name, snapName string) (*Image, e
|
||||
// that fixes https://tracker.ceph.com/issues/43178
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_open_by_id(rados_ioctx_t io, const char *id,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageById(ioctx *rados.IOContext, id, snapName string) (*Image, error) {
|
||||
@ -1164,6 +1199,7 @@ func OpenImageById(ioctx *rados.IOContext, id, snapName string) (*Image, error)
|
||||
// that fixes https://tracker.ceph.com/issues/43178
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_open_by_id_read_only(rados_ioctx_t io, const char *id,
|
||||
// rbd_image_t *image, const char *snap_name);
|
||||
func OpenImageByIdReadOnly(ioctx *rados.IOContext, id, snapName string) (*Image, error) {
|
||||
@ -1203,6 +1239,7 @@ func OpenImageByIdReadOnly(ioctx *rados.IOContext, id, snapName string) (*Image,
|
||||
// CreateImage creates a new rbd image using provided image options.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_create4(rados_ioctx_t io, const char *name, uint64_t size,
|
||||
// rbd_image_options_t opts);
|
||||
func CreateImage(ioctx *rados.IOContext, name string, size uint64, rio *ImageOptions) error {
|
||||
@ -1227,6 +1264,7 @@ func CreateImage(ioctx *rados.IOContext, name string, size uint64, rio *ImageOpt
|
||||
// RemoveImage removes the specified rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_remove(rados_ioctx_t io, const char *name);
|
||||
func RemoveImage(ioctx *rados.IOContext, name string) error {
|
||||
if ioctx == nil {
|
||||
@ -1245,6 +1283,7 @@ func RemoveImage(ioctx *rados.IOContext, name string) error {
|
||||
// provided io-context with the given name and image options.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_clone3(rados_ioctx_t p_ioctx, const char *p_name,
|
||||
// const char *p_snapname, rados_ioctx_t c_ioctx,
|
||||
// const char *c_name, rbd_image_options_t c_opts);
|
||||
|
4
vendor/github.com/ceph/go-ceph/rbd/rbd_nautilus.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rbd/rbd_nautilus.go
generated
vendored
@ -48,6 +48,7 @@ func GetImageNames(ioctx *rados.IOContext) ([]string, error) {
|
||||
// GetCreateTimestamp returns the time the rbd image was created.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_create_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetCreateTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -66,6 +67,7 @@ func (image *Image) GetCreateTimestamp() (Timespec, error) {
|
||||
// GetAccessTimestamp returns the time the rbd image was last accessed.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_access_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetAccessTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -84,6 +86,7 @@ func (image *Image) GetAccessTimestamp() (Timespec, error) {
|
||||
// GetModifyTimestamp returns the time the rbd image was last modified.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_modify_timestamp(rbd_image_t image, struct timespec *timestamp);
|
||||
func (image *Image) GetModifyTimestamp() (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -104,6 +107,7 @@ func (image *Image) GetModifyTimestamp() (Timespec, error) {
|
||||
// a power of two no less than 4096 and no larger than the image size.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_sparsify(rbd_image_t image, size_t sparse_size);
|
||||
func (image *Image) Sparsify(sparseSize uint) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
|
8
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
8
vendor/github.com/ceph/go-ceph/rbd/snapshot.go
generated
vendored
@ -21,6 +21,7 @@ type Snapshot struct {
|
||||
// a snapshot of the rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_create(rbd_image_t image, const char *snapname);
|
||||
func (image *Image) CreateSnapshot(snapname string) (*Snapshot, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
@ -66,6 +67,7 @@ func (image *Image) GetSnapshot(snapname string) *Snapshot {
|
||||
// Remove the snapshot from the connected rbd image.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_remove(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Remove() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
@ -81,6 +83,7 @@ func (snapshot *Snapshot) Remove() error {
|
||||
// Rollback the image to the snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_rollback(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Rollback() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
@ -96,6 +99,7 @@ func (snapshot *Snapshot) Rollback() error {
|
||||
// Protect a snapshot from unwanted deletion.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_protect(rbd_image_t image, const char *snap_name);
|
||||
func (snapshot *Snapshot) Protect() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
@ -111,6 +115,7 @@ func (snapshot *Snapshot) Protect() error {
|
||||
// Unprotect stops protecting the snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_unprotect(rbd_image_t image, const char *snap_name);
|
||||
func (snapshot *Snapshot) Unprotect() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
@ -126,6 +131,7 @@ func (snapshot *Snapshot) Unprotect() error {
|
||||
// IsProtected returns true if the snapshot is currently protected.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
|
||||
// int *is_protected);
|
||||
func (snapshot *Snapshot) IsProtected() (bool, error) {
|
||||
@ -153,6 +159,7 @@ func (snapshot *Snapshot) IsProtected() (bool, error) {
|
||||
// Deprecated: use the SetSnapshot method of the Image type instead
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_set(rbd_image_t image, const char *snapname);
|
||||
func (snapshot *Snapshot) Set() error {
|
||||
if err := snapshot.validate(snapshotNeedsName | imageIsOpen); err != nil {
|
||||
@ -168,6 +175,7 @@ func (snapshot *Snapshot) Set() error {
|
||||
// Check https://tracker.ceph.com/issues/47287 for details.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, struct timespec *timestamp)
|
||||
func (image *Image) GetSnapTimestamp(snapID uint64) (Timespec, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
|
2
vendor/github.com/ceph/go-ceph/rbd/snapshot_namespace.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rbd/snapshot_namespace.go
generated
vendored
@ -32,6 +32,7 @@ const (
|
||||
// returns error on failure.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_get_namespace_type(rbd_image_t image, uint64_t snap_id, rbd_snap_namespace_type_t *namespace_type)
|
||||
func (image *Image) GetSnapNamespaceType(snapID uint64) (SnapNamespaceType, error) {
|
||||
var nsType SnapNamespaceType
|
||||
@ -51,6 +52,7 @@ func (image *Image) GetSnapNamespaceType(snapID uint64) (SnapNamespaceType, erro
|
||||
// function belongs to a snapshot already in the Trash.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_get_trash_namespace(rbd_image_t image, uint64_t snap_id, char *original_name, size_t max_length)
|
||||
func (image *Image) GetSnapTrashNamespace(snapID uint64) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
|
3
vendor/github.com/ceph/go-ceph/rbd/snapshot_nautilus.go
generated
vendored
3
vendor/github.com/ceph/go-ceph/rbd/snapshot_nautilus.go
generated
vendored
@ -19,6 +19,7 @@ import (
|
||||
// and snapshot-name in the byte-arrays that are passed as arguments.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_get_parent(rbd_image_t image,
|
||||
// rbd_linked_image_spec_t *parent_image,
|
||||
// rbd_snap_spec_t *parent_snap)
|
||||
@ -123,6 +124,7 @@ func (image *Image) GetParent() (*ParentInfo, error) {
|
||||
// used to link the two items together.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_list_children3(rbd_image_t image, rbd_linked_image_spec_t *images,
|
||||
// size_t *max_images);
|
||||
func (image *Image) ListChildren() (pools []string, images []string, err error) {
|
||||
@ -162,6 +164,7 @@ func (image *Image) ListChildren() (pools []string, images []string, err error)
|
||||
// is the source of readable data.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_set_by_id(rbd_image_t image, uint64_t snap_id);
|
||||
func (image *Image) SetSnapByID(snapID uint64) error {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
|
2
vendor/github.com/ceph/go-ceph/rbd/snapshot_octopus.go
generated
vendored
2
vendor/github.com/ceph/go-ceph/rbd/snapshot_octopus.go
generated
vendored
@ -17,6 +17,7 @@ import (
|
||||
// GetSnapID returns the snapshot ID for the given snapshot name.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_get_id(rbd_image_t image, const char *snapname, uint64_t *snap_id)
|
||||
func (image *Image) GetSnapID(snapName string) (uint64, error) {
|
||||
var snapID C.uint64_t
|
||||
@ -37,6 +38,7 @@ func (image *Image) GetSnapID(snapName string) (uint64, error) {
|
||||
// GetSnapByID returns the snapshot name for the given snapshot ID.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_get_name(rbd_image_t image, uint64_t snap_id, char *snapname, size_t *name_len)
|
||||
func (image *Image) GetSnapByID(snapID uint64) (string, error) {
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
|
1
vendor/github.com/ceph/go-ceph/rbd/snapshot_rename.go
generated
vendored
1
vendor/github.com/ceph/go-ceph/rbd/snapshot_rename.go
generated
vendored
@ -12,6 +12,7 @@ import (
|
||||
// Rename a snapshot.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_snap_rename(rbd_image_t image, const char *snapname,
|
||||
// const char* dstsnapsname);
|
||||
func (snapshot *Snapshot) Rename(destName string) error {
|
||||
|
88
vendor/github.com/ceph/go-ceph/rbd/sparsify.go
generated
vendored
Normal file
88
vendor/github.com/ceph/go-ceph/rbd/sparsify.go
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
//go:build !nautilus && ceph_preview
|
||||
// +build !nautilus,ceph_preview
|
||||
|
||||
package rbd
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lrbd
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <rbd/librbd.h>
|
||||
|
||||
extern int sparsifyCallback(uint64_t, uint64_t, uintptr_t);
|
||||
|
||||
// inline wrapper to cast uintptr_t to void*
|
||||
static inline int wrap_rbd_sparsify_with_progress(
|
||||
rbd_image_t image, size_t sparse_size, uintptr_t arg) {
|
||||
return rbd_sparsify_with_progress(
|
||||
image, sparse_size, (librbd_progress_fn_t)sparsifyCallback, (void*)arg);
|
||||
};
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"github.com/ceph/go-ceph/internal/callbacks"
|
||||
)
|
||||
|
||||
// SparsifyCallback defines the function signature needed for the
|
||||
// SparsifyWithProgress callback.
|
||||
//
|
||||
// This callback will be called by SparsifyWithProgress when it wishes to
|
||||
// report progress on sparse. The callback function will be called with the
|
||||
// first argument containing the current offset within the image being made
|
||||
// sparse and the second argument containing the total size of the image. The
|
||||
// third argument is an opaque value that is passed to the SparsifyWithProgress
|
||||
// function's data argument and every call to the callback will receive the
|
||||
// same object. The sparsify operation will be aborted if the progress
|
||||
// callback returns a non-zero value.
|
||||
type SparsifyCallback func(uint64, uint64, interface{}) int
|
||||
|
||||
var sparsifyCallbacks = callbacks.New()
|
||||
|
||||
type sparsifyCallbackCtx struct {
|
||||
callback SparsifyCallback
|
||||
data interface{}
|
||||
}
|
||||
|
||||
// SparsifyWithProgress makes an image sparse by deallocating runs of zeros.
|
||||
// The sparseSize value will be used to find runs of zeros and must be
|
||||
// a power of two no less than 4096 and no larger than the image size.
|
||||
// The given progress callback will be called to report on the progress
|
||||
// of sparse. The operation will be aborted if the progress callback returns
|
||||
// a non-zero value.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_sparsify_with_progress(rbd_image_t image, size_t sparse_size,
|
||||
// librbd_progress_fn_t cb, void *cbdata);
|
||||
func (image *Image) SparsifyWithProgress(
|
||||
sparseSize uint, cb SparsifyCallback, data interface{}) error {
|
||||
// the provided callback must be a real function
|
||||
if cb == nil {
|
||||
return rbdError(C.EINVAL)
|
||||
}
|
||||
|
||||
if err := image.validate(imageIsOpen); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx := sparsifyCallbackCtx{
|
||||
callback: cb,
|
||||
data: data,
|
||||
}
|
||||
cbIndex := sparsifyCallbacks.Add(ctx)
|
||||
defer diffIterateCallbacks.Remove(cbIndex)
|
||||
|
||||
ret := C.wrap_rbd_sparsify_with_progress(image.image, C.size_t(sparseSize), C.uintptr_t(cbIndex))
|
||||
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
//export sparsifyCallback
|
||||
func sparsifyCallback(
|
||||
offset, total C.uint64_t, index uintptr) C.int {
|
||||
|
||||
v := sparsifyCallbacks.Lookup(index)
|
||||
ctx := v.(sparsifyCallbackCtx)
|
||||
return C.int(ctx.callback(uint64(offset), uint64(total), ctx.data))
|
||||
}
|
4
vendor/github.com/ceph/go-ceph/rbd/watchers.go
generated
vendored
4
vendor/github.com/ceph/go-ceph/rbd/watchers.go
generated
vendored
@ -31,9 +31,11 @@ type ImageWatcher struct {
|
||||
// and an error are returned.
|
||||
//
|
||||
// Note:
|
||||
//
|
||||
// Only supported in Ceph Mimic and newer.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_watchers_list(rbd_image_t image,
|
||||
// rbd_image_watcher_t *watchers, size_t *max_watchers)
|
||||
func (image *Image) ListWatchers() ([]ImageWatcher, error) {
|
||||
@ -91,6 +93,7 @@ type Watch struct {
|
||||
// image, returning a Watch object.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_update_watch(rbd_image_t image, uint64_t *handle,
|
||||
// rbd_update_callback_t watch_cb, void *arg);
|
||||
func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, error) {
|
||||
@ -120,6 +123,7 @@ func (image *Image) UpdateWatch(cb WatchCallback, data interface{}) (*Watch, err
|
||||
// Unwatch un-registers the image watch.
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int rbd_update_unwatch(rbd_image_t image, uint64_t handle);
|
||||
func (w *Watch) Unwatch() error {
|
||||
if w.image == nil {
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -119,8 +119,8 @@ github.com/cenkalti/backoff/v4
|
||||
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.20.0
|
||||
## explicit; go 1.17
|
||||
# github.com/ceph/go-ceph v0.21.0
|
||||
## explicit; go 1.19
|
||||
github.com/ceph/go-ceph/cephfs/admin
|
||||
github.com/ceph/go-ceph/common/admin/manager
|
||||
github.com/ceph/go-ceph/common/admin/nfs
|
||||
|
Loading…
Reference in New Issue
Block a user