]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
doc: fix sizes in librbd python examples
authorJosh Durgin <josh.durgin@inktank.com>
Thu, 17 May 2012 20:56:32 +0000 (13:56 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Thu, 17 May 2012 20:56:32 +0000 (13:56 -0700)
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
doc/api/librbdpy.rst

index 3ded7e88aa72ee8d0abda99419facc1c466822ac..2c57fd55ecdfb27b622d9b0a7e76c7176437f57d 100644 (file)
@@ -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)