Revision 92ff96e8
b/lib/cmdlib.py | ||
---|---|---|
1196 | 1196 |
raise errors.OpPrereqError(msg, errors.ECODE_INVAL) |
1197 | 1197 |
|
1198 | 1198 |
|
1199 |
def _ComputeNewInstanceViolations(old_ipolicy, new_ipolicy, instances): |
|
1200 |
"""Computes a set of any instances that would violate the new ipolicy. |
|
1201 |
|
|
1202 |
@param old_ipolicy: The current (still in-place) ipolicy |
|
1203 |
@param new_ipolicy: The new (to become) ipolicy |
|
1204 |
@param instances: List of instances to verify |
|
1205 |
@return: A list of instances which violates the new ipolicy but did not before |
|
1206 |
|
|
1207 |
""" |
|
1208 |
return (_ComputeViolatingInstances(old_ipolicy, instances) - |
|
1209 |
_ComputeViolatingInstances(new_ipolicy, instances)) |
|
1210 |
|
|
1211 |
|
|
1199 | 1212 |
def _ExpandItemName(fn, name, kind): |
1200 | 1213 |
"""Expand an item name. |
1201 | 1214 |
|
... | ... | |
1416 | 1429 |
return cluster.SimpleFillIPolicy(group.ipolicy) |
1417 | 1430 |
|
1418 | 1431 |
|
1432 |
def _ComputeViolatingInstances(ipolicy, instances): |
|
1433 |
"""Computes a set of instances who violates given ipolicy. |
|
1434 |
|
|
1435 |
@param ipolicy: The ipolicy to verify |
|
1436 |
@type instances: object.Instance |
|
1437 |
@param instances: List of instances to verify |
|
1438 |
@return: A frozenset of instance names violating the ipolicy |
|
1439 |
|
|
1440 |
""" |
|
1441 |
return frozenset([inst.name for inst in instances |
|
1442 |
if _ComputeIPolicyInstanceViolation(ipolicy, inst)]) |
|
1443 |
|
|
1444 |
|
|
1419 | 1445 |
def _CheckNicsBridgesExist(lu, target_nics, target_node): |
1420 | 1446 |
"""Check that the brigdes needed by a list of nics exist. |
1421 | 1447 |
|
Also available in: Unified diff