Skip autoupdate_P2P when scheduler gives us DUTs from different labs.

Also adding in copyright header and renaming control file to be more
consistent.

BUG=chromium:809681
BUG=chromium:807495
TEST=autoupdate_P2P.local

Change-Id: Id67580664331b1d9a6f64eb8600ecbb0b8a3af85
Reviewed-on: https://chromium-review.googlesource.com/905808
Commit-Ready: David Haddock <dhaddock@chromium.org>
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/server/site_tests/autoupdate_P2P/autoupdate_P2P.py b/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
index 68d1a6c..b4ac86f 100644
--- a/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
+++ b/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
@@ -1,3 +1,7 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
 import logging
 import os
 import re
@@ -180,6 +184,12 @@
         @param job_repo_url: URL to work out the current build.
 
         """
+        lab1 = self._hosts[0].hostname.partition('-')[0]
+        lab2 = self._hosts[1].hostname.partition('-')[0]
+        if lab1 != lab2:
+            raise error.TestNAError('Test was given DUTs in different labs so '
+                                    'P2P will not work. See crbug.com/807495.')
+
         logging.info('Making sure hosts can ping each other.')
         result = self._hosts[1].run('ping -c5 %s' % self._hosts[0].ip,
                                     ignore_status=True)
@@ -189,8 +199,8 @@
         # Get the current build. e.g samus-release/R65-10200.0.0
         if job_repo_url is None:
             logging.info('Making sure hosts have the same build.')
-            url, build1 = self._get_build_from_job_repo_url(self._hosts[0])
-            url, build2 = self._get_build_from_job_repo_url(self._hosts[1])
+            _, build1 = self._get_build_from_job_repo_url(self._hosts[0])
+            _, build2 = self._get_build_from_job_repo_url(self._hosts[1])
             if build1 != build2:
                 raise error.TestFail('The builds on the hosts did not match. '
                                      'Host one: %s, Host two: %s' % (build1,
diff --git a/server/site_tests/autoupdate_P2P/control b/server/site_tests/autoupdate_P2P/control.delta
similarity index 96%
rename from server/site_tests/autoupdate_P2P/control
rename to server/site_tests/autoupdate_P2P/control.delta
index 1b4204b..102b871 100644
--- a/server/site_tests/autoupdate_P2P/control
+++ b/server/site_tests/autoupdate_P2P/control.delta
@@ -1,5 +1,5 @@
 AUTHOR = "dhaddock, Chromium OS"
-NAME = "autoupdate_P2P"
+NAME = "autoupdate_P2P.delta"
 PURPOSE = "Test autoupdate via peer to peer(P2P)."
 TIME = "MEDIUM"
 TEST_CATEGORY = "Functional"