Prevent jobs from being created via the RPC interface that will be impossible
to schedule due to labels that conflict with the supplied atomic group (or
lack thereof) being specified as meta_hosts or dependencies.
Signed-off-by: Gregory Smith <gps@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3018 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index 8d25a20..abc9786 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -438,6 +438,19 @@
dependency_labels = [labels_by_name[label_name]
for label_name in dependencies]
+ for label in metahost_objects + dependency_labels:
+ if label.atomic_group and not atomic_group:
+ raise model_logic.ValidationError(
+ {'atomic_group_name':
+ 'Some meta_hosts or dependencies require an atomic group '
+ 'but no atomic_group_name was specified for this job.'})
+ elif (label.atomic_group and
+ label.atomic_group.name != atomic_group_name):
+ raise model_logic.ValidationError(
+ {'atomic_group_name':
+ 'Some meta_hosts or dependencies require an atomic group '
+ 'other than the one requested for this job.'})
+
job = models.Job.create(owner=owner, name=name, priority=priority,
control_file=control_file,
control_type=control_type,