]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: fixed runtime errors with librbdpy 3657/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 4 Feb 2015 14:46:17 +0000 (09:46 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 4 Feb 2015 14:47:55 +0000 (09:47 -0500)
There was a typo within the RBD Image get_flags method and
several runtime errors relating to the new fadvise flags.

Fixes: #10782
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/pybind/rados.py
src/pybind/rbd.py
src/test/pybind/test_rbd.py

index 88bbde51fc083de2675b6b9ab04c8154d77cf32f..41b0c4548e6030896012080a32b4ba5c2391ffc3 100644 (file)
@@ -17,6 +17,12 @@ ANONYMOUS_AUID = 0xffffffffffffffff
 ADMIN_AUID = 0
 LIBRADOS_ALL_NSPACES = '\001'
 
+LIBRADOS_OP_FLAG_FADVISE_RANDOM            = 0x4
+LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL = 0x8
+LIBRADOS_OP_FLAG_FADVISE_WILLNEED   = 0x10
+LIBRADOS_OP_FLAG_FADVISE_DONTNEED   = 0x20
+LIBRADOS_OP_FLAG_FADVISE_NOCACHE    = 0x40
+
 class Error(Exception):
     """ `Error` class, derived from `Exception` """
     pass
index 0a9fb04e772c6b512131b27934f81f02105dcaac..334e4c750103c6d9889be8dc5c92f28683d06f68 100644 (file)
@@ -534,7 +534,7 @@ class Image(object):
         :returns: int - the flags bitmask of the image
         """
         flags = c_uint64()
-        reg = self.librbd.rbd_get_flags(self.image, byref(flags))
+        ret = self.librbd.rbd_get_flags(self.image, byref(flags))
         if (ret != 0):
             raise make_ex(ret, 'error getting flags for image' % (self.name))
         return flags.value
index a66b945324283569dff1357a6e9edd9e7b54a8f1..853b8b2723ec56e3f265d0c2d4498daaf6aad29d 100644 (file)
@@ -8,7 +8,10 @@ import os
 from contextlib import nested
 from nose import with_setup, SkipTest
 from nose.tools import eq_ as eq, assert_raises
-from rados import Rados
+from rados import (Rados,
+                   LIBRADOS_OP_FLAG_FADVISE_DONTNEED,
+                   LIBRADOS_OP_FLAG_FADVISE_NOCACHE,
+                   LIBRADOS_OP_FLAG_FADVISE_RANDOM)
 from rbd import (RBD, Image, ImageNotFound, InvalidArgument, ImageExists,
                  ImageBusy, ImageHasSnapshots, ReadOnlyImage,
                  FunctionNotSupported, ArgumentOutOfRange,
@@ -300,7 +303,7 @@ class TestImage(object):
         data = rand_data(256)
         self.image.write(data, 0)
 
-    def test_write_with_fadivse_flags(self):
+    def test_write_with_fadvise_flags(self):
         data = rand_data(256)
         self.image.write(data, 0, LIBRADOS_OP_FLAG_FADVISE_DONTNEED)
         self.image.write(data, 0, LIBRADOS_OP_FLAG_FADVISE_NOCACHE)
@@ -309,10 +312,10 @@ class TestImage(object):
         data = self.image.read(0, 20)
         eq(data, '\0' * 20)
 
-     def test_read_with_fadivse_flags(self):
-        data = self.image.read(0, 20, LIBRADOS_OP_FLAG_FADIVSE_DONTNEED)
+    def test_read_with_fadvise_flags(self):
+        data = self.image.read(0, 20, LIBRADOS_OP_FLAG_FADVISE_DONTNEED)
         eq(data, '\0' * 20)
-        data = self.image.read(0, 20, LIBRADOS_OP_FLAG_FADIVSE_RANDOM)
+        data = self.image.read(0, 20, LIBRADOS_OP_FLAG_FADVISE_RANDOM)
         eq(data, '\0' * 20)
 
     def test_large_write(self):