rados.py: fix 'Rados' has no member 'name'

Lets store rados_id from __init__ and use this instead of 'name'.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf 2013-03-21 18:23:25 +01:00
parent eed8d532c6
commit d81d2c02d9

View File

@ -107,6 +107,7 @@ Rados object in state %s." % (self.state))
def __init__(self, rados_id=None, conf=None, conffile=None):
self.librados = CDLL('librados.so.2')
self.cluster = c_void_p()
self.rados_id = rados_id
if rados_id is not None and not isinstance(rados_id, str):
raise TypeError('rados_id must be a string or None')
if conffile is not None and not isinstance(conffile, str):
@ -196,7 +197,7 @@ Rados object in state %s." % (self.state))
ret = self.librados.rados_cluster_stat(self.cluster, byref(stats))
if ret < 0:
raise make_ex(
ret, "Rados.get_cluster_stats(%s): get_stats failed" % self.name)
ret, "Rados.get_cluster_stats(%s): get_stats failed" % self.rados_id)
return {'kb': stats.kb,
'kb_used': stats.kb_used,
'kb_avail': stats.kb_avail,