Skip to content
Snippets Groups Projects
Commit ff20190d authored by Guido Trotter's avatar Guido Trotter
Browse files

ReleaseUid: accept an integer as uid


We can't guarantee to keep the LockedObject around, when ReleaseUid is
called (because that might happen, for example, after a ganeti
shutdown/restart). So we'll support releasing on just an integer uid.

Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 14850c5e
No related branches found
No related tags found
No related merge requests found
......@@ -323,9 +323,13 @@ def RequestUnusedUid(all_uids):
def ReleaseUid(uid):
"""This should be called when the given user-id is no longer in use.
@type uid: LockedUid or integer
@param uid: the uid to release back to the pool
"""
# Make sure we release the exclusive lock, if there is any
uid.Unlock()
if isinstance(uid, LockedUid):
# Make sure we release the exclusive lock, if there is any
uid.Unlock()
try:
uid_path = utils.PathJoin(constants.UIDPOOL_LOCKDIR, str(uid))
os.remove(uid_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment