dealing with the scenario for hypervisor that hostname may or may not co...

...ntain domain name
I would save the results of the search, so you don't have to call search again.   It would be good to have it log an error or warning if more than one host is returned, too.