Remove the ability for host status to be modified via the frontend.
This interferes with the monitor_db scheduler as it owns the field.
Signed-off-by: Gregory Smith <gps@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3584 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 2b0fa83..e87553a 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -319,6 +319,21 @@
(atomic_group.name,)})
+def check_modify_host(update_data):
+ """
+ Sanity check modify_host* requests.
+
+ @param update_data: A dictionary with the changes to make to a host
+ or hosts.
+ """
+ # Only the scheduler (monitor_db) is allowed to modify Host status.
+ # Otherwise race conditions happen as a hosts state is changed out from
+ # beneath tasks being run on a host.
+ if 'status' in update_data:
+ raise model_logic.ValidationError({
+ 'status': 'Host status can not be modified by the frontend.'})
+
+
def get_motd():
dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, "..", "..", "motd.txt")