mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update go-ceph to v0.7.0
updating go-ceph to latest 0.7.0 release. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
97acd47ae9
commit
eeec1213cb
60
vendor/github.com/ceph/go-ceph/cephfs/admin/flags.go
generated
vendored
Normal file
60
vendor/github.com/ceph/go-ceph/cephfs/admin/flags.go
generated
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
// +build !luminous,!mimic
|
||||
|
||||
package admin
|
||||
|
||||
// For APIs that accept extra sets of "boolean" flags we may end up wanting
|
||||
// multiple different sets of supported flags. Example: most rm functions
|
||||
// accept a force flag, but only subvolume delete has retain snapshots.
|
||||
// To make this somewhat uniform in the admin package we define a utility
|
||||
// interface and helper function to merge flags with naming options.
|
||||
|
||||
type flagSet interface {
|
||||
flags() map[string]bool
|
||||
}
|
||||
|
||||
type commonRmFlags struct {
|
||||
force bool
|
||||
}
|
||||
|
||||
func (f commonRmFlags) flags() map[string]bool {
|
||||
o := make(map[string]bool)
|
||||
if f.force {
|
||||
o["force"] = true
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// SubVolRmFlags does not embed other types to simplify and keep the
|
||||
// interface with the type flat and simple. At the cost of some code
|
||||
// duplication we get a nicer UX for those using the library.
|
||||
|
||||
// SubVolRmFlags may be used to specify behavior modifying flags when
|
||||
// removing sub volumes.
|
||||
type SubVolRmFlags struct {
|
||||
Force bool
|
||||
RetainSnapshots bool
|
||||
}
|
||||
|
||||
func (f SubVolRmFlags) flags() map[string]bool {
|
||||
o := make(map[string]bool)
|
||||
if f.Force {
|
||||
o["force"] = true
|
||||
}
|
||||
if f.RetainSnapshots {
|
||||
o["retain-snapshots"] = true
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
||||
// mergeFlags combines a set of key-value settings with any type implementing
|
||||
// the flagSet interface.
|
||||
func mergeFlags(m map[string]string, f flagSet) map[string]interface{} {
|
||||
o := make(map[string]interface{})
|
||||
for k, v := range m {
|
||||
o[k] = v
|
||||
}
|
||||
for k, v := range f.flags() {
|
||||
o[k] = v
|
||||
}
|
||||
return o
|
||||
}
|
15
vendor/github.com/ceph/go-ceph/cephfs/admin/fsadmin.go
generated
vendored
15
vendor/github.com/ceph/go-ceph/cephfs/admin/fsadmin.go
generated
vendored
@ -143,18 +143,3 @@ func modeString(m int, force bool) string {
|
||||
func uint64String(v uint64) string {
|
||||
return strconv.FormatUint(uint64(v), 10)
|
||||
}
|
||||
|
||||
type rmFlags struct {
|
||||
force bool
|
||||
}
|
||||
|
||||
func (f rmFlags) Update(m map[string]string) map[string]interface{} {
|
||||
o := make(map[string]interface{})
|
||||
for k, v := range m {
|
||||
o[k] = v
|
||||
}
|
||||
if f.force {
|
||||
o["force"] = true
|
||||
}
|
||||
return o
|
||||
}
|
||||
|
24
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolume.go
generated
vendored
24
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolume.go
generated
vendored
@ -87,7 +87,7 @@ func (fsa *FSAdmin) ListSubVolumes(volume, group string) ([]string, error) {
|
||||
// Similar To:
|
||||
// ceph fs subvolume rm <volume> --group-name=<group> <name>
|
||||
func (fsa *FSAdmin) RemoveSubVolume(volume, group, name string) error {
|
||||
return fsa.rmSubVolume(volume, group, name, rmFlags{})
|
||||
return fsa.RemoveSubVolumeWithFlags(volume, group, name, SubVolRmFlags{})
|
||||
}
|
||||
|
||||
// ForceRemoveSubVolume will delete a CephFS subvolume in a volume and optional
|
||||
@ -96,10 +96,18 @@ func (fsa *FSAdmin) RemoveSubVolume(volume, group, name string) error {
|
||||
// Similar To:
|
||||
// ceph fs subvolume rm <volume> --group-name=<group> <name> --force
|
||||
func (fsa *FSAdmin) ForceRemoveSubVolume(volume, group, name string) error {
|
||||
return fsa.rmSubVolume(volume, group, name, rmFlags{force: true})
|
||||
return fsa.RemoveSubVolumeWithFlags(volume, group, name, SubVolRmFlags{Force: true})
|
||||
}
|
||||
|
||||
func (fsa *FSAdmin) rmSubVolume(volume, group, name string, o rmFlags) error {
|
||||
// RemoveSubVolumeWithFlags will delete a CephFS subvolume in a volume and
|
||||
// optional subvolume group. This function accepts a SubVolRmFlags type that
|
||||
// can be used to specify flags that modify the operations behavior.
|
||||
// Equivalent to RemoveSubVolume with no flags set.
|
||||
// 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{
|
||||
"prefix": "fs subvolume rm",
|
||||
"vol_name": volume,
|
||||
@ -109,7 +117,7 @@ func (fsa *FSAdmin) rmSubVolume(volume, group, name string, o rmFlags) error {
|
||||
if group != NoGroup {
|
||||
m["group_name"] = group
|
||||
}
|
||||
return fsa.marshalMgrCommand(o.Update(m)).noData().End()
|
||||
return fsa.marshalMgrCommand(mergeFlags(m, o)).noData().End()
|
||||
}
|
||||
|
||||
type subVolumeResizeFields struct {
|
||||
@ -264,7 +272,7 @@ func (fsa *FSAdmin) CreateSubVolumeSnapshot(volume, group, source, name string)
|
||||
// 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, rmFlags{})
|
||||
return fsa.rmSubVolumeSnapshot(volume, group, subvolume, name, commonRmFlags{})
|
||||
}
|
||||
|
||||
// ForceRemoveSubVolumeSnapshot removes the specified snapshot from the subvolume.
|
||||
@ -272,10 +280,10 @@ func (fsa *FSAdmin) RemoveSubVolumeSnapshot(volume, group, subvolume, name strin
|
||||
// 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, rmFlags{force: true})
|
||||
return fsa.rmSubVolumeSnapshot(volume, group, subvolume, name, commonRmFlags{force: true})
|
||||
}
|
||||
|
||||
func (fsa *FSAdmin) rmSubVolumeSnapshot(volume, group, subvolume, name string, o rmFlags) error {
|
||||
func (fsa *FSAdmin) rmSubVolumeSnapshot(volume, group, subvolume, name string, o commonRmFlags) error {
|
||||
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolume snapshot rm",
|
||||
@ -287,7 +295,7 @@ func (fsa *FSAdmin) rmSubVolumeSnapshot(volume, group, subvolume, name string, o
|
||||
if group != NoGroup {
|
||||
m["group_name"] = group
|
||||
}
|
||||
return fsa.marshalMgrCommand(o.Update(m)).noData().End()
|
||||
return fsa.marshalMgrCommand(mergeFlags(m, o)).noData().End()
|
||||
}
|
||||
|
||||
// ListSubVolumeSnapshots returns a listing of snapshots for a given subvolume.
|
||||
|
66
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolumegroup.go
generated
vendored
66
vendor/github.com/ceph/go-ceph/cephfs/admin/subvolumegroup.go
generated
vendored
@ -69,23 +69,23 @@ func (fsa *FSAdmin) ListSubVolumeGroups(volume string) ([]string, error) {
|
||||
// Similar To:
|
||||
// ceph fs subvolumegroup rm <volume> <group_name>
|
||||
func (fsa *FSAdmin) RemoveSubVolumeGroup(volume, name string) error {
|
||||
return fsa.rmSubVolumeGroup(volume, name, rmFlags{})
|
||||
return fsa.rmSubVolumeGroup(volume, name, commonRmFlags{})
|
||||
}
|
||||
|
||||
// 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, rmFlags{force: true})
|
||||
return fsa.rmSubVolumeGroup(volume, name, commonRmFlags{force: true})
|
||||
}
|
||||
|
||||
func (fsa *FSAdmin) rmSubVolumeGroup(volume, name string, o rmFlags) error {
|
||||
res := fsa.marshalMgrCommand(o.Update(map[string]string{
|
||||
func (fsa *FSAdmin) rmSubVolumeGroup(volume, name string, o commonRmFlags) error {
|
||||
res := fsa.marshalMgrCommand(mergeFlags(map[string]string{
|
||||
"prefix": "fs subvolumegroup rm",
|
||||
"vol_name": volume,
|
||||
"group_name": name,
|
||||
"format": "json",
|
||||
}))
|
||||
}, o))
|
||||
return res.noData().End()
|
||||
}
|
||||
|
||||
@ -103,59 +103,3 @@ func (fsa *FSAdmin) SubVolumeGroupPath(volume, name string) (string, error) {
|
||||
}
|
||||
return parsePathResponse(fsa.marshalMgrCommand(m))
|
||||
}
|
||||
|
||||
// CreateSubVolumeGroupSnapshot creates a new snapshot from the source subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
// ceph fs subvolumegroup snapshot create <volume> <group> <name>
|
||||
func (fsa *FSAdmin) CreateSubVolumeGroupSnapshot(volume, group, name string) error {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolumegroup snapshot create",
|
||||
"vol_name": volume,
|
||||
"group_name": group,
|
||||
"snap_name": name,
|
||||
"format": "json",
|
||||
}
|
||||
return fsa.marshalMgrCommand(m).noData().End()
|
||||
}
|
||||
|
||||
// RemoveSubVolumeGroupSnapshot removes the specified snapshot from the subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
// ceph fs subvolumegroup snapshot rm <volume> <group> <name>
|
||||
func (fsa *FSAdmin) RemoveSubVolumeGroupSnapshot(volume, group, name string) error {
|
||||
return fsa.rmSubVolumeGroupSnapshot(volume, group, name, rmFlags{})
|
||||
}
|
||||
|
||||
// ForceRemoveSubVolumeGroupSnapshot removes the specified snapshot from the subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
// ceph fs subvolumegroup snapshot rm <volume> <group> <name> --force
|
||||
func (fsa *FSAdmin) ForceRemoveSubVolumeGroupSnapshot(volume, group, name string) error {
|
||||
return fsa.rmSubVolumeGroupSnapshot(volume, group, name, rmFlags{force: true})
|
||||
}
|
||||
|
||||
func (fsa *FSAdmin) rmSubVolumeGroupSnapshot(volume, group, name string, o rmFlags) error {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolumegroup snapshot rm",
|
||||
"vol_name": volume,
|
||||
"group_name": group,
|
||||
"snap_name": name,
|
||||
"format": "json",
|
||||
}
|
||||
return fsa.marshalMgrCommand(o.Update(m)).noData().End()
|
||||
}
|
||||
|
||||
// ListSubVolumeGroupSnapshots returns a listing of snapshots for a given subvolume group.
|
||||
//
|
||||
// Similar To:
|
||||
// ceph fs subvolumegroup snapshot ls <volume> <group>
|
||||
func (fsa *FSAdmin) ListSubVolumeGroupSnapshots(volume, group string) ([]string, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolumegroup snapshot ls",
|
||||
"vol_name": volume,
|
||||
"group_name": group,
|
||||
"format": "json",
|
||||
}
|
||||
return parseListNames(fsa.marshalMgrCommand(m))
|
||||
}
|
||||
|
Reference in New Issue
Block a user