Retrieves resource pool objects

    service_instance
        The service instance object to query the vCenter

    resource_pool_names
        Resource pool names

    datacenter_name
        Name of the datacenter where the resource pool is available

    get_all_resource_pools
        Boolean

    return
        Resourcepool managed object reference

def get_resource_pools(service_instance, resource_pool_names, datacenter_name=None,
                       get_all_resource_pools=False):
    '''
    Retrieves resource pool objects

    service_instance
        The service instance object to query the vCenter

    resource_pool_names
        Resource pool names

    datacenter_name
        Name of the datacenter where the resource pool is available

    get_all_resource_pools
        Boolean

    return
        Resourcepool managed object reference
    '''

    properties = ['name']
    if not resource_pool_names:
        resource_pool_names = []
    if datacenter_name:
        container_ref = get_datacenter(service_instance, datacenter_name)
    else:
        container_ref = get_root_folder(service_instance)

    resource_pools = get_mors_with_properties(service_instance,
                                              vim.ResourcePool,
                                              container_ref=container_ref,
                                              property_list=properties)

    selected_pools = []
    for pool in resource_pools:
        if get_all_resource_pools or (pool['name'] in resource_pool_names):
            selected_pools.append(pool['object'])
    if not selected_pools:
        raise salt.exceptions.VMwareObjectRetrievalError(
            'The resource pools with properties '
            'names={} get_all={} could not be found'.format(selected_pools,
                                                            get_all_resource_pools))

    return selected_pools