Chapter 8. Using Nova

Now that we have a working Nova installation, we need to ready it for use by our initial users. This requires us to do some command-line configuration on the Nova controller (or the server with the database). First, we will add a user, then upload a virtual disk image, launch the instance, and finally configure network access for it.

The first step is using our new Nova installation is to create a user. This is a multi-step process that uses the nova-manage utility to create a project.

# nova-manage user create ken
export EC2_ACCESS_KEY=d77406c3-cea1-45af-bbd9-acfd16ff49e3
export EC2_SECRET_KEY=b9c6ab50-65d7-4185-a1a9-267a2afe30f9
# nova-manage role add ken cloudadmin
# nova-manage project create book ken
# nova-manage project zipfile book ken

The final command in the example will produce a zip-compressed file called nova.zip. Now uncompress the credential zip file and source the resulting novarc. This will set a number of environmental variables needed to access your Nova installation with other utilities. If you are creating this user on behalf of another user, you will need to give him this zipfile.

# unzip nova.zip
Archive:  nova.zip
 extracting: novarc
 extracting: pk.pem
 extracting: cert.pem
 extracting: cacert.pem
# . ./novarc

While not necessary, you might want to view novarc to find out what environmental variables it is setting for you. Remember that you will need to source this file in every session if you want to access your Nova deployment. You might want to add it to your shell profile to have it automatically sourced on login.

# more novarc
NOVA_KEY_DIR=$(pushd $(dirname $BASH_SOURCE)>/dev/null; pwd; popd>/dev/null)
export EC2_ACCESS_KEY="d77406c3-cea1-45af-bbd9-acfd16ff49e3:book"
export EC2_SECRET_KEY="b9c6ab50-65d7-4185-a1a9-267a2afe30f9"
export EC2_URL="http://192.168.1.65:8773/services/Cloud"
export S3_URL="http://192.168.1.65:3333"
export EC2_USER_ID=42 # nova does not use user id, but bundling requires it
export EC2_PRIVATE_KEY=${NOVA_KEY_DIR}/pk.pem
export EC2_CERT=${NOVA_KEY_DIR}/cert.pem
export NOVA_CERT=${NOVA_KEY_DIR}/cacert.pem
export EUCALYPTUS_CERT=${NOVA_CERT} \
# euca-bundle-image seems to require this set
alias ec2-bundle-image="ec2-bundle-image --cert ${EC2_CERT} --privatekey \
${EC2_PRIVATE_KEY} --user 42 --ec2cert ${NOVA_CERT}"
alias ec2-upload-bundle="ec2-upload-bundle -a ${EC2_ACCESS_KEY} \
-s ${EC2_SECRET_KEY} --url ${S3_URL} --ec2cert ${NOVA_CERT}"
export NOVA_API_KEY="d77406c3-cea1-45af-bbd9-acfd16ff49e3"
export NOVA_USERNAME="ken"
export NOVA_URL="http://192.168.1.65:8774/v1.0/"