Avoid uploading trove guest image twice

When creating the trove datastore, get the guest image id from glance.
The trove guest image gets uploaded along with all the other
images specified in $IMAGE_URLS. It is not necessary to upload
it again in init_trove.

Also: add xenapi case to stackrc for trove guest image

Closes-Bug: 1339818
Change-Id: I2973af27ab93182fcd674f874daba1036d767d52
This commit is contained in:
Greg Lucas 2014-07-09 13:30:38 -04:00
parent f29569db7a
commit e6aeb5912b
2 changed files with 15 additions and 4 deletions

View File

@ -203,10 +203,21 @@ function init_trove {
# Initialize the trove database
$TROVE_BIN_DIR/trove-manage db_sync
# Upload the trove-guest image to glance
TROVE_GUEST_IMAGE_ID=$(upload_image $TROVE_GUEST_IMAGE_URL $TOKEN | grep ' id ' | get_field 2)
# If no guest image is specified, skip remaining setup
[ -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_version_update "$TROVE_DATASTORE_TYPE" "$TROVE_DATASTORE_VERSION" "$TROVE_DATASTORE_TYPE" \
"$TROVE_GUEST_IMAGE_ID" "$TROVE_DATASTORE_PACKAGE" 1

View File

@ -384,7 +384,7 @@ fi
# Trove needs a custom image for it's work
if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
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"}
IMAGE_URLS+=",${TROVE_GUEST_IMAGE_URL}"
;;