image::
rbd_inst = rbd.RBD()
- size = 4 * 1024 * 1024 # 4 GiB
- rbd_inst.create(ioctx, 'myimage', 4)
+ size = 4 * 1024**3 # 4 GiB
+ rbd_inst.create(ioctx, 'myimage', size)
To perform I/O on the image, you instantiate an :class:rbd.Image object::
ioctx = cluster.open_ioctx('my_pool')
try:
rbd_inst = rbd.RBD()
- size = 4 * 1024 * 1024 # 4 GiB
- rbd_inst.create(ioctx, 'myimage', 4)
+ size = 4 * 1024**3 # 4 GiB
+ rbd_inst.create(ioctx, 'myimage', size)
image = rbd.Image(ioctx, 'myimage')
try:
data = 'foo' * 200
with rados.Rados(conffile='my_ceph.conf') as cluster:
with cluster.open_ioctx('mypool') as ioctx:
rbd_inst = rbd.RBD()
- size = 4 * 1024 * 1024 # 4 GiB
- rbd_inst.create(ioctx, 'myimage', 4)
+ size = 4 * 1024**3 # 4 GiB
+ rbd_inst.create(ioctx, 'myimage', size)
with rbd.Image(ioctx, 'myimage') as image:
data = 'foo' * 200
image.write(data, 0)