fix trove image addition

the previous addition to trove was done in a way that it was not
possible to discover from nodepool. This fixes our ability to do
that, especially with non-default on services.

Change-Id: I8ca682354e0d4e2eb9cf05f40c6dd783de1c6355
diff --git a/stackrc b/stackrc
index 840f3ac..174049c 100644
--- a/stackrc
+++ b/stackrc
@@ -35,17 +35,19 @@
 #  # Optional, to enable tempest configuration as part of devstack
 #  enable_service tempest
 
-# core compute (glance / keystone / nova (+ nova-network))
-ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
-# cinder
-ENABLED_SERVICES+=,c-sch,c-api,c-vol
-# heat
-ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
-# dashboard
-ENABLED_SERVICES+=,horizon
-# additional services
-ENABLED_SERVICES+=,rabbit,tempest,mysql
-
+# this allows us to pass ENABLED_SERVICES
+if [[ -z "$ENABLED_SERVICES" ]]; then
+    # core compute (glance / keystone / nova (+ nova-network))
+    ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,n-sch,n-novnc,n-xvnc,n-cauth
+    # cinder
+    ENABLED_SERVICES+=,c-sch,c-api,c-vol
+    # heat
+    ENABLED_SERVICES+=,h-eng,h-api,h-api-cfn,h-api-cw
+    # dashboard
+    ENABLED_SERVICES+=,horizon
+    # additional services
+    ENABLED_SERVICES+=,rabbit,tempest,mysql
+fi
 
 # Tell Tempest which services are available.  The default is set here as
 # Tempest falls late in the configuration sequence.  This differs from
@@ -361,6 +363,19 @@
             ;;
     esac
 fi
+
+# Trove needs a custom image for it's work
+if [[ "$ENABLED_SERVICES" =~ 'tr-api' ]]; then
+    case "$VIRT_DRIVER" in
+        libvirt|baremetal|ironic)
+            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}"
+            ;;
+        *)
+            ;;
+    esac
+fi
+
 # Staging Area for New Images, have them here for at least 24hrs for nodepool
 # to cache them otherwise the failure rates in the gate are too high
 PRECACHE_IMAGES=$(trueorfalse False $PRECACHE_IMAGES)