From 7d26425f39f185089e145df1f2e7b805359a7298 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 10 Feb 2009 14:46:06 +0000
Subject: [PATCH] dumb allocator: do not use drained nodes

This patch changes the dumb allocator not to use drained nodes (similar
to offline nodes).

Reviewed-by: imsnah
---
 doc/examples/dumb-allocator | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/doc/examples/dumb-allocator b/doc/examples/dumb-allocator
index d181b69b5..d44ff2b1f 100755
--- a/doc/examples/dumb-allocator
+++ b/doc/examples/dumb-allocator
@@ -75,12 +75,13 @@ def main():
   request = data["request"]
   req_type = request["type"]
   offline_nodes = [name for name in nodes if nodes[name]["offline"]]
+  drained_nodes = [name for name in nodes if nodes[name]["offline"]]
   if req_type == "allocate":
     forbidden_nodes = offline_nodes
     inst_data = request
   elif req_type == "relocate":
     idict = data["instances"][request["name"]]
-    forbidden_nodes = idict["nodes"] + offline_nodes
+    forbidden_nodes = idict["nodes"] + offline_nodes + drained_nodes
     inst_data = idict
     inst_data["disk_space_total"] = request["disk_space_total"]
   else:
-- 
GitLab