From 83c046a243ace4f073afccde018b56622f29a4c7 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Sat, 5 May 2012 05:42:48 +0200 Subject: [PATCH] Correct capitalisation of two Luxi calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two Luxi calls have inconsistent an name/value mapping (in the Python code): - REQ_AUTOARCHIVE_JOBS versus AutoArchiveJobs (versus AutoarchiveJobs) - REQ_QUEUE_SET_DRAIN_FLAG versus SetDrainFlag (no Queue) While these are only a consistency issue, let's fix them so that the Haskell code (which uses the auto-generated camel-case form) doesn't need to handle them case specially, and looks more like the Python code (hah, joke!). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/luxi.py | 14 +++++++------- lib/server/masterd.py | 6 +++--- test/ganeti.rapi.testutils_unittest.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/luxi.py b/lib/luxi.py index 3592815ed..5799d40e5 100644 --- a/lib/luxi.py +++ b/lib/luxi.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2011 Google Inc. +# Copyright (C) 2006, 2007, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ REQ_SUBMIT_MANY_JOBS = "SubmitManyJobs" REQ_WAIT_FOR_JOB_CHANGE = "WaitForJobChange" REQ_CANCEL_JOB = "CancelJob" REQ_ARCHIVE_JOB = "ArchiveJob" -REQ_AUTOARCHIVE_JOBS = "AutoArchiveJobs" +REQ_AUTO_ARCHIVE_JOBS = "AutoArchiveJobs" REQ_QUERY = "Query" REQ_QUERY_FIELDS = "QueryFields" REQ_QUERY_JOBS = "QueryJobs" @@ -64,13 +64,13 @@ REQ_QUERY_EXPORTS = "QueryExports" REQ_QUERY_CONFIG_VALUES = "QueryConfigValues" REQ_QUERY_CLUSTER_INFO = "QueryClusterInfo" REQ_QUERY_TAGS = "QueryTags" -REQ_QUEUE_SET_DRAIN_FLAG = "SetDrainFlag" +REQ_SET_DRAIN_FLAG = "SetDrainFlag" REQ_SET_WATCHER_PAUSE = "SetWatcherPause" #: List of all LUXI requests REQ_ALL = frozenset([ REQ_ARCHIVE_JOB, - REQ_AUTOARCHIVE_JOBS, + REQ_AUTO_ARCHIVE_JOBS, REQ_CANCEL_JOB, REQ_QUERY, REQ_QUERY_CLUSTER_INFO, @@ -82,7 +82,7 @@ REQ_ALL = frozenset([ REQ_QUERY_JOBS, REQ_QUERY_NODES, REQ_QUERY_TAGS, - REQ_QUEUE_SET_DRAIN_FLAG, + REQ_SET_DRAIN_FLAG, REQ_SET_WATCHER_PAUSE, REQ_SUBMIT_JOB, REQ_SUBMIT_MANY_JOBS, @@ -466,7 +466,7 @@ class Client(object): version=constants.LUXI_VERSION) def SetQueueDrainFlag(self, drain_flag): - return self.CallMethod(REQ_QUEUE_SET_DRAIN_FLAG, (drain_flag, )) + return self.CallMethod(REQ_SET_DRAIN_FLAG, (drain_flag, )) def SetWatcherPause(self, until): return self.CallMethod(REQ_SET_WATCHER_PAUSE, (until, )) @@ -489,7 +489,7 @@ class Client(object): def AutoArchiveJobs(self, age): timeout = (DEF_RWTO - 1) / 2 - return self.CallMethod(REQ_AUTOARCHIVE_JOBS, (age, timeout)) + return self.CallMethod(REQ_AUTO_ARCHIVE_JOBS, (age, timeout)) def WaitForJobChangeOnce(self, job_id, fields, prev_job_info, prev_log_serial, diff --git a/lib/server/masterd.py b/lib/server/masterd.py index ee3a12eab..94c60f40f 100644 --- a/lib/server/masterd.py +++ b/lib/server/masterd.py @@ -1,7 +1,7 @@ # # -# Copyright (C) 2006, 2007, 2010, 2011 Google Inc. +# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -288,7 +288,7 @@ class ClientOps: logging.info("Received job archive request for %s", job_id) return queue.ArchiveJob(job_id) - elif method == luxi.REQ_AUTOARCHIVE_JOBS: + elif method == luxi.REQ_AUTO_ARCHIVE_JOBS: (age, timeout) = args logging.info("Received job autoarchive request for age %s, timeout %s", age, timeout) @@ -396,7 +396,7 @@ class ClientOps: op = opcodes.OpTagsGet(kind=kind, name=name, use_locking=False) return self._Query(op) - elif method == luxi.REQ_QUEUE_SET_DRAIN_FLAG: + elif method == luxi.REQ_SET_DRAIN_FLAG: (drain_flag, ) = args logging.info("Received queue drain flag change request to %s", drain_flag) diff --git a/test/ganeti.rapi.testutils_unittest.py b/test/ganeti.rapi.testutils_unittest.py index 8d68b031c..53dcaa74f 100755 --- a/test/ganeti.rapi.testutils_unittest.py +++ b/test/ganeti.rapi.testutils_unittest.py @@ -40,11 +40,11 @@ import testutils KNOWN_UNUSED_LUXI = frozenset([ luxi.REQ_SUBMIT_MANY_JOBS, luxi.REQ_ARCHIVE_JOB, - luxi.REQ_AUTOARCHIVE_JOBS, + luxi.REQ_AUTO_ARCHIVE_JOBS, luxi.REQ_QUERY_EXPORTS, luxi.REQ_QUERY_CONFIG_VALUES, luxi.REQ_QUERY_TAGS, - luxi.REQ_QUEUE_SET_DRAIN_FLAG, + luxi.REQ_SET_DRAIN_FLAG, luxi.REQ_SET_WATCHER_PAUSE, ]) -- GitLab