All of lore.kernel.org
 help / color / mirror / Atom feed
* No function to list the pool in rados.py
@ 2011-12-02  5:33 Eric_YH_Chen
  2011-12-02 22:11 ` Josh Durgin
  0 siblings, 1 reply; 2+ messages in thread
From: Eric_YH_Chen @ 2011-12-02  5:33 UTC (permalink / raw)
  To: ceph-devel; +Cc: Chris_YT_Huang

Hi, ceph developments:

  Could we add one more function in rados.py to list the pool?

  I had already implemented the function. Thanks a lot!

class Rados(object):
    def list(self):
        size = c_size_t(512)
        while True:
            c_names = create_string_buffer(size.value)
            ret = self.librados.rados_pool_list(self.cluster,
byref(c_names), size)
            if ret > size.value:
                size = ret
            else:
                break
        return filter(lambda name: name != '', c_names.raw.split('\0'))



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: No function to list the pool in rados.py
  2011-12-02  5:33 No function to list the pool in rados.py Eric_YH_Chen
@ 2011-12-02 22:11 ` Josh Durgin
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Durgin @ 2011-12-02 22:11 UTC (permalink / raw)
  To: Eric_YH_Chen; +Cc: ceph-devel, Chris_YT_Huang

On 12/01/2011 09:33 PM, Eric_YH_Chen@wistron.com wrote:
> Hi, ceph developments:
>
>    Could we add one more function in rados.py to list the pool?
>
>    I had already implemented the function. Thanks a lot!
>
> class Rados(object):
>      def list(self):
>          size = c_size_t(512)
>          while True:
>              c_names = create_string_buffer(size.value)
>              ret = self.librados.rados_pool_list(self.cluster,
> byref(c_names), size)
>              if ret>  size.value:
>                  size = ret
>              else:
>                  break
>          return filter(lambda name: name != '', c_names.raw.split('\0'))

Added in c883100448bb7e86b4f0d52a425e0d0a278c79a0 with a couple small 
changes to check that we're connected and keep the type of size c_size_t.

Next time if you could send a patch or github pull request it'd be 
easier to apply.

Thanks!
Josh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-02 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-02  5:33 No function to list the pool in rados.py Eric_YH_Chen
2011-12-02 22:11 ` Josh Durgin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.