Revision 3f404fc5 lib/locking.py

b/lib/locking.py
512 512
                you are already holding exclusively the locks.
513 513

  
514 514
    Returns:
515
      A list of lock which we failed to delete. The list is always empty if we
516
      were holding all the locks exclusively.
515
      A list of lock which we removed. The list is always equal to the names
516
      list if we were holding all the locks exclusively.
517 517

  
518 518
    """
519 519
    if not blocking and not self._is_owned():
......
530 530
    assert not self._is_owned() or self._list_owned().issuperset(names), (
531 531
      "remove() on acquired lockset while not owning all elements")
532 532

  
533
    delete_failed=[]
533
    removed = []
534 534

  
535 535
    for lname in names:
536 536
      # Calling delete() acquires the lock exclusively if we don't already own
......
540 540
      # everything we want to delete, or we hold none.
541 541
      try:
542 542
        self.__lockdict[lname].delete()
543
        removed.append(lname)
543 544
      except (KeyError, errors.LockError):
544
        delete_failed.append(lname)
545 545
        # This cannot happen if we were already holding it, verify:
546 546
        assert not self._is_owned(), "remove failed while holding lockset"
547 547
      else:
......
557 557
        if self._is_owned():
558 558
          self._del_owned(lname)
559 559

  
560
    return delete_failed
560
    return removed
561 561

  
562 562

  
563 563
# Locking levels, must be acquired in increasing order.

Also available in: Unified diff