]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/mgr_module: use get("mgr_ips") for standby get_mgr_ip()
authorSage Weil <sage@newdream.net>
Tue, 29 Jun 2021 22:47:13 +0000 (18:47 -0400)
committerSage Weil <sage@newdream.net>
Wed, 30 Jun 2021 15:19:11 +0000 (11:19 -0400)
This is necessary to allow the standby mgr to bind to the right IP.

Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/mgr_module.py

index e6e0945b6bbdca326f7bec72d2f9442811846c72..f133a926bd8a4f18670f1eeb7cd8d6b0d89b57b2 100644 (file)
@@ -826,8 +826,10 @@ class MgrStandbyModule(ceph_module.BaseMgrStandbyModule, MgrModuleLoggingMixin):
         return self._ceph_get(data_name)
 
     def get_mgr_ip(self) -> str:
-        # we don't have get() for standby modules; make do with the hostname
-        return socket.gethostname()
+        ips = self.get("mgr_ips").get('ips', [])
+        if not ips:
+            return socket.gethostname()
+        return ips[0]
 
     def get_localized_module_option(self, key: str, default: OptionValue = None) -> OptionValue:
         r = self._ceph_get_module_option(key, self.get_mgr_id())