Revision 4b98ac29
b/lib/config.py | ||
---|---|---|
227 | 227 |
|
228 | 228 |
return result |
229 | 229 |
|
230 |
def _CheckDiskIDs(self, disk, l_ids, p_ids): |
|
231 |
"""Compute duplicate disk IDs |
|
232 |
|
|
233 |
@type disk: L{objects.Disk} |
|
234 |
@param disk: the disk at which to start searching |
|
235 |
@type l_ids: list |
|
236 |
@param l_ids: list of current logical ids |
|
237 |
@type p_ids: list |
|
238 |
@param p_ids: list of current physical ids |
|
239 |
@rtype: list |
|
240 |
@return: a list of error messages |
|
241 |
|
|
242 |
""" |
|
243 |
result = [] |
|
244 |
if disk.logical_id in l_ids: |
|
245 |
result.append("duplicate logical id %s" % str(disk.logical_id)) |
|
246 |
else: |
|
247 |
l_ids.append(disk.logical_id) |
|
248 |
if disk.physical_id in p_ids: |
|
249 |
result.append("duplicate physical id %s" % str(disk.physical_id)) |
|
250 |
else: |
|
251 |
p_ids.append(disk.physical_id) |
|
252 |
|
|
253 |
if disk.children: |
|
254 |
for child in disk.children: |
|
255 |
result.extend(self._CheckDiskIDs(child, l_ids, p_ids)) |
|
256 |
return result |
|
257 |
|
|
230 | 258 |
def _UnlockedVerifyConfig(self): |
231 | 259 |
"""Verify function. |
232 | 260 |
|
... | ... | |
239 | 267 |
seen_macs = [] |
240 | 268 |
ports = {} |
241 | 269 |
data = self._config_data |
270 |
seen_lids = [] |
|
271 |
seen_pids = [] |
|
242 | 272 |
for instance_name in data.instances: |
243 | 273 |
instance = data.instances[instance_name] |
244 | 274 |
if instance.primary_node not in data.nodes: |
... | ... | |
273 | 303 |
for idx, disk in enumerate(instance.disks): |
274 | 304 |
result.extend(["instance '%s' disk %d error: %s" % |
275 | 305 |
(instance.name, idx, msg) for msg in disk.Verify()]) |
306 |
result.extend(self._CheckDiskIDs(disk, seen_lids, seen_pids)) |
|
276 | 307 |
|
277 | 308 |
# cluster-wide pool of free ports |
278 | 309 |
for free_port in data.cluster.tcpudp_port_pool: |
Also available in: Unified diff