CA-98944: Replaced potentially lots of db calls (one per VBD) by two big get_internal_where calls

Signed-off-by: Vincent Bernardoff <vincent.bernardoff@citrix.com>
Merge pull request #1132 from vbmithr/ca98944

CA-98944: Reduced db access