mirror of https://github.com/ceph/go-ceph
rados: add wrapper for the function rados_ioctx_get_id()
Implements GetPoolID() and test case around the same. Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
parent
2bb1b9bffc
commit
837777d3fc
|
@ -249,6 +249,15 @@ func (ioctx *IOContext) GetPoolStats() (stat PoolStat, err error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// 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)
|
||||
return int64(ret)
|
||||
}
|
||||
|
||||
// GetPoolName returns the name of the pool associated with the I/O context.
|
||||
func (ioctx *IOContext) GetPoolName() (name string, err error) {
|
||||
var (
|
||||
|
|
|
@ -610,6 +610,17 @@ func (suite *RadosTestSuite) TestGetPoolStats() {
|
|||
suite.T().Error("Pool stats aren't changing")
|
||||
}
|
||||
|
||||
func (suite *RadosTestSuite) TestGetPoolID() {
|
||||
suite.SetupConnection()
|
||||
|
||||
poolIDByName, err := suite.conn.GetPoolByName(suite.pool)
|
||||
assert.NoError(suite.T(), err)
|
||||
assert.NotEqual(suite.T(), int64(0), poolIDByName)
|
||||
|
||||
poolID := suite.ioctx.GetPoolID()
|
||||
assert.Equal(suite.T(), poolIDByName, poolID)
|
||||
}
|
||||
|
||||
func (suite *RadosTestSuite) TestGetPoolName() {
|
||||
suite.SetupConnection()
|
||||
|
||||
|
|
Loading…
Reference in New Issue