Revision 48ce9fd9 lib/config.py
b/lib/config.py | ||
---|---|---|
193 | 193 |
|
194 | 194 |
result = [] |
195 | 195 |
seen_macs = [] |
196 |
ports = {} |
|
196 | 197 |
data = self._config_data |
197 | 198 |
for instance_name in data.instances: |
198 | 199 |
instance = data.instances[instance_name] |
... | ... | |
209 | 210 |
(instance_name, idx, nic.mac)) |
210 | 211 |
else: |
211 | 212 |
seen_macs.append(nic.mac) |
213 |
|
|
214 |
# gather the drbd ports for duplicate checks |
|
215 |
for dsk in instance.disks: |
|
216 |
if dsk.dev_type in constants.LDS_DRBD: |
|
217 |
tcp_port = dsk.logical_id[2] |
|
218 |
if tcp_port not in ports: |
|
219 |
ports[tcp_port] = [] |
|
220 |
ports[tcp_port].append((instance.name, "drbd disk %s" % dsk.iv_name)) |
|
221 |
# gather network port reservation |
|
222 |
net_port = getattr(instance, "network_port", None) |
|
223 |
if net_port is not None: |
|
224 |
if net_port not in ports: |
|
225 |
ports[net_port] = [] |
|
226 |
ports[net_port].append((instance.name, "network port")) |
|
227 |
|
|
228 |
# cluster-wide pool of free ports |
|
229 |
for free_port in self._config_data.cluster.tcpudp_port_pool: |
|
230 |
if free_port not in ports: |
|
231 |
ports[free_port] = [] |
|
232 |
ports[free_port].append(("cluster", "port marked as free")) |
|
233 |
|
|
234 |
# compute tcp/udp duplicate ports |
|
235 |
keys = ports.keys() |
|
236 |
keys.sort() |
|
237 |
for pnum in keys: |
|
238 |
pdata = ports[pnum] |
|
239 |
if len(pdata) > 1: |
|
240 |
txt = ", ".join(["%s/%s" % val for val in pdata]) |
|
241 |
result.append("tcp/udp port %s has duplicates: %s" % (pnum, txt)) |
|
242 |
|
|
243 |
# highest used tcp port check |
|
244 |
if keys: |
|
245 |
if keys[-1] > self._config_data.cluster.highest_used_port: |
|
246 |
result.append("Highest used port mismatch, saved %s, computed %s" % |
|
247 |
(self._config_data.cluster.highest_used_port, |
|
248 |
keys[-1])) |
|
249 |
|
|
212 | 250 |
return result |
213 | 251 |
|
214 | 252 |
def _UnlockedSetDiskID(self, disk, node_name): |
Also available in: Unified diff