'Returns list of valid vms from RetrieveResult object.'

def _get_valid_vms_from_retrieve_result(self, retrieve_result):

    lst_vm_names = []
    while retrieve_result:
        for vm in retrieve_result.objects:
            vm_uuid = None
            conn_state = None
            for prop in vm.propSet:
                if (prop.name == 'runtime.connectionState'):
                    conn_state = prop.val
                elif (prop.name == 'config.extraConfig["nvp.vm-uuid"]'):
                    vm_uuid = prop.val.value
            if (not vm_uuid):
                continue
            if (conn_state not in ['orphaned', 'inaccessible']):
                lst_vm_names.append(vm_uuid)
        retrieve_result = self._session._call_method(vutil, 'continue_retrieval', retrieve_result)
    return lst_vm_names
