From 8d45912995082eae90ae6c4feac7e3a5a86bfccb Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Mon, 7 Jan 2013 16:03:05 +0100 Subject: [PATCH] Add "use_locking" parameter to network query opcode MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This was extracted from a patch by Dimitris Aragiorgis with the subject “Add locking to _NetworkQuery”. The rest of the patch did no longer apply and will require more work. Signed-off-by: Michael Hanselmann Reviewed-by: Guido Trotter --- lib/cmdlib.py | 2 +- lib/opcodes.py | 1 + src/Ganeti/OpCodes.hs | 2 +- test/hs/Test/Ganeti/OpCodes.hs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 98d0a72..753120c 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -16530,7 +16530,7 @@ class LUNetworkQuery(NoHooksLU): def CheckArguments(self): self.nq = _NetworkQuery(qlang.MakeSimpleFilter("name", self.op.names), - self.op.output_fields, False) + self.op.output_fields, self.op.use_locking) def ExpandNames(self): self.nq.ExpandNames(self) diff --git a/lib/opcodes.py b/lib/opcodes.py index 887b7bb..2c88363 100644 --- a/lib/opcodes.py +++ b/lib/opcodes.py @@ -2152,6 +2152,7 @@ class OpNetworkQuery(OpCode): """Compute the list of networks.""" OP_PARAMS = [ _POutputFields, + _PUseLocking, ("names", ht.EmptyList, ht.TListOf(ht.TNonEmptyString), "Empty list to query all groups, group names otherwise"), ] diff --git a/src/Ganeti/OpCodes.hs b/src/Ganeti/OpCodes.hs index 8285e93..ec9a34f 100644 --- a/src/Ganeti/OpCodes.hs +++ b/src/Ganeti/OpCodes.hs @@ -537,7 +537,7 @@ $(genOpCode "OpCode" , pNetworkName , pIpConflictsCheck ]) - , ("OpNetworkQuery", dOldQueryNoLocking) + , ("OpNetworkQuery", dOldQuery) , ("OpRestrictedCommand", [ pUseLocking , pRequiredNodes diff --git a/test/hs/Test/Ganeti/OpCodes.hs b/test/hs/Test/Ganeti/OpCodes.hs index aa07568..cf345d1 100644 --- a/test/hs/Test/Ganeti/OpCodes.hs +++ b/test/hs/Test/Ganeti/OpCodes.hs @@ -335,7 +335,7 @@ instance Arbitrary OpCodes.OpCode where "OP_NETWORK_DISCONNECT" -> OpCodes.OpNetworkDisconnect <$> genNameNE <*> genNameNE <*> arbitrary "OP_NETWORK_QUERY" -> - OpCodes.OpNetworkQuery <$> genFieldsNE <*> genNamesNE + OpCodes.OpNetworkQuery <$> genFieldsNE <*> genNamesNE <*> arbitrary "OP_RESTRICTED_COMMAND" -> OpCodes.OpRestrictedCommand <$> arbitrary <*> genNodeNamesNE <*> genNameNE -- 1.7.10.4