Actions
Cleanup #62327
opencephadm: make function for looping through networks data
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
% Done:
0%
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:
Description
Cephadm stores network info about the hosts it manages. For example
[root@vm-00 ~]# cephadm list-networks { "10.2.1.0/24": { "eth1": [ "10.2.1.49" ] }, "192.168.122.0/24": { "eth0": [ "192.168.122.56" ] }, "fe80::/64": { "eth0": [ "fe80::5054:ff:fef8:e037" ], "eth1": [ "fe80::5054:ff:fe15:1a1d" ] } }
There are some places in the cephadm codebase that want to loop over this structure, typically to find interfaces that can be used for specific IP addresses.
for subnet, ifaces in self.mgr.cache.networks.get(host, {}).items(): if ifaces and ipaddress.ip_address(bare_ip) in ipaddress.ip_network(subnet):
We should probably add a function specifically for this case, since it's being done multiple times.
No data to display
Actions