Project

General

Profile

Bug #41354 » test_volumes.py

Nikola Ciprich, 08/20/2019 04:07 PM

 
import rbd
import rados

if __name__ == "__main__":
counter = 0
x = 0
r = rbd.RBD()

with rados.Rados(conffile='/etc/ceph/ceph.conf') as cluster:
with cluster.open_ioctx("sata") as ioctx:
volumes = r.list(ioctx)

while True:
for volume in volumes:
if x >= 100:
counter += x
x = 0
print("Volumes counter: %s" % (counter))
try:
with rados.Rados(conffile='/etc/ceph/ceph.conf') as cluster:
with cluster.open_ioctx("sata") as ioctx:
try:
with rbd.Image(ioctx, name=volume, read_only=True) as rbdi:
x += 1
except rbd.ImageNotFound:
print("%s volume not found" % (volume))
except rbd.ImageBusy:
print("%s volume busy" % (volume))
except Exception as err:
print("%s %s" % (volume, err))
except Exception as err:
print("%s %s" % (volume, err))
(1-1/3)