Browse Source

Added a new example folder showing how to create a NFS cinder VM using a static IP in Quantum.

tags/debian/0.5
Thomas Goirand 8 years ago
parent
commit
6ccff7a7a5
5 changed files with 135 additions and 2 deletions
  1. +7
    -2
      debian/changelog
  2. +1
    -0
      debian/examples
  3. +1
    -0
      debian/rules
  4. +79
    -0
      examples/nfs-server/build
  5. +47
    -0
      examples/nfs-server/customize

+ 7
- 2
debian/changelog View File

@@ -1,9 +1,14 @@
openstack-debian-images (0.5) unstable; urgency=low
openstack-debian-images (0.5) UNRELEASED; urgency=low

[ Mehdi Abaakouk ]
* Restore the default sshd configuration to allow authorized_keys and
authorized_keys2 files

-- Mehdi Abaakouk <sileht@sileht.net> Thu, 10 Oct 2013 13:07:31 +0200
[ Thomas Goirand ]
* Added a new example folder showing how to create a NFS cinder VM using a
static IP in Quantum.

-- Thomas Goirand <zigo@debian.org> Fri, 25 Oct 2013 20:46:15 +0800

openstack-debian-images (0.4) unstable; urgency=low



+ 1
- 0
debian/examples View File

@@ -0,0 +1 @@
examples/*

+ 1
- 0
debian/rules View File

@@ -19,6 +19,7 @@ binary-indep: install
dh_testdir
dh_testroot
dh_installdocs
dh_installexamples
dh_installchangelogs
dh_installman
dh_install


+ 79
- 0
examples/nfs-server/build View File

@@ -0,0 +1,79 @@
#!/bin/sh

set -e

# Image size in GB
IMAGE_SIZE=150
# Fill this with for example: 10.0.0.0/24
YOUR_NETWORK_IP=""
# Fill this with for example: 10.0.0.151
NFS_SERVER_IP=""

# Fill in your key name in Nova
SSH_KEY_NAME=""

# Fill in the hostname you wish to use for this NFS server
MY_HOSTNAME=""

# Name of your local lan as returned by "quantum net-list"
LOCAL_LAN_NAME=""

if [ -z "${YOUR_NETWORK_IP}" ] || [ -z "${NFS_SERVER_IP}" ] || [ -z "${SSH_KEY_NAME}" ] || [ -z "${MY_HOSTNAME}" ] || [ -z "${LOCAL_LAN_NAME}" ] ; then
echo "parameters not configured in the script $0"
exit 1
fi

NEUTRON=`which neutron`
if [ -z "${NEUTRON}" ] ; then
NEUTRON=`which quantum`
fi
if [ -z "${NEUTRON}" ] ; then
echo "Please install neutron (or quantum) client"
exit 1
fi

build-openstack-debian-image -r wheezy \
-e nfs-kernel-server,nfs-common \
-hs ./customize

if ! [ -e version ] ; then
echo 0 > version
fi
VERSION=`cat version`
VERSION=$(( ${VERSION} + 1 ))
echo ${VERSION} >version

#
rm debian-wheezy-7.0.0-3-amd64.raw
mv debian-wheezy-7.0.0-3-amd64.qcow2 wheezy-nfs-${VERSION}.qcow2
echo "Uploading image to Glance..."
glance image-create --name="Wheezy NFS ${VERSION}" --disk-format=qcow2 --container-format=bare --file wheezy-nfs-${VERSION}.qcow2
echo "Creating cinder disk out of the Glance image..."
IMAGE_ID=`glance image-list | grep "Wheezy NFS ${VERSION}" | awk '{print $2}'`
cinder create --image-id ${IMAGE_ID} --display-name "Wheezy NFS ${VERSION}" ${IMAGE_SIZE}
echo "Deleting Glance image..."
glance image-delete ${IMAGE_ID}

echo -n "Waiting for Cinder image to become bootable."
CINDER_IMAGE_BOOTABLE=`cinder list | grep "Wheezy NFS 4" | awk '{print $14}'`
while [ "${CINDER_IMAGE_BOOTABLE}" != "true" ] ; do
sleep 2
echo -n "."
done
echo " done!"

# Creates a static (fixed) IP ${NFS_SERVER_IP} in the quantum setup
echo "Creating quantum static IP..."
SUBNET_ID=`quantum subnet-list | grep ${YOUR_NETWORK_IP} | awk '{print $2}'`
NET_ID=`quantum net-list | grep ${LOCAL_LAN_NAME} | awk '{print $2}'`
quantum port-create --fixed-ip subnet_id=${SUBNET_ID},ip_address=${NFS_SERVER_IP} ${NET_ID}

# Create a new VM using the "boot from volume" option
echo "Booting instance..."
IP_ONE=`quantum port-list | grep ${NFS_SERVER_IP} | awk '{print $2}'`
BLOCK_DEV_ID=`nova volume-list | grep "Wheezy NFS ${VERSION}" | awk '{print $2}'`
nova boot --block_device_mapping vda=${BLOCK_DEV_ID}::5:False --flavor 3 --nic port-id=${IP_ONE} --key-name ${SSH_KEY_NAME} ${MY_HOSTNAME}

echo "All done. You can now wait until your NFS server becomes"
echo "available. Note that it may take a lot of time, since its"
echo "HDD image in Cinder will be resized at the first boot."

+ 47
- 0
examples/nfs-server/customize View File

@@ -0,0 +1,47 @@
#!/bin/sh

set -e

echo "################################"
echo "### SETTING UP CUSTOMIZATION ###"
echo "################################"

set -x

# Fill this with for example: 10.0.0.0/255.255.255.0
# Until you write something in, the script will fail.
AUTHORIZED_NETWORK=""

if [ -z "${AUTHORIZED_NETWORK}" ] ; then
exit 1
fi

mkdir ${BODI_CHROOT_PATH}/nfs

echo "# Number of servers to start up
RPCNFSDCOUNT=8

# Options for rpc.mountd
RPCMOUNTDOPTS=\"-p 2048\"" >${BODI_CHROOT_PATH}/etc/default/nfs-kernel-server

echo "/nfs ${AUTHORIZED_NETWORK}(rw,no_root_squash,subtree_check)" >>${BODI_CHROOT_PATH}/etc/exports

echo "# If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are "yes" and "no".

# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=yes

# Options for rpc.statd.
# Should rpc.statd listen on a specific port? This is especially useful
# when you have a port-based firewall. To use a fixed port, set this
# this variable to a statd argument like: \"--port 4000 --outgoing-port 4001\".
# For more information, see rpc.statd(8) or http://wiki.debian.org/SecuringNFS
STATDOPTS=\"-p 2046 -o 2047\"

# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=

# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=yes " >${BODI_CHROOT_PATH}/etc/default/nfs-common

Loading…
Cancel
Save