From 77031881461755393de6d43dbee0e6a6ad72e5c5 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 2 Mar 2009 12:18:42 +0000
Subject: [PATCH] Update the iallocator documentation

This updates the iallocator documentation to 2.0, bumps up the
iallocator version (and moves a constants to lib/constants.py), and
fixes a style on install.rst.

Reviewed-by: ultrotter
---
 doc/iallocator.rst | 30 ++++++++++++++++++++++++++++--
 doc/install.rst    |  2 +-
 lib/cmdlib.py      |  2 +-
 lib/constants.py   |  1 +
 4 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/doc/iallocator.rst b/doc/iallocator.rst
index ac9831ee8..f4b8bfcf8 100644
--- a/doc/iallocator.rst
+++ b/doc/iallocator.rst
@@ -72,7 +72,7 @@ the following:
 
 version
   the version of the protocol; this document
-  specifies version 1
+  specifies version 2
 
 cluster_name
   the cluster name
@@ -80,6 +80,9 @@ cluster_name
 cluster_tags
   the list of cluster tags
 
+enabled_hypervisors
+  the list of enabled hypervisors
+
 request
   a dictionary containing the request data:
 
@@ -148,6 +151,9 @@ request
   tags
     the list of the instance's tags
 
+  hypervisor
+    the hypervisor of this instance
+
 
   If the request is of type relocate, then there is one more entry in
   the request dictionary, named ``relocate_from``, and it contains a
@@ -160,7 +166,7 @@ instances
   cluster, indexed by instance name; the contents are similar to the
   instance definitions for the allocate mode, with the addition of:
 
-  should_run
+  admin_up
     if this instance is set to run (but not the actual status of the
     instance)
 
@@ -200,6 +206,26 @@ nodes
   tags
     list with the tags of the node
 
+  master_candidate:
+    a boolean flag denoting whether this node is a master candidate
+
+  drained:
+    a boolean flag denoting whether this node is being drained
+
+  offline:
+    a boolean flag denoting whether this node is offline
+
+  i_pri_memory:
+    total memory required by primary instances
+
+  i_pri_up_memory:
+    total memory required by running primary instances
+
+  No allocations should be made on nodes having either the ``drained``
+  or ``offline`` flags set. More details about these of node status
+  flags is available in the manpage *ganeti(7)*.
+
+
 Respone message
 ~~~~~~~~~~~~~~~
 
diff --git a/doc/install.rst b/doc/install.rst
index 3f676a344..83e6c8ca4 100644
--- a/doc/install.rst
+++ b/doc/install.rst
@@ -1,7 +1,7 @@
 Ganeti installation tutorial
 ============================
 
-Documents Ganeti version 2.0.
+Documents Ganeti version 2.0
 
 .. contents::
 
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 692eb65ff..6bdc26340 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6587,7 +6587,7 @@ class IAllocator(object):
     cluster_info = cfg.GetClusterInfo()
     # cluster data
     data = {
-      "version": 1,
+      "version": constants.IALLOCATOR_VERSION,
       "cluster_name": cfg.GetClusterName(),
       "cluster_tags": list(cluster_info.GetTags()),
       "enabled_hypervisors": list(cluster_info.enabled_hypervisors),
diff --git a/lib/constants.py b/lib/constants.py
index e6f678d52..a77544d0e 100644
--- a/lib/constants.py
+++ b/lib/constants.py
@@ -402,6 +402,7 @@ NV_VGLIST = "vglist"
 NV_DRBDLIST = "drbd-list"
 
 # Allocator framework constants
+IALLOCATOR_VERSION = 2
 IALLOCATOR_DIR_IN = "in"
 IALLOCATOR_DIR_OUT = "out"
 IALLOCATOR_MODE_ALLOC = "allocate"
-- 
GitLab