Revision 87ed6b79 lib/cmdlib/instance_utils.py
b/lib/cmdlib/instance_utils.py | ||
---|---|---|
378 | 378 |
@param keep: Names of locks to retain |
379 | 379 |
|
380 | 380 |
""" |
381 |
logging.debug("Lu %s ReleaseLocks %s names=%s, keep=%s", |
|
382 |
lu.wconfdcontext, level, names, keep) |
|
381 | 383 |
assert not (keep is not None and names is not None), \ |
382 | 384 |
"Only one of the 'names' and the 'keep' parameters can be given" |
383 | 385 |
|
... | ... | |
388 | 390 |
else: |
389 | 391 |
should_release = None |
390 | 392 |
|
393 |
levelname = locking.LEVEL_NAMES[level] |
|
394 |
|
|
391 | 395 |
owned = lu.owned_locks(level) |
392 | 396 |
if not owned: |
393 | 397 |
# Not owning any lock at this level, do nothing |
... | ... | |
407 | 411 |
assert len(lu.owned_locks(level)) == (len(retain) + len(release)) |
408 | 412 |
|
409 | 413 |
# Release just some locks |
410 |
lu.glm.release(level, names=release)
|
|
411 |
|
|
414 |
lu.WConfdClient().TryUpdateLocks(
|
|
415 |
lu.release_request(level, release)) |
|
412 | 416 |
assert frozenset(lu.owned_locks(level)) == frozenset(retain) |
413 | 417 |
else: |
414 |
# Release everything |
|
415 |
lu.glm.release(level) |
|
416 |
|
|
417 |
assert not lu.glm.is_owned(level), "No locks should be owned" |
|
418 |
lu.WConfdClient().FreeLocksLevel(levelname) |
|
418 | 419 |
|
419 | 420 |
|
420 | 421 |
def _ComputeIPolicyNodeViolation(ipolicy, instance, current_group, |
Also available in: Unified diff