Revision cc19798f lib/config.py
b/lib/config.py | ||
---|---|---|
1334 | 1334 |
for instance in self._UnlockedGetInstanceList()]) |
1335 | 1335 |
return my_dict |
1336 | 1336 |
|
1337 |
@locking.ssynchronized(_config_lock, shared=1) |
|
1338 |
def GetInstancesInfoByFilter(self, filter_fn): |
|
1339 |
"""Get instance configuration with a filter. |
|
1340 |
|
|
1341 |
@type filter_fn: callable |
|
1342 |
@param filter_fn: Filter function receiving instance object as parameter, |
|
1343 |
returning boolean. Important: this function is called while the |
|
1344 |
configuration locks is held. It must not do any complex work or call |
|
1345 |
functions potentially leading to a deadlock. Ideally it doesn't call any |
|
1346 |
other functions and just compares instance attributes. |
|
1347 |
|
|
1348 |
""" |
|
1349 |
return dict((name, inst) |
|
1350 |
for (name, inst) in self._config_data.instances.items() |
|
1351 |
if filter_fn(inst)) |
|
1352 |
|
|
1337 | 1353 |
@locking.ssynchronized(_config_lock) |
1338 | 1354 |
def AddNode(self, node, ec_id): |
1339 | 1355 |
"""Add a node to the configuration. |
Also available in: Unified diff