From af64c0eac10e030337b3316b75bea80f57d31be8 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 10 Feb 2009 14:45:39 +0000
Subject: [PATCH] =?UTF-8?q?Add=20a=20=E2=80=98drained=E2=80=99=20attribute?=
 =?UTF-8?q?=20to=20node=20objects?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This attribute will be used to prevent any allocation on the node (any
of replace-disks with new secondary this node, failover to the node,
migration to the node).

The patch adds the attribute and initializes it correctly in cluster
init and for new nodes.

Reviewed-by: imsnah
---
 lib/bootstrap.py | 2 +-
 lib/cmdlib.py    | 2 +-
 lib/objects.py   | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/bootstrap.py b/lib/bootstrap.py
index 048b66e07..5632d39f4 100644
--- a/lib/bootstrap.py
+++ b/lib/bootstrap.py
@@ -245,7 +245,7 @@ def InitCluster(cluster_name, mac_prefix, def_bridge,
                                     secondary_ip=secondary_ip,
                                     serial_no=1,
                                     master_candidate=True,
-                                    offline=False,
+                                    offline=False, drained=False,
                                     )
 
   sscfg = InitConfig(constants.CONFIG_VERSION,
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 023b7067b..e75ba33aa 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -2094,7 +2094,7 @@ class LUAddNode(LogicalUnit):
                                  primary_ip=primary_ip,
                                  secondary_ip=secondary_ip,
                                  master_candidate=master_candidate,
-                                 offline=False)
+                                 offline=False, drained=False)
 
   def Exec(self, feedback_fn):
     """Adds the new node to the cluster.
diff --git a/lib/objects.py b/lib/objects.py
index 0feefbedf..596aab64d 100644
--- a/lib/objects.py
+++ b/lib/objects.py
@@ -698,6 +698,7 @@ class Node(TaggableObject):
     "serial_no",
     "master_candidate",
     "offline",
+    "drained",
     ]
 
 
-- 
GitLab