[autotest] Move synch_count over max check into check function

check_atomic_group_create_job is called by create_job_common is called by
create_job.

BUG=None
TEST=None

Change-Id: I616a8725e95263f5d4276b4fde773bc720366895
Reviewed-on: https://chromium-review.googlesource.com/430209
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index 0822a84..4468449 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -406,6 +406,13 @@
 
     @raises model_logic.ValidationError - When an issue is found.
     """
+    if synch_count and synch_count > atomic_group.max_number_of_machines:
+        raise model_logic.ValidationError(
+            {'atomic_group_name' :
+             'You have requested a synch_count (%d) greater than the '
+             'maximum machines in the requested Atomic Group (%d).' %
+             (synch_count, atomic_group.max_number_of_machines)})
+
     # If specific host objects were supplied with an atomic group, verify
     # that there are enough to satisfy the synch_count.
     minimum_required = synch_count or 1
@@ -969,12 +976,6 @@
                     {'one_time_hosts':
                      'One time hosts cannot be used with an Atomic Group.'})
         atomic_group = models.AtomicGroup.smart_get(atomic_group_name)
-        if synch_count and synch_count > atomic_group.max_number_of_machines:
-            raise model_logic.ValidationError(
-                    {'atomic_group_name' :
-                     'You have requested a synch_count (%d) greater than the '
-                     'maximum machines in the requested Atomic Group (%d).' %
-                     (synch_count, atomic_group.max_number_of_machines)})
     else:
         atomic_group = None