+.. _rbd api py:
+
================
Librbd (Python)
================
To perform I/O on the image, you instantiate an :class:rbd.Image object::
image = rbd.Image(ioctx, 'myimage')
- data = 'foo' * 200
+ data = b'foo' * 200
image.write(data, 0)
This writes 'foo' to the first 600 bytes of the image. Note that data
rbd_inst.create(ioctx, 'myimage', size)
image = rbd.Image(ioctx, 'myimage')
try:
- data = 'foo' * 200
+ data = b'foo' * 200
image.write(data, 0)
finally:
image.close()
size = 4 * 1024**3 # 4 GiB
rbd_inst.create(ioctx, 'myimage', size)
with rbd.Image(ioctx, 'myimage') as image:
- data = 'foo' * 200
+ data = b'foo' * 200
image.write(data, 0)
API Reference