mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
pybind: add special values for not reading conffile
Fixes: https://tracker.ceph.com/issues/44415 Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
664a8dab9f
commit
7e4275390c
@ -597,13 +597,18 @@ cdef class LibCephFS(object):
|
||||
raise Error("libcephfs_initialize failed with error code: %d" % ret)
|
||||
self.state = "configuring"
|
||||
|
||||
def create(self, conf=None, conffile=None, auth_id=None):
|
||||
NO_CONF_FILE = -1
|
||||
"special value that indicates no conffile should be read when creating a mount handle"
|
||||
DEFAULT_CONF_FILES = -2
|
||||
"special value that indicates the default conffiles should be read when creating a mount handle"
|
||||
|
||||
def create(self, conf=None, conffile=NO_CONF_FILE, auth_id=None):
|
||||
"""
|
||||
Create a mount handle for interacting with Ceph. All libcephfs
|
||||
functions operate on a mount info handle.
|
||||
|
||||
:param conf dict opt: settings overriding the default ones and conffile
|
||||
:param conffile str opt: the path to ceph.conf to override the default settings
|
||||
:param conffile Union[int,str], optional: the path to ceph.conf to override the default settings
|
||||
:auth_id str opt: the id used to authenticate the client entity
|
||||
"""
|
||||
if conf is not None and not isinstance(conf, dict):
|
||||
@ -621,10 +626,11 @@ cdef class LibCephFS(object):
|
||||
raise Error("libcephfs_initialize failed with error code: %d" % ret)
|
||||
|
||||
self.state = "configuring"
|
||||
if conffile is not None:
|
||||
# read the default conf file when '' is given
|
||||
if conffile == '':
|
||||
conffile = None
|
||||
if conffile in (self.NO_CONF_FILE, None):
|
||||
pass
|
||||
elif conffile in (self.DEFAULT_CONF_FILES, ''):
|
||||
self.conf_read_file(None)
|
||||
else:
|
||||
self.conf_read_file(conffile)
|
||||
if conf is not None:
|
||||
for key, value in conf.items():
|
||||
|
@ -708,10 +708,15 @@ cdef class Rados(object):
|
||||
PyEval_InitThreads()
|
||||
self.__setup(*args, **kwargs)
|
||||
|
||||
NO_CONF_FILE = -1
|
||||
"special value that indicates no conffile should be read when creating a mount handle"
|
||||
DEFAULT_CONF_FILES = -2
|
||||
"special value that indicates the default conffiles should be read when creating a mount handle"
|
||||
|
||||
@requires(('rados_id', opt(str)), ('name', opt(str)), ('clustername', opt(str)),
|
||||
('conffile', opt(str)))
|
||||
('conffile', (str, int)))
|
||||
def __setup(self, rados_id=None, name=None, clustername=None,
|
||||
conf_defaults=None, conffile=None, conf=None, flags=0,
|
||||
conf_defaults=None, conffile=NO_CONF_FILE, conf=None, flags=0,
|
||||
context=None):
|
||||
self.monitor_callback = None
|
||||
self.monitor_callback2 = None
|
||||
@ -753,10 +758,11 @@ cdef class Rados(object):
|
||||
if conf_defaults:
|
||||
for key, value in conf_defaults.items():
|
||||
self.conf_set(key, value)
|
||||
if conffile is not None:
|
||||
# read the default conf file when '' is given
|
||||
if conffile == '':
|
||||
conffile = None
|
||||
if conffile in (self.NO_CONF_FILE, None):
|
||||
pass
|
||||
elif conffile in (self.DEFAULT_CONF_FILES, ''):
|
||||
self.conf_read_file(None)
|
||||
else:
|
||||
self.conf_read_file(conffile)
|
||||
if conf:
|
||||
for key, value in conf.items():
|
||||
|
Loading…
Reference in New Issue
Block a user