From: Josh Durgin Date: Thu, 17 May 2012 20:56:32 +0000 (-0700) Subject: doc: fix sizes in librbd python examples X-Git-Tag: v0.48argonaut~137^2~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=572c756036f7a8581ccc521cfe990e1160abee8c;p=ceph.git doc: fix sizes in librbd python examples Signed-off-by: Josh Durgin --- diff --git a/doc/api/librbdpy.rst b/doc/api/librbdpy.rst index 3ded7e88aa72..2c57fd55ecdf 100644 --- a/doc/api/librbdpy.rst +++ b/doc/api/librbdpy.rst @@ -21,8 +21,8 @@ Then you instantiate an :class:rbd.RBD object, which you use to create the 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:: @@ -48,8 +48,8 @@ block:: 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 @@ -68,8 +68,8 @@ classes can be used as context managers that close/shutdown automatically (see 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)