Browse Source

Add devstack module to contrib

Add devstack module and with instructions on using it included in the
quickstart guide. The old manual process for using magnum with devstack
has been kept to retain information on how to deploy magnum manually. A
localrc for use with devstack has also been included rather than forcing
the user to copy and paste from the docs.

Closes-bug: 1430053
Change-Id: I373021378fd25d5a6cdb6213eaa21f8045a66be6
changes/28/160328/5
Tom Cammann 7 years ago
parent
commit
b4e4a6d1dd
  1. 28
      contrib/devstack/README.rst
  2. 45
      contrib/devstack/extras.d/70-magnum.sh
  3. 251
      contrib/devstack/lib/magnum
  4. 44
      contrib/devstack/localrc.example
  5. 14
      contrib/devstack/prepare_devstack.sh
  6. 186
      doc/source/dev/dev-manual-devstack.rst
  7. 160
      doc/source/dev/dev-quickstart.rst

28
contrib/devstack/README.rst

@ -0,0 +1,28 @@
====================
Devstack Integration
====================
This directory contains the files necessary to integrate Magnum with devstack.
Refer the quickstart guide for more information on using devstack and magnum.
Running devestack with magnum for the first time may take a long time as it
needs to download an atomic fedora 21 qcow image. If you already have this image
you can copy it to /opt/stack/devstack/files/fedora-21-atomic.qcow2 to save you
this time.
To install magnum into devstack: ::
git clone https://git.openstack.org/stackforge/magnum /opt/stack/magnum
git clone https://git.openstack.org/openstack-dev/devstack /opt/stack/devstack
# copy example localrc, modify as necessary
cp /opt/stack/magnum/contrib/devstack/localrc.example /opt/stack/devstack/localrc
cd /opt/stack/magnum
./contrib/devstack/prepare_devstack.sh
Run devstack as normal: ::
cd /opt/stack/magnum
./stack.sh

45
contrib/devstack/extras.d/70-magnum.sh

@ -0,0 +1,45 @@
# magnum.sh - Devstack extras script to install magnum
if is_service_enabled m-api m-cond; then
if [[ "$1" == "source" ]]; then
# Initial source
source $TOP_DIR/lib/magnum
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing magnum"
install_magnum
# add image to glance
if [[ "$ENABLED_SERVICES" =~ 'm-api' ]]; then
MANGUM_GUEST_IMAGE_URL=${MANGUM_GUEST_IMAGE_URL:-"https://fedorapeople.org/groups/heat/kolla/fedora-21-atomic.qcow2"}
IMAGE_URLS+=",${MANGUM_GUEST_IMAGE_URL}"
fi
LIBS_FROM_GIT="${LIBS_FROM_GIT},python-magnumclient"
install_magnumclient
cleanup_magnum
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring magnum"
configure_magnum
if is_service_enabled key; then
create_magnum_accounts
fi
elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
# Initialize magnum
init_magnum
# Start the magnum API and magnum taskmgr components
echo_summary "Starting magnum"
start_magnum
fi
if [[ "$1" == "unstack" ]]; then
stop_magnum
fi
if [[ "$1" == "clean" ]]; then
cleanup_magnum
fi
fi

251
contrib/devstack/lib/magnum

