def vsan_datastore_configured(name, datastore_name):
    '''
    Configures the cluster's VSAN datastore

    WARNING: The VSAN datastore is created automatically after the first
    ESXi host is added to the cluster; the state assumes that the datastore
    exists and errors if it doesn't.
    '''

    cluster_name, datacenter_name = \
            __salt__['esxcluster.get_details']()['cluster'], \
            __salt__['esxcluster.get_details']()['datacenter']
    display_name = '{0}/{1}'.format(datacenter_name, cluster_name)
    log.info('Running vsan_datastore_configured for \'%s\'', display_name)
    ret = {'name': name,
           'changes': {}, 'result': None,
           'comment': 'Default'}
    comments = []
    changes = {}
    changes_required = False

    try:
        si = __salt__['vsphere.get_service_instance_via_proxy']()
        # Checking if we need to rename the vsan datastore
        vsan_ds = _get_vsan_datastore(si, cluster_name)
        if vsan_ds['name'] == datastore_name:
            comments.append('vSAN datastore is correctly named \'{0}\'. '
                            'Nothing to be done.'.format(vsan_ds['name']))
            log.info(comments[-1])
        else:
            # vsan_ds needs to be updated
            changes_required = True
            if __opts__['test']:
                comments.append('State {0} will rename the vSAN datastore to '
                                '\'{1}\'.'.format(name, datastore_name))
                log.info(comments[-1])
            else:
                log.trace('Renaming vSAN datastore \'%s\' to \'%s\'',
                          vsan_ds['name'], datastore_name)
                __salt__['vsphere.rename_datastore'](
                    datastore_name=vsan_ds['name'],
                    new_datastore_name=datastore_name,
                    service_instance=si)
                comments.append('Renamed vSAN datastore to \'{0}\'.'
                                ''.format(datastore_name))
                changes = {'vsan_datastore': {'new': {'name': datastore_name},
                                              'old': {'name': vsan_ds['name']}}}
                log.info(comments[-1])
        __salt__['vsphere.disconnect'](si)

        ret.update({'result': True if (not changes_required) else None if
                    __opts__['test'] else True,
                    'comment': '\n'.join(comments),
                    'changes': changes})
        return ret
    except salt.exceptions.CommandExecutionError as exc:
        log.exception('Encountered error')
        if si:
            __salt__['vsphere.disconnect'](si)
        ret.update({
            'result': False,
            'comment': exc.strerror})
        return ret
Configures the cluster's VSAN datastore

    WARNING: The VSAN datastore is created automatically after the first
    ESXi host is added to the cluster; the state assumes that the datastore
    exists and errors if it doesn't.