Skip to content

Instantly share code, notes, and snippets.

@agentultra
Created September 8, 2015 15:34
Show Gist options
  • Save agentultra/f7dd20bf4ce8185611ad to your computer and use it in GitHub Desktop.
Save agentultra/f7dd20bf4ce8185611ad to your computer and use it in GitHub Desktop.
minimal devstack with nova and neutron
git clone https://git.openstack.org/openstack-dev/devstack
cd devstack
cat << EOF > local.conf
[[local|localrc]]
DEST=/opt/stack
DATA_DIR=$DEST/data
SCREEN_LOGDIR=$DATA_DIR/logs/
LOGFILE=/$DATA_DIR/logs/devstacklog.txt
VERBOSE=True
USE_SCREEN=True
LOG_COLOR=True
RABBIT_PASSWORD=secret
MYSQL_PASSWORD=secret
SERVICE_TOKEN=secret
SERVICE_PASSWORD=secret
ADMIN_PASSWORD=secret
ENABLED_SERVICES=g-api,g-reg,key,n-api,n-cpu,n-sch,n-cond,mysql,rabbit,dstat,quantum,q-svc,q-agt,q-dhcp,q-l3,q-meta
SERVICE_HOST=127.0.0.1
NETWORK_GATEWAY=10.1.0.1
FIXED_RANGE=10.1.0.0/24
FIXED_NETWORK_SIZE=256
FORCE_CONFIG_DRIVE=always
VIRT_DRIVER=libvirt
# To use nested KVM, un-comment the below line
# LIBVIRT_TYPE=kvm
IMAGE_URLS="http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img"
# If you have `dnf` package manager, use it to improve speedups in DevStack build/tear down
# export YUM=dnf
EOF
./stack.sh
. openrc demo
PUB_NET=$(neutron net-list | grep public | awk '{print $2;}')
PRIV_NET=$(neutron net-list | grep private | awk '{print $2;}')
ROUTER_ID=$(neutron router-list | grep router1 | awk '{print $2;}')
neutron router-gateway-set $ROUTER_ID $PUB_NET
neutron security-group-rule-create --protocol icmp \
--direction ingress --remote-ip-prefix 0.0.0.0/0 default
neutron security-group-rule-create --protocol tcp \
--port-range-min 22 --port-range-max 22 --direction ingress default
nova keypair-add oskey1 > oskey1.priv
chmod 600 oskey1.priv
nova boot --image cirros-0.3.3-x86_64-disk \
--nic net-id=$PRIV_NET --flavor m1.tiny \
--key_name oskey1 cirrvm1 --security_groups default
echo "Waiting for instance to boot..."
sleep 5
INSTANCE_ID=$(nova list | grep -i active | awk '{print $2;}')
INSTANCE_PORT_ID=$(neutron port-list --device-id $INSTANCE_ID | sed -n 4p | awk '{ print $2; }')
FLOATING_IP_ID=$(neutron floatingip-create public | grep ' id ' | awk '{ print $4; }')
sleep 1 # give a little time for neutron to bring it to active
neutron floatingip-associate $FLOATING_IP_ID $INSTANCE_PORT_ID
nova list
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment