#                                                                      -*-sh-*-
# Devstack settings that are wanted when using Calico
# ===================================================

# If SERVICE_HOST is not the local host name, we will prepare a
# compute-only node.
if [ x$SERVICE_HOST != x$HOSTNAME ]; then
    CALICO_COMPUTE_ONLY=true
    MYSQL_HOST=${MYSQL_HOST:-$SERVICE_HOST}
    RABBIT_HOST=${RABBIT_HOST:-$SERVICE_HOST}
else
    CALICO_COMPUTE_ONLY=false
fi

if $CALICO_COMPUTE_ONLY; then
    # Explicitly enable the services that we need for compute only.
    ENABLED_SERVICES=n-cpu,neutron,calico-dhcp,n-api-meta,calico-felix,calico-bird
else
    # Disable services that Devstack starts by default, but that we
    # don't need for Calico networking demonstration: 'dstat' is a
    # rolling display of memory and CPU usage by the various OpenStack
    # services and agents; 'tempest' is OpenStack's high level testing
    # framework; and 'n-net' is Nova networking.
    disable_service dstat
    disable_service tempest
    disable_service n-net

    # Enable services that Devstack doesn't enable by default, but
    # that we _do_ want for Calico demonstration: 'q-svc' is the
    # Neutron server; 'calico-dhcp' means the Calico DHCP agent; and
    # 'n-api-meta' is the Nova metadata API service.
    enable_service q-svc
    enable_service calico-dhcp
    enable_service n-api-meta

    # When we later launch Felix (Calico's agent), we do that as a
    # service named 'calico-felix', and that only works if Devstack
    # thinks that 'calico-felix' is enabled.  So do that here.
    enable_service calico-felix

    # 'calico-bird' is an additional service that automatically
    # generates and maintains correct full mesh BIRD config, in a
    # multi-node Calico/DevStack cluster.
    enable_service calico-bird
fi

# When Neutron is enabled, Devstack does agent-related installations,
# configurations and service startups as directed by the value of
# Q_AGENT.  Devstack doesn't actually include any code for the
# 'calico' value, but the point here is that we want to avoid running
# code for any of the agents that Devstack _does_ have code for, such
# as openvswitch and linuxbridge.  So all we're doing here is setting
# a value that Devstack will not recognize.
Q_AGENT=calico

# Calico does not use namespaces.
Q_USE_NAMESPACE=False

# Devstack normally creates some initial Neutron networks for VMs to
# attach to.  But it can't easily be made to do this in the way that
# Calico wants, i.e. shared and with a 'local' network_type but no
# segmentation ID.  So we tell Devstack not to create those initial
# networks, and instead document the correct (for Calico) 'neutron
# net-create' and 'neutron subnet-create' invocations in README.rst.
NEUTRON_CREATE_INITIAL_NETWORKS=False
