[Openstack] [Swift] How to get a list of devices from the ring in Java / Bash?
matt at oliver.net.au
Mon Jan 30 22:32:01 UTC 2017
If you wanted to do it using python, and you didn't have swift installed
you can use pickle and unpickle the builder. something like:
builder = pickle.load(open('<path to builder>')
Then you'd have a python dict structure, where I think you can
or with swift installed you can use the RingBuilder class:
from swift.common.ring.builder import RingBuilder
builder = RingBuilder.load('<path to object.builder>')
Where builder.devs will be a list of dictionary objects. You could then
json-ify and output for java to read or put it into an easier to pass list.
There could be a much simpler way, but I'm a Python dev, so this is what
I'd do ;)
On Sat, Jan 28, 2017 at 6:21 AM, Alexandr Porunov <
alexandr.porunov at gmail.com> wrote:
> I need to get a list / array of devices in Java or Bash. Is it possible to
> get? Are there any API or something like that?
> I know we can obtain a list with the next command:
> swift-ring-builder object.builder
> But it return a string with the list of devices which are quite hard to
> parse. In the documentation there is an example how to get a list of
> devices with python:
> devices = list(self._iter_devs())
> But it doesn't show which library to use to get a list of devices and how
> to use that library.
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/
> Post to : openstack at lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Openstack