mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
util: add ClusterConnection.GetFSAdmin()
The go-ceph CephFS Admin API needs a rados.Conn to connect the Admin interface to the Ceph cluster. As the rados.Conn is internal to the ClusterConnection type, add GetFSAdmin() to create a new FSAdmin instance for a specific connection. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
1fcd1ed7c7
commit
fe62348cfb
@ -21,6 +21,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
ca "github.com/ceph/go-ceph/cephfs/admin"
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
)
|
||||
|
||||
@ -83,3 +84,11 @@ func (cc *ClusterConnection) GetIoctx(pool string) (*rados.IOContext, error) {
|
||||
|
||||
return ioctx, nil
|
||||
}
|
||||
|
||||
func (cc *ClusterConnection) GetFSAdmin() (*ca.FSAdmin, error) {
|
||||
if cc.conn == nil {
|
||||
return nil, errors.New("cluster is not connected yet")
|
||||
}
|
||||
|
||||
return ca.NewFromConn(cc.conn), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user