]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: tolerate failure to update daemon caps
authorSage Weil <sage@newdream.net>
Mon, 15 Mar 2021 16:55:36 +0000 (11:55 -0500)
committerSage Weil <sage@newdream.net>
Tue, 16 Mar 2021 12:56:19 +0000 (07:56 -0500)
If we're upgrading from 15.2.0, we may fail to update caps.  Instead of
failing the upgrade hard, warn to the log and continue.  This is less
than ideal, but the caps will get corrected the next time the daemon is
redeployed on the next upgrade, and most likely the previous caps will
continue to work (given they were presumably working before the upgrade).

Signed-off-by: Sage Weil <sage@newdream.net>
(cherry picked from commit 8ceea1961f818dc2d07edf9c256ebe5150b6b133)

src/pybind/mgr/cephadm/services/cephadmservice.py
src/pybind/mgr/cephadm/tests/test_services.py

index 8376f429fcd1336824826ddec83a7766ca63e968..31a791ee884680364025159a4e977f2f9a0b8a61 100644 (file)
@@ -150,11 +150,13 @@ class CephadmService(metaclass=ABCMeta):
             'caps': caps,
         })
         if err:
-            ret, out, err = self.mgr.check_mon_command({
+            ret, out, err = self.mgr.mon_command({
                 'prefix': 'auth caps',
                 'entity': entity,
                 'caps': caps,
             })
+            if err:
+                self.mgr.log.warning(f"Unable to update caps for {entity}")
         return keyring
 
     def _inventory_get_addr(self, hostname: str) -> str:
index 2c3e036a6ef45a75215e462b6a0f9fd073037d4c..2c2bdfb3584eb65aae58b22a6bc58b2b831458f7 100644 (file)
@@ -19,7 +19,9 @@ class FakeMgr:
     def __init__(self):
         self.config = ''
         self.check_mon_command = MagicMock(side_effect=self._check_mon_command)
+        self.mon_command = MagicMock(side_effect=self._check_mon_command)
         self.template = MagicMock()
+        self.log = MagicMock()
 
     def _check_mon_command(self, cmd_dict, inbuf=None):
         prefix = cmd_dict.get('prefix')
@@ -114,7 +116,7 @@ class TestCephadmService:
                                'caps': expected_caps})
 
         assert expected_call in mgr.check_mon_command.mock_calls
-        assert expected_call2 in mgr.check_mon_command.mock_calls
+        assert expected_call2 in mgr.mon_command.mock_calls
 
     def test_get_auth_entity(self):
         mgr = FakeMgr()