mirror of https://github.com/ceph/go-ceph
cephfs: wrap ceph_create_from_rados function
Support creating a cephfs 'mount' from an existing rados connection using the ceph_create_from_rados function. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
46ed646e03
commit
9929f63b13
|
@ -13,6 +13,7 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/ceph/go-ceph/errutil"
|
"github.com/ceph/go-ceph/errutil"
|
||||||
|
"github.com/ceph/go-ceph/rados"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CephFSError int
|
type CephFSError int
|
||||||
|
@ -47,6 +48,20 @@ func CreateMount() (*MountInfo, error) {
|
||||||
return mount, nil
|
return mount, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateFromRados creates a mount handle using an existing rados cluster
|
||||||
|
// connection.
|
||||||
|
//
|
||||||
|
// Implements:
|
||||||
|
// int ceph_create_from_rados(struct ceph_mount_info **cmount, rados_t cluster);
|
||||||
|
func CreateFromRados(conn *rados.Conn) (*MountInfo, error) {
|
||||||
|
mount := &MountInfo{}
|
||||||
|
ret := C.ceph_create_from_rados(&mount.mount, C.rados_t(conn.Cluster()))
|
||||||
|
if ret != 0 {
|
||||||
|
return nil, getError(ret)
|
||||||
|
}
|
||||||
|
return mount, nil
|
||||||
|
}
|
||||||
|
|
||||||
// ReadDefaultConfigFile loads the ceph configuration from the specified config file.
|
// ReadDefaultConfigFile loads the ceph configuration from the specified config file.
|
||||||
func (mount *MountInfo) ReadDefaultConfigFile() error {
|
func (mount *MountInfo) ReadDefaultConfigFile() error {
|
||||||
ret := C.ceph_conf_read_file(mount.mount, nil)
|
ret := C.ceph_conf_read_file(mount.mount, nil)
|
||||||
|
|
Loading…
Reference in New Issue