@ -0,0 +1,251 @@
#!/bin/bash
#
# lib/magnum
# Functions to control the configuration and operation of the **magnum** service
# Dependencies:
#
# - ``functions`` file
# - ``DEST``, ``DATA_DIR``, ``STACK_USER`` must be defined
# - ``SERVICE_{TENANT_NAME|PASSWORD}`` must be defined
# ``stack.sh`` calls the entry points in this order:
#
# - install_magnum
# - configure_magnum
# - create_magnum_conf
# - init_magnum
# - start_magnum
# - stop_magnum
# - cleanup_magnum
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Defaults
# --------
# Set up default directories
MAGNUM_REPO=${MAGNUM_REPO:-${GIT_BASE}/stackforge/magnum.git}
MAGNUM_BRANCH=${MAGNUM_BRANCH:-master}
MAGNUM_DIR=$DEST/magnum
GITREPO["python-magnumclient"]=${MAGNUMCLIENT_REPO:-${GIT_BASE}/stackforge/python-magnumclient.git}
GITBRANCH["python-magnumclient"]=${MAGNUMCLIENT_BRANCH:-master}
GITDIR["python-magnumclient"]=$DEST/python-magnumclient
MAGNUM_STATE_PATH=${MAGNUM_STATE_PATH:=$DATA_DIR/magnum}
MAGNUM_AUTH_CACHE_DIR=${MAGNUM_AUTH_CACHE_DIR:-/var/cache/magnum}
MAGNUM_CONF_DIR=/etc/magnum
MAGNUM_CONF=$MAGNUM_CONF_DIR/magnum.conf
if is_ssl_enabled_service "magnum" || is_service_enabled tls-proxy; then
MAGNUM_SERVICE_PROTOCOL="https"
fi
# Public facing bits
MAGNUM_SERVICE_HOST=${MAGNUM_SERVICE_HOST:-$SERVICE_HOST}
MAGNUM_SERVICE_PORT=${MAGNUM_SERVICE_PORT:-9511}
MAGNUM_SERVICE_PORT_INT=${MAGNUM_SERVICE_PORT_INT:-19511}
MAGNUM_SERVICE_PROTOCOL=${MAGNUM_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
# Support entry points installation of console scripts
if [[ -d $MAGNUM_DIR/bin ]]; then
MAGNUM_BIN_DIR=$MAGNUM_DIR/bin
else
MAGNUM_BIN_DIR=$(get_python_exec_prefix)
fi
# Functions
# ---------
# Test if any magnum services are enabled
# is_magnum_enabled
function is_magnum_enabled {
[[ ,${ENABLED_SERVICES} =~ ,"m-" ]] && return 0
return 1
}
# cleanup_magnum() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_magnum {
sudo rm -rf $MAGNUM_STATE_PATH $MAGNUM_AUTH_CACHE_DIR
}
# configure_magnum() - Set config files, create data dirs, etc
function configure_magnum {
# Put config files in ``/etc/magnum`` for everyone to find
if [[ ! -d $MAGNUM_CONF_DIR ]]; then
sudo mkdir -p $MAGNUM_CONF_DIR
sudo chown $STACK_USER $MAGNUM_CONF_DIR
fi
# Rebuild the config file from scratch
create_magnum_conf
}
# create_magnum_accounts() - Set up common required magnum accounts
#
# Project User Roles
# ------------------------------------------------------------------
# SERVICE_TENANT_NAME magnum service
function create_magnum_accounts {
create_service_user "magnum" "admin"
if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
local magnum_service=$(get_or_create_service "magnum" \
"container" "Magnum Container Service")
get_or_create_endpoint $magnum_service \
"$REGION_NAME" \
"$MAGNUM_SERVICE_PROTOCOL://$MAGNUM_SERVICE_HOST:$MAGNUM_SERVICE_PORT/v1" \
"$MAGNUM_SERVICE_PROTOCOL://$MAGNUM_SERVICE_HOST:$MAGNUM_SERVICE_PORT/v1" \
"$MAGNUM_SERVICE_PROTOCOL://$MAGNUM_SERVICE_HOST:$MAGNUM_SERVICE_PORT/v1"
fi
}
# create_magnum_conf() - Create a new magnum.conf file
function create_magnum_conf {
# (Re)create ``magnum.conf``
rm -f $MAGNUM_CONF
iniset $MAGNUM_CONF DEFAULT verbose "True"
iniset $MAGNUM_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
iniset $MAGNUM_CONF DEFAULT rabbit_userid $RABBIT_USERID
iniset $MAGNUM_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
iniset $MAGNUM_CONF DEFAULT rabbit_host $RABBIT_HOST
iniset $MAGNUM_CONF database connection `database_connection_url magnum`
iniset $MAGNUM_CONF api host "$MAGNUM_SERVICE_HOST"
iniset $MAGNUM_CONF api port "$MAGNUM_SERVICE_PORT"
iniset $MAGNUM_CONF conductor host "$MAGNUM_SERVICE_HOST"
configure_auth_token_middleware $MAGNUM_CONF magnum $MAGNUM_AUTH_CACHE_DIR
if is_fedora || is_suse; then
# magnum defaults to /usr/local/bin, but fedora and suse pip like to
# install things in /usr/bin
iniset $MAGNUM_CONF DEFAULT bindir "/usr/bin"
fi
if [ -n "$MAGNUM_STATE_PATH" ]; then
iniset $MAGNUM_CONF DEFAULT state_path "$MAGNUM_STATE_PATH"
iniset $MAGNUM_CONF DEFAULT lock_path "$MAGNUM_STATE_PATH"
fi
if [ "$SYSLOG" != "False" ]; then
iniset $MAGNUM_CONF DEFAULT use_syslog "True"
fi
# Format logging
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
setup_colorized_logging $MAGNUM_CONF DEFAULT
else
# Show user_name and project_name instead of user_id and project_id
iniset $MAGNUM_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
fi
# Register SSL certificates if provided
if is_ssl_enabled_service magnum; then
ensure_certificates MAGNUM
iniset $MAGNUM_CONF DEFAULT ssl_cert_file "$MAGNUM_SSL_CERT"
iniset $MAGNUM_CONF DEFAULT ssl_key_file "$MAGNUM_SSL_KEY"
iniset $MAGNUM_CONF DEFAULT enabled_ssl_apis "$MAGNUM_ENABLED_APIS"
fi
}
function create_magnum_conf_magnum_network {
iniset $MAGNUM_CONF DEFAULT network_manager "magnum.network.manager.$NETWORK_MANAGER"
iniset $MAGNUM_CONF DEFAULT public_interface "$PUBLIC_INTERFACE"
iniset $MAGNUM_CONF DEFAULT vlan_interface "$VLAN_INTERFACE"
iniset $MAGNUM_CONF DEFAULT flat_network_bridge "$FLAT_NETWORK_BRIDGE"
if [ -n "$FLAT_INTERFACE" ]; then
iniset $MAGNUM_CONF DEFAULT flat_interface "$FLAT_INTERFACE"
fi
}
# create_magnum_cache_dir() - Part of the init_magnum() process
function create_magnum_cache_dir {
# Create cache dir
sudo mkdir -p $MAGNUM_AUTH_CACHE_DIR
sudo chown $STACK_USER $MAGNUM_AUTH_CACHE_DIR
rm -f $MAGNUM_AUTH_CACHE_DIR/*
}
# init_magnum() - Initialize databases, etc.
function init_magnum {
# Only do this step once on the API node for an entire cluster.
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled m-api; then
# (Re)create magnum database
recreate_database magnum
# Migrate magnum database
$MAGNUM_BIN_DIR/magnum-db-manage upgrade
fi
create_magnum_cache_dir
}
# install_magnumclient() - Collect source and prepare
function install_magnumclient {
if use_library_from_git "python-magnumclient"; then
git_clone_by_name "python-magnumclient"
setup_dev_lib "python-magnumclient"
fi
}
# install_magnum() - Collect source and prepare
function install_magnum {
git_clone $MAGNUM_REPO $MAGNUM_DIR $MAGNUM_BRANCH
setup_develop $MAGNUM_DIR
}
# start_magnum_api() - Start the API process ahead of other things
function start_magnum_api {
# Get right service port for testing
local service_port=$MAGNUM_SERVICE_PORT
local service_protocol=$MAGNUM_SERVICE_PROTOCOL
if is_service_enabled tls-proxy; then
service_port=$MAGNUM_SERVICE_PORT_INT
service_protocol="http"
fi
run_process m-api "$MAGNUM_BIN_DIR/magnum-api"
echo "Waiting for magnum-api to start..."
if ! wait_for_service $SERVICE_TIMEOUT $service_protocol://$SERVICE_HOST:$service_port; then
die $LINENO "magnum-api did not start"
fi
# Start proxies if enabled
if is_service_enabled tls-proxy; then
start_tls_proxy '*' $MAGNUM_SERVICE_PORT $MAGNUM_SERVICE_HOST $MAGNUM_SERVICE_PORT_INT &
start_tls_proxy '*' $EC2_SERVICE_PORT $MAGNUM_SERVICE_HOST $EC2_SERVICE_PORT_INT &
fi
}
# start_magnum() - Start running processes, including screen
function start_magnum {
# ``run_process`` checks ``is_service_enabled``, it is not needed here
start_magnum_api
run_process m-cond "$MAGNUM_BIN_DIR/magnum-conductor"
}
# stop_magnum() - Stop running processes (non-screen)
function stop_magnum {
for serv in m-api m-cond; do
stop_process $serv
done
}
# Restore xtrace
$XTRACE

44
contrib/devstack/localrc.example

@ -0,0 +1,44 @@
# Modify to your environment
FLOATING_RANGE=192.168.1.224/27
PUBLIC_NETWORK_GATEWAY=192.168.1.225
PUBLIC_INTERFACE=em1
# Credentials
ADMIN_PASSWORD=password
DATABASE_PASSWORD=password
RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
enable_service rabbit
# Enable Neutron which is required by Magnum and disable nova-network.
enable_service magnum
enable_service m-cond
enable_service m-api
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
enable_service magnum
enable_service m-api
enable_service m-cond
FIXED_RANGE=10.0.0.0/24
Q_USE_SECGROUP=True
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=
PHYSICAL_NETWORK=public
OVS_PHYSICAL_BRIDGE=br-ex
# Log all output to files
LOGFILE=$HOME/devstack.log
SCREEN_LOGDIR=$HOME/logs

14
contrib/devstack/prepare_devstack.sh

@ -0,0 +1,14 @@
#!/bin/sh
set -eux
MAGNUM_DIR=$(readlink -f $(dirname $0)/../..)
INSTALL_DIR=${INSTALL_DIR:-/opt/stack}
cp ${MAGNUM_DIR}/contrib/devstack/lib/magnum ${INSTALL_DIR}/devstack/lib
cp ${MAGNUM_DIR}/contrib/devstack/extras.d/70-magnum.sh ${INSTALL_DIR}/devstack/extras.d
# Add magnum specific requirements to global requirements
git clone https://git.openstack.org/openstack/requirements ${INSTALL_DIR}/requirements || true
echo "python-kubernetes>=0.2" >> ${INSTALL_DIR}/requirements/global-requirements.txt
echo "docker-py>=0.5.1" >> ${INSTALL_DIR}/requirements/global-requirements.txt

186
doc/source/dev/dev-manual-devstack.rst

@ -0,0 +1,186 @@
.. _dev-quickstart:
Manually Adding Magnum to DevStack
==================================
If you are getting started with Magnum it is recommended you follow the
`dev quickstart guide <./dev-quickstart.rst>` to get up and running with
Magnum. This guide covers a more in-depth process to setup Magnum with devstack.
DevStack does not yet have Magnum support. It is, however, necessary to
develop Magnum from a devstack environment at the present time. Magnum depends
on Nova, Heat, and Neutron to create and schedule virtual machines to simulate
bare-metal. For milestone #2 we intend to introduce support for Ironic
deployment of baremetal nodes.
This session has only been tested on Ubuntu 14.04 (Trusty) and Fedora 21.
We recommend users to select one of them if it is possible.
NB: Magnum depends on a command line tool in kubernetes called kubectl
to execute its operations with Kubernetes. We are addressing this in milestone
#2 by implementing a native ReST client for Kubernetes. In the meantime, the
required action is to install kubectl manually.
Install binary distribution of kubectl distributed by Google::
wget https://github.com/GoogleCloudPlatform/kubernetes/releases/download/v0.11.0/kubernetes.tar.gz
tar -xzvf kubernetes.tar.gz
sudo cp -a kubernetes/platforms/linux/amd64/kubectl /usr/bin/kubectl
Clone DevStack::
cd ~
git clone https://github.com/openstack-dev/devstack.git devstack
Create devstack/localrc with minimal settings required to enable Heat
and Neutron, refer to http://docs.openstack.org/developer/devstack/guides/neutron.html
for more detailed neutron configuration.::
cd devstack
cat >localrc <<END
# Modify to your environment
FLOATING_RANGE=192.168.1.224/27
PUBLIC_NETWORK_GATEWAY=192.168.1.225
PUBLIC_INTERFACE=em1
# Credentials
ADMIN_PASSWORD=password
DATABASE_PASSWORD=password
RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
enable_service rabbit
# Enable Neutron which is required by Magnum and disable nova-network.
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
FIXED_RANGE=10.0.0.0/24
Q_USE_SECGROUP=True
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=
PHYSICAL_NETWORK=public
OVS_PHYSICAL_BRIDGE=br-ex
# Log all output to files
LOGFILE=$HOME/devstack.log
SCREEN_LOGDIR=$HOME/logs
END
./stack.sh
At this time, Magnum has only been tested with the Fedora Atomic micro-OS.
Magnum will likely work with other micro-OS platforms, but each one requires
individual support in the heat template.
The next step is to store the Fedora Atomic micro-OS in glance. The steps for
updating Fedora Atomic images are a bit detailed. Fortunately one of the core
developers has made Atomic images avaliable via the web:
If using the m-1 tag or tarball, please use the documentation shipped with the
milestone as the current master instructions are slightly incompatible.
Create a new shell, and source the devstack openrc script::
source ~/devstack/openrc admin admin
cd ~
wget https://fedorapeople.org/groups/heat/kolla/fedora-21-atomic.qcow2
glance image-create --name fedora21-atomic \
--is-public True \
--disk-format qcow2 \
--container-format bare < fedora-21-atomic.qcow2
test -f ~/.ssh/id_rsa.pub || ssh-keygen
nova keypair-add --pub-key ~/.ssh/id_rsa.pub testkey
Next, create a database in MySQL for Magnum::
mysql -h 127.0.0.1 -u root -ppassword mysql <<EOF
CREATE DATABASE IF NOT EXISTS magnum DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON magnum.* TO
'root'@'%' IDENTIFIED BY 'password'
EOF
Next, clone and install Magnum::
cd ~
git clone https://github.com/stackforge/magnum
cd magnum
sudo pip install -e .
Next configure Magnum::
# create the magnum conf directory
sudo mkdir -p /etc/magnum
# copy sample config and modify it as necessary
sudo cp etc/magnum/magnum.conf.sample /etc/magnum/magnum.conf
# enable debugging output
sudo sed -i "s/#debug\s*=.*/debug=true/" /etc/magnum/magnum.conf
# enable more verbose output
sudo sed -i "s/#verbose\s*=.*/verbose=true/" /etc/magnum/magnum.conf
# set RabbitMQ userid
sudo sed -i "s/#rabbit_userid\s*=.*/rabbit_userid=stackrabbit/" /etc/magnum/magnum.conf
# set RabbitMQ password
sudo sed -i "s/#rabbit_password\s*=.*/rabbit_password=password/" /etc/magnum/magnum.conf
# set SQLAlchemy connection string to connect to MySQL
sudo sed -i "s/#connection\s*=.*/connection=mysql:\/\/root:password@localhost\/magnum/" /etc/magnum/magnum.conf
# set Keystone account username
sudo sed -i "s/#admin_user\s*=.*/admin_user=admin/" /etc/magnum/magnum.conf
# set Keystone account password
sudo sed -i "s/#admin_password\s*=.*/admin_password=password/" /etc/magnum/magnum.conf
# set admin Identity API endpoint
sudo sed -i "s/#identity_uri\s*=.*/identity_uri=http:\/\/127.0.0.1:35357/" /etc/magnum/magnum.conf
# set public Identity API endpoint
sudo sed -i "s/#auth_uri\s*=.*/auth_uri=http:\/\/127.0.0.1:5000\/v2.0/" /etc/magnum/magnum.conf
Next, clone and install the client::
cd ~
git clone https://github.com/stackforge/python-magnumclient
cd python-magnumclient
sudo pip install -e .
Next, configure the database for use with Magnum::
magnum-db-manage upgrade
Finally, configure the keystone endpoint::
keystone service-create --name=magnum \
--type=container \
--description="Magnum Container Service"
keystone endpoint-create --service=magnum \
--publicurl=http://127.0.0.1:9511/v1 \
--internalurl=http://127.0.0.1:9511/v1 \
--adminurl=http://127.0.0.1:9511/v1
Next start the API service::
magnum-api
Finally start the conductor service in a new window::
magnum-conductor
Magnum should now be up and running. Further steps on utilising Magnum and
deploying containers can be found in the `quickstart guide
<../dev-quickstart.rst>`.

160
doc/source/dev/dev-quickstart.rst

@ -115,158 +115,46 @@ Install binary distribution of kubectl distributed by Google::
Clone DevStack::
cd ~
git clone https://github.com/openstack-dev/devstack.git devstack
# Create dir to run devstack from, if not done so already
sudo mkdir -p /opt/stack
sudo chown $USER /opt/stack
git clone https://github.com/openstack-dev/devstack.git /opt/stack/devstack
git clone https://github.com/stackforge/magnum /opt/stack/magnum
Create devstack/localrc with minimal settings required to enable Heat
Copy devstack/localrc with minimal settings required to enable Heat
and Neutron, refer to http://docs.openstack.org/developer/devstack/guides/neutron.html
for more detailed neutron configuration.::
cd devstack
cat >localrc <<END
# Modify to your environment
FLOATING_RANGE=192.168.1.224/27
PUBLIC_NETWORK_GATEWAY=192.168.1.225
PUBLIC_INTERFACE=em1
# Credentials
ADMIN_PASSWORD=password
DATABASE_PASSWORD=password
RABBIT_PASSWORD=password
SERVICE_PASSWORD=password
SERVICE_TOKEN=password
enable_service rabbit
# Enable Neutron which is required by Magnum and disable nova-network.
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
FIXED_RANGE=10.0.0.0/24
Q_USE_SECGROUP=True
ENABLE_TENANT_VLANS=True
TENANT_VLAN_RANGE=
PHYSICAL_NETWORK=public
OVS_PHYSICAL_BRIDGE=br-ex
# Log all output to files
LOGFILE=$HOME/devstack.log
SCREEN_LOGDIR=$HOME/logs
END
for more detailed neutron configuration.
Be sure to update network and other config as appropriate for your setup.::
cp /opt/stack/magnum/contrib/devstack/localrc.example /opt/stack/devstack/localrc
Prepare DevStack for Magnum::
cd /opt/stack/magnum
./contrib/devstack/prepare_devstack.sh
Run DevStack::
cd /opt/stack/magnum
./stack.sh
At this time, Magnum has only been tested with the Fedora Atomic micro-OS.
Magnum will likely work with other micro-OS platforms, but each one requires
individual support in the heat template.
The next step is to store the Fedora Atomic micro-OS in glance. The steps for
updating Fedora Atomic images are a bit detailed. Fortunately one of the core
developers has made Atomic images avaliable via the web:
If using the m-1 tag or tarball, please use the documentation shipped with the
milestone as the current master instructions are slightly incompatible.
The fedora-atomic-21 image will automatically be added to glance, you can still
add your own images to use manually through glance.
Create a new shell, and source the devstack openrc script::
source ~/devstack/openrc admin admin
cd ~
wget https://fedorapeople.org/groups/heat/kolla/fedora-21-atomic.qcow2
glance image-create --name fedora21-atomic \
--is-public True \
--disk-format qcow2 \
--container-format bare < fedora-21-atomic.qcow2
test -f ~/.ssh/id_rsa.pub || ssh-keygen
nova keypair-add --pub-key ~/.ssh/id_rsa.pub testkey
Next, create a database in MySQL for Magnum::
mysql -h 127.0.0.1 -u root -ppassword mysql <<EOF
CREATE DATABASE IF NOT EXISTS magnum DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON magnum.* TO
'root'@'%' IDENTIFIED BY 'password'
EOF
Next, clone and install Magnum::
cd ~
git clone https://github.com/stackforge/magnum
cd magnum
sudo pip install -e .
Next configure Magnum::
# create the magnum conf directory
sudo mkdir -p /etc/magnum
# copy sample config and modify it as necessary
sudo cp etc/magnum/magnum.conf.sample /etc/magnum/magnum.conf
# enable debugging output
sudo sed -i "s/#debug\s*=.*/debug=true/" /etc/magnum/magnum.conf
# enable more verbose output
sudo sed -i "s/#verbose\s*=.*/verbose=true/" /etc/magnum/magnum.conf
# set RabbitMQ userid
sudo sed -i "s/#rabbit_userid\s*=.*/rabbit_userid=stackrabbit/" /etc/magnum/magnum.conf
# set RabbitMQ password
sudo sed -i "s/#rabbit_password\s*=.*/rabbit_password=password/" /etc/magnum/magnum.conf
# set SQLAlchemy connection string to connect to MySQL
sudo sed -i "s/#connection\s*=.*/connection=mysql:\/\/root:password@localhost\/magnum/" /etc/magnum/magnum.conf
# set Keystone account username
sudo sed -i "s/#admin_user\s*=.*/admin_user=admin/" /etc/magnum/magnum.conf
# set Keystone account password
sudo sed -i "s/#admin_password\s*=.*/admin_password=password/" /etc/magnum/magnum.conf
# set admin Identity API endpoint
sudo sed -i "s/#identity_uri\s*=.*/identity_uri=http:\/\/127.0.0.1:35357/" /etc/magnum/magnum.conf
# set public Identity API endpoint
sudo sed -i "s/#auth_uri\s*=.*/auth_uri=http:\/\/127.0.0.1:5000\/v2.0/" /etc/magnum/magnum.conf
Next, clone and install the client::
cd ~
git clone https://github.com/stackforge/python-magnumclient
cd python-magnumclient
sudo pip install -e .
Next, configure the database for use with Magnum::
magnum-db-manage upgrade
Finally, configure the keystone endpoint::
keystone service-create --name=magnum \
--type=container \
--description="Magnum Container Service"
keystone endpoint-create --service=magnum \
--publicurl=http://127.0.0.1:9511/v1 \
--internalurl=http://127.0.0.1:9511/v1 \
--adminurl=http://127.0.0.1:9511/v1
Next start the API service::
magnum-api
Next start the conductor service in a new window::
magnum-conductor
To get started, list the available commands and resources::
magnum help
@ -275,7 +163,7 @@ First create a baymodel, which is similar in nature to a flavor. It informs
Magnum in which way to construct a bay.::
NIC_ID=$(neutron net-show public | awk '/ id /{print $4}')
magnum baymodel-create --name testbaymodel --image-id fedora21-atomic \
magnum baymodel-create --name testbaymodel --image-id fedora-21-atomic \
--keypair-id testkey \
--external-network-id $NIC_ID \
--dns-nameserver 8.8.8.8 --flavor-id m1.small

Loading…
Cancel
Save