mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rebase: update go-ceph version to v0.11.0
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
87beaac25b
commit
56ac143450
60
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
60
vendor/github.com/ceph/go-ceph/rados/conn.go
generated
vendored
@ -38,13 +38,13 @@ func (c *Conn) Cluster() ClusterRef {
|
||||
|
||||
// PingMonitor sends a ping to a monitor and returns the reply.
|
||||
func (c *Conn) PingMonitor(id string) (string, error) {
|
||||
c_id := C.CString(id)
|
||||
defer C.free(unsafe.Pointer(c_id))
|
||||
cid := C.CString(id)
|
||||
defer C.free(unsafe.Pointer(cid))
|
||||
|
||||
var strlen C.size_t
|
||||
var strout *C.char
|
||||
|
||||
ret := C.rados_ping_monitor(c.cluster, c_id, &strout, &strlen)
|
||||
ret := C.rados_ping_monitor(c.cluster, cid, &strout, &strlen)
|
||||
defer C.rados_buffer_free(strout)
|
||||
|
||||
if ret == 0 {
|
||||
@ -75,9 +75,9 @@ func (c *Conn) Shutdown() {
|
||||
|
||||
// ReadConfigFile configures the connection using a Ceph configuration file.
|
||||
func (c *Conn) ReadConfigFile(path string) error {
|
||||
c_path := C.CString(path)
|
||||
defer C.free(unsafe.Pointer(c_path))
|
||||
ret := C.rados_conf_read_file(c.cluster, c_path)
|
||||
cPath := C.CString(path)
|
||||
defer C.free(unsafe.Pointer(cPath))
|
||||
ret := C.rados_conf_read_file(c.cluster, cPath)
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
@ -94,10 +94,10 @@ func (c *Conn) ReadDefaultConfigFile() error {
|
||||
// int rados_ioctx_create(rados_t cluster, const char *pool_name,
|
||||
// rados_ioctx_t *ioctx);
|
||||
func (c *Conn) OpenIOContext(pool string) (*IOContext, error) {
|
||||
c_pool := C.CString(pool)
|
||||
defer C.free(unsafe.Pointer(c_pool))
|
||||
cPool := C.CString(pool)
|
||||
defer C.free(unsafe.Pointer(cPool))
|
||||
ioctx := &IOContext{}
|
||||
ret := C.rados_ioctx_create(c.cluster, c_pool, &ioctx.ioctx)
|
||||
ret := C.rados_ioctx_create(c.cluster, cPool, &ioctx.ioctx)
|
||||
if ret == 0 {
|
||||
return ioctx, nil
|
||||
}
|
||||
@ -127,10 +127,10 @@ func (c *Conn) ListPools() (names []string, err error) {
|
||||
// SetConfigOption sets the value of the configuration option identified by
|
||||
// the given name.
|
||||
func (c *Conn) SetConfigOption(option, value string) error {
|
||||
c_opt, c_val := C.CString(option), C.CString(value)
|
||||
defer C.free(unsafe.Pointer(c_opt))
|
||||
defer C.free(unsafe.Pointer(c_val))
|
||||
ret := C.rados_conf_set(c.cluster, c_opt, c_val)
|
||||
cOpt, cVal := C.CString(option), C.CString(value)
|
||||
defer C.free(unsafe.Pointer(cOpt))
|
||||
defer C.free(unsafe.Pointer(cVal))
|
||||
ret := C.rados_conf_set(c.cluster, cOpt, cVal)
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
@ -179,16 +179,16 @@ func (c *Conn) GetClusterStats() (stat ClusterStat, err error) {
|
||||
if err := c.ensure_connected(); err != nil {
|
||||
return ClusterStat{}, err
|
||||
}
|
||||
c_stat := C.struct_rados_cluster_stat_t{}
|
||||
ret := C.rados_cluster_stat(c.cluster, &c_stat)
|
||||
cStat := C.struct_rados_cluster_stat_t{}
|
||||
ret := C.rados_cluster_stat(c.cluster, &cStat)
|
||||
if ret < 0 {
|
||||
return ClusterStat{}, getError(ret)
|
||||
}
|
||||
return ClusterStat{
|
||||
Kb: uint64(c_stat.kb),
|
||||
Kb_used: uint64(c_stat.kb_used),
|
||||
Kb_avail: uint64(c_stat.kb_avail),
|
||||
Num_objects: uint64(c_stat.num_objects),
|
||||
Kb: uint64(cStat.kb),
|
||||
Kb_used: uint64(cStat.kb_used),
|
||||
Kb_avail: uint64(cStat.kb_avail),
|
||||
Num_objects: uint64(cStat.num_objects),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -261,9 +261,9 @@ func (c *Conn) GetInstanceID() uint64 {
|
||||
|
||||
// MakePool creates a new pool with default settings.
|
||||
func (c *Conn) MakePool(name string) error {
|
||||
c_name := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(c_name))
|
||||
ret := C.rados_pool_create(c.cluster, c_name)
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
ret := C.rados_pool_create(c.cluster, cName)
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
@ -272,9 +272,9 @@ func (c *Conn) DeletePool(name string) error {
|
||||
if err := c.ensure_connected(); err != nil {
|
||||
return err
|
||||
}
|
||||
c_name := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(c_name))
|
||||
ret := C.rados_pool_delete(c.cluster, c_name)
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
ret := C.rados_pool_delete(c.cluster, cName)
|
||||
return getError(ret)
|
||||
}
|
||||
|
||||
@ -283,9 +283,9 @@ func (c *Conn) GetPoolByName(name string) (int64, error) {
|
||||
if err := c.ensure_connected(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
c_name := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(c_name))
|
||||
ret := int64(C.rados_pool_lookup(c.cluster, c_name))
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
ret := int64(C.rados_pool_lookup(c.cluster, cName))
|
||||
if ret < 0 {
|
||||
return 0, radosError(ret)
|
||||
}
|
||||
@ -298,8 +298,8 @@ func (c *Conn) GetPoolByID(id int64) (string, error) {
|
||||
if err := c.ensure_connected(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
c_id := C.int64_t(id)
|
||||
ret := int(C.rados_pool_reverse_lookup(c.cluster, c_id, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))))
|
||||
cid := C.int64_t(id)
|
||||
ret := int(C.rados_pool_reverse_lookup(c.cluster, cid, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))))
|
||||
if ret < 0 {
|
||||
return "", radosError(ret)
|
||||
}
|
||||
|
Reference in New Issue
Block a user