autotest: balance_pool: add extra_labels support to _DUTPool

This adds but does not use a new extra_labels feature to _DUTPool.

BUG=chromium:780876
TEST=None

Change-Id: I26a9a2919fb129edca124aec32e4659f229a820a
Reviewed-on: https://chromium-review.googlesource.com/751688
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/site_utils/balance_pools.py b/site_utils/balance_pools.py
index 3e576b5..fa3f3d1 100755
--- a/site_utils/balance_pools.py
+++ b/site_utils/balance_pools.py
@@ -151,6 +151,10 @@
     which must always be assigned to pool:suites.  These DUTs are
     always marked with pool:chameleon to prevent their reassignment.
 
+    |extra_labels| may be used to restrict DUTPool down to a subset
+    of a given board+pool, by specifying additonal labels that all
+    DUTs are required to possess.
+
     TODO(jrbarnette):  The use of `pool:chamelon` (instead of just
     the `chameleon` label is a hack that should be eliminated.
 
@@ -173,12 +177,14 @@
 
     """
 
-    def __init__(self, afe, board, pool, start_time, end_time):
+    def __init__(self, afe, board, pool, start_time, end_time,
+                 extra_labels=None):
         self.board = board
         self.pool = pool
         self.working_hosts = []
         self.broken_hosts = []
         self.ineligible_hosts = []
+        self._extra_labels = extra_labels or []
         self.total_hosts = self._get_hosts(afe, start_time, end_time)
         self._labels = [_POOL_PREFIX + self.pool]
 
@@ -187,7 +193,8 @@
         all_histories = (
             status_history.HostJobHistory.get_multiple_histories(
                     afe, start_time, end_time,
-                    board=self.board, pool=self.pool))
+                    board=self.board, pool=self.pool,
+                    extra_labels=self._extra_labels))
         for h in all_histories:
             host = h.host
             host_pools = [l for l in host.labels