|
@ -1,6 +1,10 @@ |
|
|
#!/bin/bash |
|
|
#!/bin/bash |
|
|
# create-cumulus-vx-image.sh V0.1 |
|
|
|
|
|
|
|
|
# create-cumulus-vx-image.sh V0.2 |
|
|
# HS-Fulda - sebastian.rieger@informatik.hs-fulda.de |
|
|
# 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 |
|
|
# usage |
|
|
if [ ! $# -eq 2 ] ; then |
|
|
if [ ! $# -eq 2 ] ; then |
|
@ -23,6 +27,14 @@ GLANCE_IMAGE_RELEASE=$CUMULUS_QCOW2_BASENAME |
|
|
TMP_NAME="CumulusVX-$GLANCE_IMAGE_RELEASE" |
|
|
TMP_NAME="CumulusVX-$GLANCE_IMAGE_RELEASE" |
|
|
TIMESTAMP=$(date +%Y%m%d%H%M%S) |
|
|
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 |
|
|
echo "Creating CumulusVX image..." |
|
|
echo "Creating CumulusVX image..." |
|
|
echo "===========================================================" |
|
|
echo "===========================================================" |
|
@ -53,7 +65,10 @@ chmod +x /virl-config/cumulusvx.sh |
|
|
/virl-config/cumulusvx.sh >/var/log/virl-startup.log |
|
|
/virl-config/cumulusvx.sh >/var/log/virl-startup.log |
|
|
EOF |
|
|
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) |
|
|
# 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 \ |
|
|
--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 |
|
|
--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 |
|
|
echo "Cleaning up..." |
|
|
echo "Cleaning up..." |
|
|
echo "===========================================================" |
|
|
echo "===========================================================" |
|
|