From: Nizamudeen A Date: Thu, 26 Jun 2025 07:25:22 +0000 (+0530) Subject: mgr/dashboard: catch protobuf error due to mismatch in version X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a28e7849f3aefb394cfb9b059418199b1da96c8a;p=ceph.git mgr/dashboard: catch protobuf error due to mismatch in version Signed-off-by: Nizamudeen A (cherry picked from commit acb0f19c4a50b2ea68f328a61a14a2da06be298b) Conflicts: src/pybind/mgr/dashboard/services/nvmeof_client.py - only kept relavant portion applicable for squid --- diff --git a/src/pybind/mgr/dashboard/services/nvmeof_client.py b/src/pybind/mgr/dashboard/services/nvmeof_client.py index e0ea6d1e48b..be2b5edbaa5 100644 --- a/src/pybind/mgr/dashboard/services/nvmeof_client.py +++ b/src/pybind/mgr/dashboard/services/nvmeof_client.py @@ -1,3 +1,5 @@ +# pylint: disable=unexpected-keyword-arg + import functools import logging from collections.abc import Iterable @@ -9,6 +11,14 @@ from .nvmeof_conf import NvmeofGatewaysConfig logger = logging.getLogger("nvmeof_client") try: + # if the protobuf version is newer than what we generated with + # proto file import will fail (because of differences between what's + # available in centos and ubuntu). + # this "hack" should be removed once we update both the + # distros; centos and ubuntu. + import os + os.environ["PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION"] = "python" + import grpc # type: ignore import grpc._channel # type: ignore from google.protobuf.message import Message # type: ignore