question: rbd du
I am new to ceph, and am looking at this library to list image information in a dashboard.
How do I get the equivalent of rbd du myrbd or rbd diff myrbd | awk '{ SUM += $2 } END { print SUM/1024/1024 " MB" }' cli command? the Size in rbd.ImageInfo is the total allocated size.
My code so far: https://gist.github.com/sajal/4e7e0bd77d3deced0d450e8f9af7775a
Is there a timeline for when rbd diff is going to be implemented? I see a TODO item on the code which may be related to what the poster needs. Ever got how to do this @sajal ?
@kfajardo I did not.
I gave up on my grand plans of running on bare-metal and no longer need to manage storage.
Awts. Thanks. I also need the go-ceph support for calculating actual usage on what I'm currently working on. @_@ I guess I need to find another way.
Any news about this issue? I can't find a method that calculates a du in the C library. But if someone helps me, I'll try to make a PR, huh
Hi @objque is there a specific C API or set of C APIs that you'd like a wrapper for?
@noahdesu - I guess they are referring to an equivalent to this stat call: http://docs.ceph.com/docs/master/rbd/api/librbdpy/#rbd.Image.stat
Which is already available: https://github.com/ceph/go-ceph/blob/master/rbd/rbd.go#L297
Maybe they didn't find this yet?
Thanks @zeichenanonym that does seem like it might be what's being discussed.
Hey ,
Does it answer the issue here ?
I'm trying to acheive the same goal. Trying to get image use with this go library.
Trying to get same output as rbd du -p POOL_NAME
New permalink: https://github.com/ceph/go-ceph/blob/e32f9f0f2e941422937c0a6c4f0a61b8f0c82995/rbd/rbd.go#L348
Please try if this works for what you want to do ;)
I Might miss something.
This stat function allow me to get the size of image, the block number etc..
But I don't have the usage ? the disk utilization ?
Did i Miss something ?
Copying from the documentation:
dict - contains the following keys:
- size (int) - the size of the image in bytes
- obj_size (int) - the size of each object that comprises the image
- num_objs (int) - the number of objects in the image
- order (int) - log_2(object_size)
- block_name_prefix (str) - the prefix of the RADOS objects used to store the image
- parent_pool (int) - deprecated
- parent_name (str) - deprecated
So you could figure out the disk utilisation by multiplying the num_objs with the obj_size...
There is also rados.IOContext.GetPoolStats() that fills a struct with details about the pool. See
Closing as there have been no follow-up questions for almost 2 months.
hello, I was working with
o you could figure out the disk utilisation by multiplying the num_objs with the obj_siz
Hello, @mulbc I have tried this way but doesn't provide me the appropriate output. I have also tried using 'image.DiffIterate' but that doesn't help me either.