]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: don't set the default values for the options not specified in copying
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Thu, 2 Jun 2016 09:39:50 +0000 (05:39 -0400)
committerDongsheng Yang <dongsheng.yang@easystack.cn>
Fri, 22 Jul 2016 11:04:09 +0000 (07:04 -0400)
Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
src/pybind/rbd/rbd.pyx

index 889ec24f86e12efcf3b337728dfdf4ea8a400011..fed533e41cf7ba741eef6588896c33b18be88d1f 100644 (file)
@@ -1430,7 +1430,7 @@ cdef class Image(object):
         return owner == 1
 
     def copy(self, dest_ioctx, dest_name, features=None, order=None,
-             stripe_unit=0, stripe_count=0):
+             stripe_unit=None, stripe_count=None):
         """
         Copy the image to another location.
 
@@ -1442,7 +1442,7 @@ cdef class Image(object):
         :type features: int
         :param order: the image is split into (2**order) byte objects
         :type order: int
-        :param stripe_unit: stripe unit in bytes (default 0 for object size)
+        :param stripe_unit: stripe unit in bytes (default None to let librbd decide)
         :type stripe_unit: int
         :param stripe_count: objects to stripe over before looping
         :type stripe_count: int
@@ -1452,8 +1452,6 @@ cdef class Image(object):
         :raises: :class:`FunctionNotSupported`
         :raises: :class:`ArgumentOutOfRange`
         """
-        if order is None:
-            order = 0
         dest_name = cstr(dest_name, 'dest_name')
         cdef:
             rados_ioctx_t _dest_ioctx = convert_ioctx(dest_ioctx)
@@ -1465,12 +1463,15 @@ cdef class Image(object):
             if features is not None:
                 rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_FEATURES,
                                              features)
-            rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_ORDER,
-                                         order)
-            rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_STRIPE_UNIT,
-                                         stripe_unit)
-            rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_STRIPE_COUNT,
-                                         stripe_count)
+            if order is not None:
+                rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_ORDER,
+                                             order)
+            if stripe_unit is not None:
+                rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_STRIPE_UNIT,
+                                             stripe_unit)
+            if stripe_count is not None:
+                rbd_image_options_set_uint64(opts, RBD_IMAGE_OPTION_STRIPE_COUNT,
+                                             stripe_count)
             with nogil:
                 ret = rbd_copy3(self.image, _dest_ioctx, _dest_name, opts)
         finally: