summaryrefslogtreecommitdiff
path: root/devstack
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-04-07 00:27:15 +1300
committerLingxian Kong <anlin.kong@gmail.com>2019-04-10 09:29:40 +1200
commit798af4d02a089ac2dd29b4d66fcd47186fb7342b (patch)
treeba998608aca61046882402e9131cff590999cf09 /devstack
parentfc1c2465167acf52c1d210aa1e634a34d10bc07e (diff)
downloadtrove-798af4d02a089ac2dd29b4d66fcd47186fb7342b.tar.gz
Improve trove guest agent image building
- Add a new element 'guest-agent' for image building. This element is used when dev_mode=false, so that the trove code is downloaded into the image during the building phase rather than during the guest agent initialization. - Improve trovestack sub-command 'build-image'. ./trovestack build-image ${datastore_type} \ ${guest_os} \ ${guest_release} \ ${dev_mode} - Improve documentation. Story: #2005387 Task: #30375 Change-Id: I9d7acbd6a97f8c01b48b0f2cf94398d549d89124
Diffstat (limited to 'devstack')
-rw-r--r--devstack/plugin.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/devstack/plugin.sh b/devstack/plugin.sh
index 8f7f3bcb..5c545c15 100644
--- a/devstack/plugin.sh
+++ b/devstack/plugin.sh
@@ -631,6 +631,8 @@ function _setup_minimal_image {
if [ -d ${SSH_DIR} ]; then
cat ${SSH_DIR}/id_rsa.pub >> ${SSH_DIR}/authorized_keys
+ sort ${SSH_DIR}/authorized_keys | uniq > ${SSH_DIR}/authorized_keys.uniq
+ mv ${SSH_DIR}/authorized_keys.uniq ${SSH_DIR}/authorized_keys
else
mkdir -p ${SSH_DIR}
/usr/bin/ssh-keygen -f ${SSH_DIR}/id_rsa -q -N ""
@@ -638,6 +640,13 @@ function _setup_minimal_image {
chmod 600 ${SSH_DIR}/authorized_keys
fi
+ # Make sure the guest agent has permission to ssh into the devstack host
+ # in order to download trove code during the service initialization.
+ home_keys=$HOME/.ssh/authorized_keys
+ cat ${SSH_DIR}/id_rsa.pub >> ${home_keys}
+ sort ${home_keys} | uniq > ${home_keys}.uniq
+ mv ${home_keys}.uniq ${home_keys}
+
echo "Run disk image create to actually create a new image"
disk-image-create -a amd64 -o "${VM}" -x ${QEMU_IMG_OPTIONS} ${DISTRO} \
vm cloud-init-datasources ${DISTRO}-guest ${DISTRO}-${RELEASE}-guest \
@@ -723,6 +732,10 @@ if is_service_enabled trove; then
# Start the trove API and trove taskmgr components
echo_summary "Starting Trove"
start_trove
+
+ # Guarantee the file permission in the trove code repo in order to
+ # download trove code from trove-guestagent.
+ sudo chown -R $STACK_USER:$STACK_USER "$DEST/trove"
elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
echo_summary "Configuring Tempest for Trove"
configure_tempest_for_trove