pybind/rados: drop auid arg to pool_create

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2018-08-11 14:00:58 -05:00
parent c3ec044415
commit 1cbca88f83
2 changed files with 7 additions and 24 deletions

View File

@ -314,7 +314,7 @@ first. You may list the available pools, create a pool, check to see if a pool
exists, and delete a pool.
.. automethod:: Rados.list_pools()
.. automethod:: Rados.create_pool(pool_name, auid=None, crush_rule=None)
.. automethod:: Rados.create_pool(pool_name, crush_rule=None)
.. automethod:: Rados.pool_exists()
.. automethod:: Rados.delete_pool(pool_name)
@ -331,7 +331,6 @@ invoking methods of the `Ioctx` and other classes.
.. automethod:: Rados.open_ioctx(ioctx_name)
.. automethod:: Ioctx.require_ioctx_open()
.. automethod:: Ioctx.get_stats()
.. automethod:: Ioctx.change_auid(auid)
.. automethod:: Ioctx.get_last_version()
.. automethod:: Ioctx.close()

View File

@ -141,9 +141,7 @@ cdef extern from "rados/librados.h" nogil:
int64_t rados_pool_lookup(rados_t cluster, const char *pool_name)
int rados_pool_reverse_lookup(rados_t cluster, int64_t id, char *buf, size_t maxlen)
int rados_pool_create(rados_t cluster, const char *pool_name)
int rados_pool_create_with_auid(rados_t cluster, const char *pool_name, uint64_t auid)
int rados_pool_create_with_crush_rule(rados_t cluster, const char *pool_name, uint8_t crush_rule_num)
int rados_pool_create_with_all(rados_t cluster, const char *pool_name, uint64_t auid, uint8_t crush_rule_num)
int rados_pool_get_base_tier(rados_t cluster, int64_t pool, int64_t *base_tier)
int rados_pool_list(rados_t cluster, char *buf, size_t len)
int rados_pool_delete(rados_t cluster, const char *pool_name)
@ -1023,19 +1021,15 @@ Rados object in state %s." % self.state)
finally:
free(name)
@requires(('pool_name', str_type), ('auid', opt(int)), ('crush_rule', opt(int)))
def create_pool(self, pool_name, auid=None, crush_rule=None):
@requires(('pool_name', str_type), ('crush_rule', opt(int)))
def create_pool(self, pool_name, crush_rule=None):
"""
Create a pool:
- with default settings: if auid=None and crush_rule=None
- owned by a specific auid: auid given and crush_rule=None
- with a specific CRUSH rule: if auid=None and crush_rule given
- with a specific CRUSH rule and auid: if auid and crush_rule given
- with default settings: if crush_rule=None
- with a specific CRUSH rule: crush_rule given
:param pool_name: name of the pool to create
:type pool_name: str
:param auid: the id of the owner of the new pool
:type auid: int
:param crush_rule: rule to use for placement in the new pool
:type crush_rule: int
@ -1047,24 +1041,14 @@ Rados object in state %s." % self.state)
cdef:
char *_pool_name = pool_name
uint8_t _crush_rule
uint64_t _auid
if auid is None and crush_rule is None:
if crush_rule is None:
with nogil:
ret = rados_pool_create(self.cluster, _pool_name)
elif auid is None:
else:
_crush_rule = crush_rule
with nogil:
ret = rados_pool_create_with_crush_rule(self.cluster, _pool_name, _crush_rule)
elif crush_rule is None:
_auid = auid
with nogil:
ret = rados_pool_create_with_auid(self.cluster, _pool_name, _auid)
else:
_auid = auid
_crush_rule = crush_rule
with nogil:
ret = rados_pool_create_with_all(self.cluster, _pool_name, _auid, _crush_rule)
if ret < 0:
raise make_ex(ret, "error creating pool '%s'" % pool_name)