Skip to content
Snippets Groups Projects
Commit 419b4cb7 authored by Sebastian Rieger's avatar Sebastian Rieger
Browse files

added handling of existing image and creation of default flavor

parent ca958307
Branches
No related tags found
No related merge requests found
#!/bin/bash
# create-cumulus-vx-image.sh V0.1
# create-cumulus-vx-image.sh V0.2
# HS-Fulda - sebastian.rieger@informatik.hs-fulda.de
#
# changelog:
#
# V0.2 - added support to delete existing image with the same name and generating the default nova flavor
# usage
if [ ! $# -eq 2 ] ; then
......@@ -23,6 +27,14 @@ GLANCE_IMAGE_RELEASE=$CUMULUS_QCOW2_BASENAME
TMP_NAME="CumulusVX-$GLANCE_IMAGE_RELEASE"
TIMESTAMP=$(date +%Y%m%d%H%M%S)
CHECK_FOR_EXISTING_IMAGE=$(glance image-show CumulusVX | grep name | grep CumulusVX)
if [ $? == 0 ]; then
echo "Deleting existing image $2..."
echo "==========================================================="
glance image-delete $2
fi
echo
echo "Creating CumulusVX image..."
echo "==========================================================="
......@@ -53,7 +65,10 @@ chmod +x /virl-config/cumulusvx.sh
/virl-config/cumulusvx.sh >/var/log/virl-startup.log
EOF
bash
#DEBUG:
# run bash to allow manual changes to the image before packing
#
#bash
# inject script to handle dhcp for eth0 and import of config defined in VM Maestro (config-drive)
......@@ -74,6 +89,15 @@ glance image-create --container-format bare --disk-format qcow2 --is-public true
--file $CUMULUS_PATCHED_QCOW2 --property hw_disk_bus=ide --property serial=1 \
--property hw_vif_model=e1000 --property hw_cdrom_type=ide --property release="$GLANCE_IMAGE_RELEASE" --property subtype=CumulusVX --property config_disk_type=disk
# create flavor
CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show CumulusVX.small | grep name | grep CumulusVX.small)
if [ $? == 1 ]; then
echo "Creating default flavor CumulusVX.small..."
echo "==========================================================="
nova flavor-create --is-public true CumulusVX.small auto 256 0 1
fi
echo
echo "Cleaning up..."
echo "==========================================================="
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment