- redefine HPATH and HTYPE
- optionally redefine their run requirements:
REQ_MASTER: the LU needs to run on the master node
- REQ_WSSTORE: the LU needs a writable SimpleStore
REQ_BGL: the LU needs to hold the Big Ganeti Lock exclusively
Note that all commands require root permissions.
HTYPE = None
_OP_REQP = []
REQ_MASTER = True
- REQ_WSSTORE = False
REQ_BGL = True
- def __init__(self, processor, op, context, sstore):
+ def __init__(self, processor, op, context):
"""Constructor for LogicalUnit.
This needs to be overriden in derived classes in order to check op
self.proc = processor
self.op = op
self.cfg = context.cfg
- self.sstore = sstore
self.context = context
# Dicts used to declare locking needs to mcpu
self.needed_locks = None
from ganeti import errors
from ganeti import rpc
from ganeti import cmdlib
-from ganeti import ssconf
from ganeti import logger
from ganeti import locking
if lu_class is None:
raise errors.OpCodeUnknown("Unknown opcode")
- if lu_class.REQ_WSSTORE:
- sstore = ssconf.WritableSimpleStore()
- else:
- sstore = ssconf.SimpleStore()
-
# Acquire the Big Ganeti Lock exclusively if this LU requires it, and in a
# shared fashion otherwise (to prevent concurrent run with an exclusive LU.
self.context.glm.acquire(locking.LEVEL_CLUSTER, [locking.BGL],
shared=not lu_class.REQ_BGL)
try:
self.exclusive_BGL = lu_class.REQ_BGL
- lu = lu_class(self, op, self.context, sstore)
+ lu = lu_class(self, op, self.context)
lu.ExpandNames()
assert lu.needed_locks is not None, "needed_locks not set by LU"
result = self._LockAndExecLU(lu, locking.LEVEL_INSTANCE)