]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/rbd_ls.py
4 from types
import OsdMap
5 from remote_view_cache
import RemoteViewCache
7 class RbdPoolLs(RemoteViewCache
):
9 from mgr_module
import ceph_state
10 ctx_capsule
= ceph_state
.get_context()
12 osd_map
= self
._module
.get_sync_object(OsdMap
).data
13 osd_pools
= [pool
['pool_name'] for pool
in osd_map
['pools']]
16 for pool
in osd_pools
:
17 self
.log
.debug("Constructing IOCtx " + pool
)
19 ioctx
= self
._module
.rados
.open_ioctx(pool
)
20 ioctx
.stat("rbd_directory")
21 rbd_pools
.append(pool
)
22 except (rados
.PermissionError
, rados
.ObjectNotFound
):
23 self
.log
.debug("No RBD directory in " + pool
)
25 self
.log
.exception("Failed to open pool " + pool
)
29 class RbdLs(RemoteViewCache
):
30 def __init__(self
, module_inst
, pool
):
31 super(RbdLs
, self
).__init
__(module_inst
)
39 self
.log
.debug("Constructing IOCtx")
40 self
.ioctx
= self
._module
.rados
.open_ioctx(self
.pool
)
42 self
.log
.debug("Constructing RBD")
46 self
.log
.debug("rbd.list")
47 names
= self
.rbd
.list(self
.ioctx
)
50 i
= rbd
.Image(self
.ioctx
, name
)
55 parent_info
= i
.parent_info()
56 parent
= "{}@{}".format(parent_info
[0], parent_info
[1])
57 if parent_info
[0] != self
.pool
:
58 parent
= "{}/{}".format(parent_info
[0], parent
)
59 stat
['parent'] = parent
60 except rbd
.ImageNotFound
: