Add checks for tcp/udp port collisions
authorIustin Pop <iustin@google.com>
Sat, 27 Sep 2008 18:47:46 +0000 (18:47 +0000)
committerIustin Pop <iustin@google.com>
Sat, 27 Sep 2008 18:47:46 +0000 (18:47 +0000)
commite105e0185dadcf3e37453bb5a4c528c6557face0
tree478f76ab73690ace78bb3d7e5f4fe54a7e84b61f
parent2a5ad3b007a7b7ecd33b1e7c4c81cdfae52a01bd
Add checks for tcp/udp port collisions

In case the config file is manually modified, or in case of bugs, the
tcp/udp ports could be reused, which will create various problems
(instances not able to start, or drbd disks not able to communicate).

This patch extends the ConfigWriter.VerifyConfig() method (which is used
in cluster verify) to check for duplicates between:
  - the ports used for DRBD disks
  - the ports used for network console
  - the ports marked as free in the config file

Also, if the cluster parameter â€˜highest_used_port’ is actually lower
than the computed highest used port, this is also flagged as an error.

The output from gnt-cluster verify will show (output manually wrapped):

node1 # gnt-cluster verify
* Verifying global settings
  - ERROR: tcp/udp port 11006 has duplicates: instance3.example.com/network port,
instance2.example.com/drbd disk sda
  - ERROR: tcp/udp port 11017 has duplicates: instance3.example.com/drbd disk sda,
instance3.example.com/drbd disk sdb, cluster/port marked as free
  - ERROR: Highest used port mismatch, saved 11010, computed 11017
* Gathering data (2 nodes)
...

Reviewed-by: ultrotter
lib/config.py