[libvirt] [PATCHv5 05/19] util: Refactor code for determining allocation path