Bump reva to 85468735db
To get new GetUserNoGroups() helper
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
//go:build !(octopus || pacific || quincy || reef || squid) && ceph_preview
|
||||
|
||||
package admin
|
||||
|
||||
// SubVolumeSnapshotPath returns the path for a snapshot from the source subvolume.
|
||||
//
|
||||
// Similar To:
|
||||
//
|
||||
// ceph fs subvolume snapshot getpath <volume> --group-name=<group> <source> <name>
|
||||
func (fsa *FSAdmin) SubVolumeSnapshotPath(volume, group, source, name string) (string, error) {
|
||||
m := map[string]string{
|
||||
"prefix": "fs subvolume snapshot getpath",
|
||||
"vol_name": volume,
|
||||
"sub_name": source,
|
||||
"snap_name": name,
|
||||
"format": "json",
|
||||
}
|
||||
if group != NoGroup {
|
||||
m["group_name"] = group
|
||||
}
|
||||
return parsePathResponse(fsa.marshalMgrCommand(m))
|
||||
}
|
||||
+6
-2
@@ -7,6 +7,10 @@ package cephfs
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <cephfs/libcephfs.h>
|
||||
|
||||
int _go_ceph_fchown(struct ceph_mount_info *cmount, int fd, uid_t uid, gid_t gid) {
|
||||
return ceph_fchown(cmount, fd, uid, gid);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@@ -278,13 +282,13 @@ func (f *File) Fchmod(mode uint32) error {
|
||||
//
|
||||
// Implements:
|
||||
//
|
||||
// int ceph_fchown(struct ceph_mount_info *cmount, int fd, int uid, int gid);
|
||||
// int ceph_fchown(struct ceph_mount_info *cmount, int fd, uid_t uid, gid_t gid);
|
||||
func (f *File) Fchown(user uint32, group uint32) error {
|
||||
if err := f.validate(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ret := C.ceph_fchown(f.mount.mount, f.fd, C.int(user), C.int(group))
|
||||
ret := C._go_ceph_fchown(f.mount.mount, f.fd, C.uid_t(user), C.gid_t(group))
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
|
||||
+10
-2
@@ -5,6 +5,14 @@ package cephfs
|
||||
#cgo CPPFLAGS: -D_FILE_OFFSET_BITS=64
|
||||
#include <stdlib.h>
|
||||
#include <cephfs/libcephfs.h>
|
||||
|
||||
int _go_ceph_chown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid) {
|
||||
return ceph_chown(cmount, path, uid, gid);
|
||||
}
|
||||
|
||||
int _go_ceph_lchown(struct ceph_mount_info *cmount, const char *path, uid_t uid, gid_t gid) {
|
||||
return ceph_lchown(cmount, path, uid, gid);
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
@@ -26,7 +34,7 @@ func (mount *MountInfo) Chown(path string, user uint32, group uint32) error {
|
||||
cPath := C.CString(path)
|
||||
defer C.free(unsafe.Pointer(cPath))
|
||||
|
||||
ret := C.ceph_chown(mount.mount, cPath, C.int(user), C.int(group))
|
||||
ret := C._go_ceph_chown(mount.mount, cPath, C.uid_t(user), C.gid_t(group))
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
@@ -35,6 +43,6 @@ func (mount *MountInfo) Lchown(path string, user uint32, group uint32) error {
|
||||
cPath := C.CString(path)
|
||||
defer C.free(unsafe.Pointer(cPath))
|
||||
|
||||
ret := C.ceph_lchown(mount.mount, cPath, C.int(user), C.int(group))
|
||||
ret := C._go_ceph_lchown(mount.mount, cPath, C.uid_t(user), C.gid_t(group))
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
+20
@@ -6,15 +6,35 @@ type MgrCommander interface {
|
||||
MgrCommand(buf [][]byte) ([]byte, string, error)
|
||||
}
|
||||
|
||||
// MgrBufferCommander is an interface for the API needed to execute JSON
|
||||
// formatted commands with an input buffer on the Ceph mgr.
|
||||
type MgrBufferCommander interface {
|
||||
MgrCommandWithInputBuffer([][]byte, []byte) ([]byte, string, error)
|
||||
}
|
||||
|
||||
// MonCommander is an interface for the API needed to execute JSON formatted
|
||||
// commands on the ceph mon(s).
|
||||
type MonCommander interface {
|
||||
MonCommand(buf []byte) ([]byte, string, error)
|
||||
}
|
||||
|
||||
// MonBufferCommander is an interface for the API needed to execute JSON
|
||||
// formatted commands with an input buffer on the Ceph mon(s).
|
||||
type MonBufferCommander interface {
|
||||
MonCommandWithInputBuffer([]byte, []byte) ([]byte, string, error)
|
||||
}
|
||||
|
||||
// RadosCommander provides an interface for APIs needed to execute JSON
|
||||
// formatted commands on the Ceph cluster.
|
||||
type RadosCommander interface {
|
||||
MgrCommander
|
||||
MonCommander
|
||||
}
|
||||
|
||||
// RadosBufferCommander provides an interface for APIs that need to execute
|
||||
// JSON formatted commands with an input buffer on the Ceph cluster.
|
||||
type RadosBufferCommander interface {
|
||||
RadosCommander
|
||||
MgrBufferCommander
|
||||
MonBufferCommander
|
||||
}
|
||||
|
||||
+38
@@ -51,3 +51,41 @@ func MarshalMonCommand(m ccom.MonCommander, v interface{}) Response {
|
||||
}
|
||||
return RawMonCommand(m, b)
|
||||
}
|
||||
|
||||
// MarshalMgrCommandWithBuffer takes a generic interface{} value, converts
|
||||
// it to JSON and sends the JSON, along with the buffer data, to the MGR as
|
||||
// a command.
|
||||
func MarshalMgrCommandWithBuffer(
|
||||
m ccom.MgrBufferCommander, v interface{}, buf []byte) Response {
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return Response{err: err}
|
||||
}
|
||||
if err := validate(m); err != nil {
|
||||
return Response{err: err}
|
||||
}
|
||||
return NewResponse(m.MgrCommandWithInputBuffer(
|
||||
[][]byte{b},
|
||||
buf,
|
||||
))
|
||||
}
|
||||
|
||||
// MarshalMonCommandWithBuffer takes a generic interface{} value, converts
|
||||
// it to JSON and sends the JSON, along with the buffer data, to the MON(s)
|
||||
// as a command.
|
||||
func MarshalMonCommandWithBuffer(
|
||||
m ccom.MonBufferCommander, v interface{}, buf []byte) Response {
|
||||
|
||||
b, err := json.Marshal(v)
|
||||
if err != nil {
|
||||
return Response{err: err}
|
||||
}
|
||||
if err := validate(m); err != nil {
|
||||
return Response{err: err}
|
||||
}
|
||||
return NewResponse(m.MonCommandWithInputBuffer(
|
||||
b,
|
||||
buf,
|
||||
))
|
||||
}
|
||||
|
||||
+38
-2
@@ -9,7 +9,7 @@ import (
|
||||
// NewTraceCommander is a RadosCommander that wraps a given RadosCommander
|
||||
// and when commands are executes prints debug level "traces" to the
|
||||
// standard output.
|
||||
func NewTraceCommander(c ccom.RadosCommander) ccom.RadosCommander {
|
||||
func NewTraceCommander(c ccom.RadosBufferCommander) ccom.RadosBufferCommander {
|
||||
return &tracingCommander{c}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func NewTraceCommander(c ccom.RadosCommander) ccom.RadosCommander {
|
||||
// interface in FSAdmin. You can layer any sort of debugging, error injection,
|
||||
// or whatnot between the FSAdmin layer and the RADOS layer.
|
||||
type tracingCommander struct {
|
||||
conn ccom.RadosCommander
|
||||
conn ccom.RadosBufferCommander
|
||||
}
|
||||
|
||||
func (t *tracingCommander) MgrCommand(buf [][]byte) ([]byte, string, error) {
|
||||
@@ -51,3 +51,39 @@ func (t *tracingCommander) MonCommand(buf []byte) ([]byte, string, error) {
|
||||
}
|
||||
return r, s, err
|
||||
}
|
||||
|
||||
func (t *tracingCommander) MgrCommandWithInputBuffer(
|
||||
cbuf [][]byte, dbuf []byte) ([]byte, string, error) {
|
||||
|
||||
fmt.Println("(MGR Command w/buffer)")
|
||||
for i := range cbuf {
|
||||
fmt.Println("IN:", string(cbuf[i]))
|
||||
}
|
||||
fmt.Println("IN DATA:", string(dbuf))
|
||||
r, s, err := t.conn.MgrCommandWithInputBuffer(cbuf, dbuf)
|
||||
fmt.Println("OUT(result):", string(r))
|
||||
if s != "" {
|
||||
fmt.Println("OUT(status):", s)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println("OUT(error):", err.Error())
|
||||
}
|
||||
return r, s, err
|
||||
}
|
||||
|
||||
func (t *tracingCommander) MonCommandWithInputBuffer(
|
||||
cbuf []byte, dbuf []byte) ([]byte, string, error) {
|
||||
|
||||
fmt.Println("(MON Command w/buffer)")
|
||||
fmt.Println("IN:", string(cbuf))
|
||||
fmt.Println("IN DATA:", string(dbuf))
|
||||
r, s, err := t.conn.MonCommandWithInputBuffer(cbuf, dbuf)
|
||||
fmt.Println("OUT(result):", string(r))
|
||||
if s != "" {
|
||||
fmt.Println("OUT(status):", s)
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Println("OUT(error):", err.Error())
|
||||
}
|
||||
return r, s, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user