From 74f37195803456f2e4f008c9068e47d44bbb30bf Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Thu, 6 Aug 2009 13:28:16 +0200
Subject: [PATCH] Add constants for local disk status

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/constants.py                  | 6 ++++++
 test/ganeti.constants_unittest.py | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/lib/constants.py b/lib/constants.py
index f9431bd10..38a329119 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -205,6 +205,12 @@ MODIFIABLE_STORAGE_FIELDS = {
   ST_LVM_PV: frozenset([SF_ALLOCATABLE]),
   }
 
+# Local disk status
+# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
+(LDS_OKAY,
+ LDS_UNKNOWN,
+ LDS_FAULTY) = range(1, 4)
+
 # disk template types
 DT_DISKLESS = "diskless"
 DT_PLAIN = "plain"
diff --git a/test/ganeti.constants_unittest.py b/test/ganeti.constants_unittest.py
index af39955e8..2da1ff7f8 100755
--- a/test/ganeti.constants_unittest.py
+++ b/test/ganeti.constants_unittest.py
@@ -54,6 +54,10 @@ class TestConstants(unittest.TestCase):
                     (constants.CONFIG_MAJOR, constants.CONFIG_MINOR,
                      constants.CONFIG_REVISION))
 
+  def testDiskStatus(self):
+    self.failUnless(constants.LDS_OKAY < constants.LDS_UNKNOWN)
+    self.failUnless(constants.LDS_UNKNOWN < constants.LDS_FAULTY)
+
 
 class TestParameterNames(unittest.TestCase):
   """HV/BE parameter tests"""
@@ -69,5 +73,6 @@ class TestParameterNames(unittest.TestCase):
                         "The %s parameter '%s' contains invalid characters" %
                         (kind, key))
 
+
 if __name__ == '__main__':
   unittest.main()
-- 
GitLab