Extract belongsto2object_list call from the loop for performance
Extract belongsto2object_list call from the loop for performance

Before this commit, if you have a large number of input objects, we are
effectively re-querying the entire belongsto list over and over in the
loop, when we can just do it once at the beginning.

Part of #21249

kbrock/manageiq,agrare/manageiq,NickLaMuro/manageiq,NickLaMuro/manageiq,jrafanie/manageiq,mzazrivec/manageiq,kbrock/manageiq,agrare/manageiq,NickLaMuro/manageiq,jrafanie/manageiq,chessbyte/manageiq,mzazrivec/manageiq,agrare/manageiq,jrafanie/manageiq,mzazrivec/manageiq,chessbyte/manageiq,ManageIQ/manageiq,agrare/manageiq,mzazrivec/manageiq,jrafanie/manageiq,ManageIQ/manageiq,chessbyte/manageiq,ManageIQ/manageiq,NickLaMuro/manageiq,kbrock/manageiq,kbrock/manageiq,ManageIQ/manageiq,chessbyte/manageiq