remove_obj() called ioctx.read() without a length, so only the first
8192 bytes of conf-nfs.* were read before write_full(). Removing exports
from a large cluster truncated and corrupted the shared config object,
leaving malformed entries such as '%url "rados:' while export objects
were deleted.
Fixes: https://tracker.ceph.com/issues/77463
Signed-off-by: Shweta Bhosale <Shweta.Bhosale1@ibm.com>
def remove_obj(self, obj: str, config_obj: str, should_notify: Optional[bool] = True) -> None:
with self.rados.open_ioctx(self.pool) as ioctx:
ioctx.set_namespace(self.namespace)
- export_urls = ioctx.read(config_obj)
+ size, _ = ioctx.stat(config_obj)
+ export_urls = ioctx.read(config_obj, size)
url = '%url "{}"\n\n'.format(self._make_rados_url(obj))
export_urls = export_urls.replace(url.encode('utf-8'), b'')
ioctx.remove_object(obj)