mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-18 04:10:22 +00:00
util: add method to get rados connection
New go-ceph admin package api's expects to pass the rados connection as argument. added new method called GetRBDAdmin to get admin connection to administrate rbd volumes. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
8732bec369
commit
b1710f4c53
@ -23,6 +23,7 @@ import (
|
||||
|
||||
ca "github.com/ceph/go-ceph/cephfs/admin"
|
||||
"github.com/ceph/go-ceph/rados"
|
||||
ra "github.com/ceph/go-ceph/rbd/admin"
|
||||
)
|
||||
|
||||
type ClusterConnection struct {
|
||||
@ -111,6 +112,15 @@ func (cc *ClusterConnection) GetFSAdmin() (*ca.FSAdmin, error) {
|
||||
return ca.NewFromConn(cc.conn), nil
|
||||
}
|
||||
|
||||
// GetRBDAdmin get RBDAdmin to administrate rbd volumes.
|
||||
func (cc *ClusterConnection) GetRBDAdmin() (*ra.RBDAdmin, error) {
|
||||
if cc.conn == nil {
|
||||
return nil, errors.New("cluster is not connected yet")
|
||||
}
|
||||
|
||||
return ra.NewFromConn(cc.conn), nil
|
||||
}
|
||||
|
||||
// DisableDiscardOnZeroedWriteSame enables the
|
||||
// `rbd_discard_on_zeroed_write_same` option in the cluster connection, so that
|
||||
// writing zero blocks of data are actual writes on the OSDs (doing
|
||||
|
Loading…
Reference in New Issue
Block a user