Optimize service map lookups during reconfigure
Optimize service map lookups during reconfigure

Avoid issuing an empty "WHERE ... IN (...)" construct. Calculate the
priority of a service mapped to any given location in advance, and use
that map to select the preferred service on the fly, instead of building
a map of all mapped instances first.

Change-Id: Ie2ca654bedbe08f9a09cb362a8a63723bee25199
Reviewed-by: Priya Joshi <3c6cfa6f57440adfc837c4ad04483313acbc2582@morganstanley.com>

guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon