From 4a917de690f96501f8c9a8175b9fbf87bdc78df5 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 12 Nov 2010 18:28:01 +0100
Subject: [PATCH] Add query constants

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/constants.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/lib/constants.py b/lib/constants.py
index cf0499630..cd6d4fe4b 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -915,6 +915,43 @@ JQT_ALL = frozenset([
   JQT_STARTMSG,
   ])
 
+# Query resources
+QR_INSTANCE = "instance"
+QR_NODE = "node"
+
+#: List of resources which can be queried using L{opcodes.OpQuery}
+QR_OP_QUERY = frozenset([QR_INSTANCE, QR_NODE])
+
+# Query field types
+QFT_UNKNOWN = "unknown"
+QFT_TEXT = "text"
+QFT_BOOL = "bool"
+QFT_NUMBER = "number"
+QFT_UNIT = "unit"
+QFT_TIMESTAMP = "timestamp"
+QFT_OTHER = "other"
+
+#: All query field types
+QFT_ALL = frozenset([
+  QFT_UNKNOWN,
+  QFT_TEXT,
+  QFT_BOOL,
+  QFT_NUMBER,
+  QFT_UNIT,
+  QFT_TIMESTAMP,
+  QFT_OTHER,
+  ])
+
+# Query result field status (don't change values as they're used by clients)
+#: Normal field status
+QRFS_NORMAL = 0
+#: Unknown field
+QRFS_UNKNOWN = 1
+#: No data
+QRFS_NODATA = 2
+#: Value unavailable for item
+QRFS_UNAVAIL = 3
+
 # max dynamic devices
 MAX_NICS = 8
 MAX_DISKS = 16
-- 
GitLab