Merge "Avoid uploading trove guest image twice"
This commit is contained in:
commit
3acde946e6
17
lib/trove
17
lib/trove
@ -204,10 +204,21 @@ function init_trove {
|
|||||||
# Initialize the trove database
|
# Initialize the trove database
|
||||||
$TROVE_BIN_DIR/trove-manage db_sync
|
$TROVE_BIN_DIR/trove-manage db_sync
|
||||||
|
|
||||||
# Upload the trove-guest image to glance
|
# If no guest image is specified, skip remaining setup
|
||||||
TROVE_GUEST_IMAGE_ID=$(upload_image $TROVE_GUEST_IMAGE_URL $TOKEN | grep ' id ' | get_field 2)
|
[ -z "$TROVE_GUEST_IMAGE_URL"] && return 0
|
||||||
|
|
||||||
# Initialize appropriate datastores / datastore versions
|
# Find the glance id for the trove guest image
|
||||||
|
# The image is uploaded by stack.sh -- see $IMAGE_URLS handling
|
||||||
|
GUEST_IMAGE_NAME=$(basename "$TROVE_GUEST_IMAGE_URL")
|
||||||
|
GUEST_IMAGE_NAME=${GUEST_IMAGE_NAME%.*}
|
||||||
|
TROVE_GUEST_IMAGE_ID=$(glance --os-auth-token $TOKEN --os-image-url http://$GLANCE_HOSTPORT image-list | grep "${GUEST_IMAGE_NAME}" | get_field 1)
|
||||||
|
if [ -z "$TROVE_GUEST_IMAGE_ID" ]; then
|
||||||
|
# If no glance id is found, skip remaining setup
|
||||||
|
echo "Datastore ${TROVE_DATASTORE_TYPE} will not be created: guest image ${GUEST_IMAGE_NAME} not found."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now that we have the guest image id, initialize appropriate datastores / datastore versions
|
||||||
$TROVE_BIN_DIR/trove-manage datastore_update "$TROVE_DATASTORE_TYPE" ""
|
$TROVE_BIN_DIR/trove-manage datastore_update "$TROVE_DATASTORE_TYPE" ""
|
||||||
$TROVE_BIN_DIR/trove-manage datastore_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
|
$TROVE_BIN_DIR/trove-manage datastore_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
|
||||||
"$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1
|
"$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1
|
||||||
|
2
stackrc
2
stackrc
@ -386,7 +386,7 @@ fi
|
|||||||
# Trove needs a custom image for it's work
|
# Trove needs a custom image for it's work
|
||||||
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
|
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
|
||||||
case "$VIRT_DRIVER" in
|
case "$VIRT_DRIVER" in
|
||||||
libvirt|baremetal|ironic)
|
libvirt|baremetal|ironic|xenapi)
|
||||||
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
|
TROVE_GUEST_IMAGE_URL=${TROVE_GUEST_IMAGE_URL:-"http://tarballs.openstack.org/trove/images/ubuntu_mysql.qcow2/ubuntu_mysql.qcow2"}
|
||||||
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
|
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user