def default_fs(self) -> str: fs_map = self.get('fs_map') if fs_map['filesystems']: return fs_map['filesystems'][0]['mdsmap']['fs_name'] else: self.log.error('No filesystem instance could be found.') raise CephfsConnectionException( -errno.ENOENT, "no filesystem found")
def store_schedule_db(self, fs): # only store db is it exists, otherwise nothing to do metadata_pool = self.get_metadata_pool(fs) if not metadata_pool: raise CephfsConnectionException( -errno.ENOENT, "Filesystem {} does not exist".format(fs)) if fs in self.sqlite_connections: db_content = [] db = self.sqlite_connections[fs] with db: for row in db.iterdump(): db_content.append(row) with open_ioctx(self, metadata_pool) as ioctx: ioctx.write_full(SNAP_DB_OBJECT_NAME, '\n'.join(db_content).encode('utf-8'))