Commit ed97d401 authored by Petr Pudlak's avatar Petr Pudlak

Add a passive class for representing inherited live-locks

Since job processes inherit their live-lock files from the master
process, they don't directly work with the file, they just need to use
the name.

This class exposes the same interface as LiveLock for such pre-created
livelocks.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 14d4d2f9
...@@ -34,6 +34,20 @@ from ganeti.utils.algo import NiceSort ...@@ -34,6 +34,20 @@ from ganeti.utils.algo import NiceSort
from ganeti import pathutils from ganeti import pathutils
class LiveLockName(object):
def __init__(self, name):
self._name = name
def GetPath(self):
return self._name
def close(self):
"""Clean up the lockfile.
"""
os.remove(self._name)
class LiveLock(object): class LiveLock(object):
"""Utility for a lockfile needed to request resources from WconfD. """Utility for a lockfile needed to request resources from WconfD.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment