From f4e86448dae3fc1349520254ddd835060167cbbb Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Tue, 9 Aug 2011 13:26:11 +0200 Subject: [PATCH] rlib: Expose node group tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 1ffd26739d3 added support for tagging node groups. Also add a check for exposed fields. Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: RenΓ© Nussbaumer <rn@google.com> --- lib/rapi/rlib2.py | 11 ++++++----- test/ganeti.rapi.rlib2_unittest.py | 10 ++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index 3278875a3..f6d8fd6ee 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -74,11 +74,12 @@ N_FIELDS = ["name", "offline", "master_candidate", "drained", "group.uuid", ] + _COMMON_FIELDS -G_FIELDS = ["name", "uuid", - "alloc_policy", - "node_cnt", "node_list", - "ctime", "mtime", "serial_no", - ] # "tags" is missing to be able to use _COMMON_FIELDS here. +G_FIELDS = [ + "alloc_policy", + "name", + "node_cnt", + "node_list", + ] + _COMMON_FIELDS J_FIELDS = [ "id", "ops", "status", "summary", diff --git a/test/ganeti.rapi.rlib2_unittest.py b/test/ganeti.rapi.rlib2_unittest.py index 57836e1c6..6584c38e8 100755 --- a/test/ganeti.rapi.rlib2_unittest.py +++ b/test/ganeti.rapi.rlib2_unittest.py @@ -45,6 +45,16 @@ class TestConstants(unittest.TestCase): assert "console" in query.INSTANCE_FIELDS self.assertTrue("console" not in rlib2.I_FIELDS) + def testFields(self): + checks = { + constants.QR_INSTANCE: rlib2.I_FIELDS, + constants.QR_NODE: rlib2.N_FIELDS, + constants.QR_GROUP: rlib2.G_FIELDS, + } + + for (qr, fields) in checks.items(): + self.assertFalse(set(fields) - set(query.ALL_FIELDS[qr].keys())) + class TestParseInstanceCreateRequestVersion1(testutils.GanetiTestCase): def setUp(self): -- GitLab