]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/PyOSDMap: check parameter in constructor
authorKefu Chai <kchai@redhat.com>
Fri, 18 Jun 2021 13:26:25 +0000 (21:26 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 18 Jun 2021 13:28:50 +0000 (21:28 +0800)
commit2c388dabd2bd5b405e4cb21780a3abcba53ce873
tree3d5614ddcd8e904d07697fe7d686c65c8788df56
parent8538644bc3e34d968b0b79a76e63782e33a144de
mgr/PyOSDMap: check parameter in constructor

* instead abort(), just return a failure, if the input parameter is
  missing
* set a TypeError if the input parameter's type is not expected

a typical session looks like:

[mgr self-test eval] >>> osdmap = OSDMap()
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: function missing required argument 'osdmap_capsule' (pos 1)
[mgr self-test eval] >>> osdmap = OSDMap(1)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: BasePyOSDMap.__init__() requires a PyCapsule_Type not int

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/PyOSDMap.cc