Add host attributes to AFE. Nothing actually uses them; they're purely for users and scripts to use. Initial implementation is minimal - new migration, new model, RPCs to set and delete, and inclusion of attributes in get_hosts() results. No CLI or frontend support.
The change to get_hosts() is of primary interest here, since it involves a general problems that occurs many places in Autotest -- gathering relationships over many items. This has been solved in two ways previously:
* inefficiently in most places, by doing a query for each object (i.e. get_hosts()).
* efficiently in one place (JobManager.populate_dependencies()), by doing a single query to get a pivot table and then postprocessing to gather relationships for each object.
This time, I went ahead and implemented a general solution, a generalized version of JobManager.populate_dependencies(). I removed populate_dependencies() and made get_jobs() use the new general version instead, and I made get_hosts() use the new version for all its relationships, including the new attributes relationship. This should speed up get_hosts() considerably. In a future change I'll apply this solution to get_test_views() over in TKO land, since that would also greatly benefit in performance.
Signed-off-by: Steve Howard <showard@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3102 592f7852-d20e-0410-864c-8624ca9c26a4
7 files changed