Fix an error in affinity filters

Fix a call to compute_api.get_all to properly exclude deleted instances.
Add tests to prohibit this error in the future.

After some thought, this can be further optimized to let the instance
query do all the filtering/matching.

Resolves bug 1107156.

Change-Id: I6d6a6ba44d38d363489853d0407ad4cc94046656
(cherry picked from commit 8bc80cab3c134d64953b4f6493cab80b5bdc1b69)
Merge "Fix an error in affinity filters" into stable/folsom