• Michael Hanselmann's avatar
    Use node group locking for replacing disks · 8b0273a5
    Michael Hanselmann authored
    This is one of the first opcodes to make use of node group locking. To
    get an instance's node groups, the instance's nodes need to be looked
    at. Due to a previous design decision nodes are locked after the group,
    hence there's no clean locking order. This patch works around that by
    first getting the instance's groups without locks, and then verifying
    them after actually getting all locks. Rough overview:
    - Lock instance
    - Get groups of instance's nodes
    - Lock groups
    - Lock all nodes in groups
    - Verify node groups
    - Run iallocator
    - Release group and unused nodes
    - Replace disks, etc.
    There are probably too many assertions in the code, but it's locking and
    we've been bitten in the past.
    Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
    Reviewed-by: default avatarIustin Pop <iustin@google.com>
cmdlib.py 426 KB