New issue
Advanced search Search tips

Issue 807371 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

balance_pools mishandles multiple boards on command line

Reported by jrbarnette@chromium.org, Jan 30 2018

Issue description

Sample command with output:
    $ balance_pool -n bvt celes candy
    candy bvt pool: Target of 6 is above minimum.
    # Transferring 0 DUTs from bvt to suites.
    # Transferring 0 DUTs from suites to bvt.

The output should have reported on both `celes` and `candy`,
but only board `candy` is listed.  The same thing happens
without the "-n" option; in general, only the last board on
the command line will be acted on.


 
The problem happens because of code in infer_balancer_targets(),
in site_utils/balance_pools.py:
            for board_or_model in arguments.boards_or_models:
                labels = labellib.LabelsMapping()
                if arguments.as_model:
                    labels['model'] = board_or_model
                else:
                    labels['board'] = board_or_model
            if arguments.sku:
                labels['sku'] = arguments.sku
            balancer_targets.append((pool, labels.getlabels()))

The `for` loop reassigns `labels` at every iteration, but throws
away all but the last of the values.

Probably, the fix is to ident the three lines starting at `if arguments.sku`,
to make them part of the for loop.

Cc: pprabhu@chromium.org
The bug was most likely introduced by this CL:
    https://chromium-review.googlesource.com/#/c/chromiumos/third_party/autotest/+/762597/
We accept patches ;)
Project Member

Comment 5 by bugdroid1@chromium.org, Jan 31 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/32fb1e8f4a5dbc7009e86c5b30fcca86671d7278

commit 32fb1e8f4a5dbc7009e86c5b30fcca86671d7278
Author: Richard Barnette <jrbarnette@chromium.org>
Date: Wed Jan 31 17:06:43 2018

Fix balance pools when more than one board is supplied.

Fixed the `balance_pool` command so that when the command line
included more than one board, all of them would be processed, rather
than just the last one.

BUG= chromium:807371 
TEST=balance_pool -n bvt celes candy

Change-Id: I52cc1c1ee7f221ebb612bae83f2181b74a105235
Reviewed-on: https://chromium-review.googlesource.com/894442
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@google.com>

[modify] https://crrev.com/32fb1e8f4a5dbc7009e86c5b30fcca86671d7278/site_utils/balance_pools.py

Owner: pprabhu@chromium.org
Status: Fixed (was: Untriaged)
I think. Not that I checked.

Sign in to add a comment