Commit cfdf561d authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Stop using locks in LUXI "QueryTags"



Also mark it as deprecated in NEWS as normal queries can be used
instead.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent dff5f600
......@@ -16,9 +16,9 @@ Version 2.6.0 beta1
``Query(what=QR_LOCK, ...)`` instead.
- The LUXI requests :pyeval:`luxi.REQ_QUERY_JOBS`,
:pyeval:`luxi.REQ_QUERY_INSTANCES`, :pyeval:`luxi.REQ_QUERY_NODES`,
:pyeval:`luxi.REQ_QUERY_GROUPS` and :pyeval:`luxi.REQ_QUERY_EXPORTS`
are deprecated and will be removed in a future version.
:pyeval:`luxi.REQ_QUERY` should be used instead.
:pyeval:`luxi.REQ_QUERY_GROUPS`, :pyeval:`luxi.REQ_QUERY_EXPORTS` and
:pyeval:`luxi.REQ_QUERY_TAGS` are deprecated and will be removed in a
future version. :pyeval:`luxi.REQ_QUERY` should be used instead.
Version 2.5.0
......
......@@ -14292,14 +14292,25 @@ class TagsLU(NoHooksLU): # pylint: disable=W0223
def ExpandNames(self):
self.group_uuid = None
self.needed_locks = {}
if self.op.kind == constants.TAG_NODE:
self.op.name = _ExpandNodeName(self.cfg, self.op.name)
self.needed_locks[locking.LEVEL_NODE] = self.op.name
lock_level = locking.LEVEL_NODE
lock_name = self.op.name
elif self.op.kind == constants.TAG_INSTANCE:
self.op.name = _ExpandInstanceName(self.cfg, self.op.name)
self.needed_locks[locking.LEVEL_INSTANCE] = self.op.name
lock_level = locking.LEVEL_INSTANCE
lock_name = self.op.name
elif self.op.kind == constants.TAG_NODEGROUP:
self.group_uuid = self.cfg.LookupNodeGroup(self.op.name)
lock_level = locking.LEVEL_NODEGROUP
lock_name = self.group_uuid
else:
lock_level = None
lock_name = None
if lock_level and getattr(self.op, "use_locking", True):
self.needed_locks[lock_level] = lock_name
 
# FIXME: Acquire BGL for cluster tag operations (as of this writing it's
# not possible to acquire the BGL based on opcode parameters)
......
......@@ -1737,6 +1737,8 @@ class OpTagsGet(OpCode):
OP_DSC_FIELD = "name"
OP_PARAMS = [
_PTagKind,
# Not using _PUseLocking as the default is different for historical reasons
("use_locking", True, ht.TBool, "Whether to use synchronization"),
# Name is only meaningful for nodes and instances
("name", ht.NoDefault, ht.TMaybeString, None),
]
......
......@@ -393,7 +393,7 @@ class ClientOps:
elif method == luxi.REQ_QUERY_TAGS:
(kind, name) = args
logging.info("Received tags query request")
op = opcodes.OpTagsGet(kind=kind, name=name)
op = opcodes.OpTagsGet(kind=kind, name=name, use_locking=False)
return self._Query(op)
elif method == luxi.REQ_QUEUE_SET_DRAIN_FLAG:
......
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