This file is indexed.

/usr/sbin/openstack-deploy-tempest is in openstack-deploy 0.15.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
#!/bin/sh

set -e

export PKGOS_VERBOSE=yes
OSINSTALL_RC=~/osinstallrc
TEMPEST_CONF=/etc/tempest/tempest.conf
# This can be debian or cirros. While it's cool
# to test using the Debian image, it's also a
# quite big image which needs flavor 2 (eg: the
# HDD needs more than 1 GB of space), and it
# takes a while to build it.
TEST_IMAGE_TYPE=cirros
if [ "${TEST_IMAGE_TYPE}" = "debian" ] ; then
	IMAGE_PASS=SupArP4ss
else
	IMAGE_PASS="cubswin:)"
fi

# Default value for parameters:

# Possible values: loopback, presetup
LVMTYPE=loopback

# Device on which we should setup LVM for Cinder use
OTCI_LVM_DEVICE=sda

# URL of the Debian repo to use to create the Debian
# openstack VM image (only useful if the above TEST_IMAGE_TYPE
# is set to debian).
DEBIAN_REPO_PARAM=" -u http://http.debian.net/debian -s http://http.debian.net/debian"

for i in $@ ; do
	case "${1}" in
	"--otci-lvmtype")
		if [ -z "${2}" ] ; then echo "Parameter for option --lvmtype is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
		LVMTYPE="${2}"
		shift
		shift
		;;
	"--otci-lvm-device")
		if [ -z "${2}" ] ; then echo "Parameter for option --lvmtype is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
		OTCI_LVM_DEVICE="${2}"
		shift
		shift
		;;
	"--otci-openstack-debian-images-deb-repo")
		if [ -z "${2}" ] ; then echo "Parameter for option --otci-openstack-debian-images-deb-repo is missing" > /dev/stderr ; DO_EXIT="yes" ; fi
		DEBIAN_REPO_PARAM=" -u ${2} -s ${2}"
		shift
		shift
		;;
	*)
		;;
	esac
done

if [ ${DO_EXIT} = "yes" ] ; then
	echo "Parameters not validated: will exit now!" > /dev/stderr
	exit 1
fi

####################
# INCLUDE OUR LIBS #
####################
if ! [ -r /usr/share/openstack-deploy/preseed-lib ] ; then
	echo "Can't find /usr/share/openstack-deploy/pressed-lib: exiting"
	exit 1
fi
. /usr/share/openstack-deploy/preseed-lib
if ! [ -r /usr/share/openstack-pkg-tools/pkgos_func ] ; then
	echo "Can't find /usr/share/openstack-pkg-tools/pkgos_func: exiting"
	exit 1
fi
. /usr/share/openstack-pkg-tools/pkgos_func

if ! [ -r /etc/default/openstack-proxy-node-network ] ; then
	echo "Can't find /etc/default/openstack-proxy-node-network: exiting"
	exit 1
fi
. /etc/default/openstack-proxy-node-network

if [ -r "${OSINSTALL_RC}" ] ; then
	. ${OSINSTALL_RC}
else
	echo "Cannot find ${OSINSTALL_RC}: exiting..."
	exit 1
fi

if [ -r ~/openrc.sh ] ; then
	. ~/openrc.sh
else
	echo "Cannot find openrc.sh: exiting..."
	exit 1
fi

#################################
# DEFINE SOME UTILITY FUNCTIONS #
#################################
osinstall_check_installed () {
	local PKG_NAME
	PKG_NAME=${1}
	INSTALL_STRING=`dpkg -l ${PKG_NAME} | grep ^ii | awk '{print $2}'`
	if [ "${INSTALL_STRING}" = ${PKG_NAME} ] ; then
		return 0
	else
		return 1
	fi
}

osinstall_install_if_not_installed () {
	local PKG_NAME
	PKG_NAME=${1}
	if ! osinstall_check_installed ${PKG_NAME} ; then
		DEBIAN_FRONTEND=noninteractive ${APTGET} install ${PKG_NAME}
	fi
}

deploy_tempest_install_pkgs () {
	echo "===> Installing tempest and openstack-debian-images"
	osinstall_install_if_not_installed tempest
	cp /usr/share/openstack-deploy/tempest_exclude.conf /etc/tempest/exclude.conf
	osinstall_install_if_not_installed openstack-debian-images
	osinstall_install_if_not_installed openstack-clients
}

build_and_upload_image () {
	# Even if we don't use the Cirros image for tests, we need it
	# because there's some Cinder tests that are expecting the image
	# to be in there.
	# Download the Cirros image
	CIRROS_VERSION=0.3.1
	mkdir -p /opt/stack/new/devstack/files/images/cirros-${CIRROS_VERSION}-x86_64-uec
	wget http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz
	tar -C /opt/stack/new/devstack/files/images/cirros-${CIRROS_VERSION}-x86_64-uec -xvzf cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz
	rm cirros-${CIRROS_VERSION}-x86_64-uec.tar.gz


	AUTH_TOKEN=${RC_KEYSTONE_AUTHTOKEN}

	if [ "${TEST_IMAGE_TYPE}" = debian ] ; then
		echo "===> Creating Debian image"
		build-openstack-debian-image -r jessie -p ${IMAGE_PASS} ${DEBIAN_REPO_PARAM}
		IMAGE_PATH=`ls *.qcow2`
		echo "===> Uploading image to Glance"
		IMAGE_REF=`pkgos_get_id glance image-create --name foo --disk-format=qcow2 --container-format=bare --visibility public --file=${IMAGE_PATH}`
	else
		echo "===> Download the Cirros image"
		IMAGE_PATH=/opt/stack/new/devstack/files/images/cirros-${CIRROS_VERSION}-x86_64-disk.img
		wget http://download.cirros-cloud.net/${CIRROS_VERSION}/cirros-${CIRROS_VERSION}-x86_64-disk.img -O ${IMAGE_PATH}
		IMAGE_REF=`pkgos_get_id glance image-create --name foo --disk-format=qcow2 --container-format=bare --visibility public --file=${IMAGE_PATH}`
	fi
}

create_non_admin_keystone_user () {
	openstack project create testme
	openstack user create --password testme --project testme --email root@localhost --enable testme
	openstack project create testme2
	openstack user create --password testme2 --project testme2 --email root@localhost --enable testme2
}

fix_tempest_config () {
	echo "===> Fixing tempest.conf"
	# [identity]
	pkgos_inifile set ${TEMPEST_CONF} identity uri http://${DEFROUTE_IP}:35357/v2.0
	pkgos_inifile set ${TEMPEST_CONF} identity uri_v3 http://${DEFROUTE_IP}:35357/v3

	# [application_catalog]
	pkgos_inifile set ${TEMPEST_CONF} application_catalog region regionOne

	# [auth]
	pkgos_inifile set ${TEMPEST_CONF} auth admin_project_name admin
	pkgos_inifile set ${TEMPEST_CONF} auth admin_password ${RC_KEYSTONE_ADMINPASS}

	# [compute]
	pkgos_inifile set ${TEMPEST_CONF} compute image_ref ${IMAGE_REF}
	pkgos_inifile set ${TEMPEST_CONF} compute image_ref_alt ${IMAGE_REF}
	if [ "${TEST_IMAGE_TYPE}" = debian ] ; then
		pkgos_inifile set ${TEMPEST_CONF} validation image_ssh_user debian
	else
		pkgos_inifile set ${TEMPEST_CONF} validation image_ssh_user cirros
	fi
	pkgos_inifile set ${TEMPEST_CONF} validation image_ssh_password ${IMAGE_PASS}
	pkgos_inifile set ${TEMPEST_CONF} validation network_for_ssh ext-net
	pkgos_inifile set ${TEMPEST_CONF} compute fixed_network_name demo-net

	pkgos_inifile set ${TEMPEST_CONF} compute-feature-enabled spice_console true
	pkgos_inifile set ${TEMPEST_CONF} compute-feature-enabled allow_duplicate_networks true

	# [dashboard]
	pkgos_inifile set ${TEMPEST_CONF} dashboard dashboard_url http://${DEFROUTE_IP}/

	# [network]
	pkgos_inifile set ${TEMPEST_CONF} network tenant_network_cidr ${TENANT_NET_CIDR}
	PUBLIC_NETWORK_ID=`pkgos_get_id neutron net-show ext-net`
	pkgos_inifile set ${TEMPEST_CONF} network public_network_id ${PUBLIC_NETWORK_ID}
# We shouldn't do this. Doing it fails all tests
#	PUBLIC_ROUTER_ID=`pkgos_get_id neutron router-show demo-router`
#	pkgos_inifile set ${TEMPEST_CONF} network public_router_id ${PUBLIC_ROUTER_ID}

	pkgos_inifile set ${TEMPEST_CONF} network default_network 192.168.64.0/20

	pkgos_inifile set ${TEMPEST_CONF} network tenant_network_v6_cidr 2403:cc00:1000:8888:200:20ff:fe01:8402/64

	# [orchestration]
	pkgos_inifile set ${TEMPEST_CONF} orchestration instance_type m1.small
	pkgos_inifile set ${TEMPEST_CONF} orchestration keypair_name odtkey

	# [service_available]
#	pkgos_inifile set ${TEMPEST_CONF} service_available zaqar false
	pkgos_inifile set ${TEMPEST_CONF} service_available swift true
	pkgos_inifile set ${TEMPEST_CONF} service_available ceilometer true
	pkgos_inifile set ${TEMPEST_CONF} service_available horizon true
#	pkgos_inifile set ${TEMPEST_CONF} service_available ironic false
	pkgos_inifile set ${TEMPEST_CONF} service_available nova true
	pkgos_inifile set ${TEMPEST_CONF} service_available cinder true
#	pkgos_inifile set ${TEMPEST_CONF} service_available trove false
	pkgos_inifile set ${TEMPEST_CONF} service_available heat true
	pkgos_inifile set ${TEMPEST_CONF} service_available aodh true
#	pkgos_inifile set ${TEMPEST_CONF} service_available sahara false
	pkgos_inifile set ${TEMPEST_CONF} service_available glance true
	pkgos_inifile set ${TEMPEST_CONF} service_available neutron true
}

gen_ssh_root_key () {
	ssh-keygen -t rsa -N "" -f .ssh/id_rsa
	nova keypair-add --pub-key .ssh/id_rsa.pub odtkey
}

setup_loopback_based_lvm_vg () {
	echo "===> Creating a 40 GB loopback file used as LVM"
	## Create a 10GB file on the root
	#dd if=/dev/zero of=/lvm-data.dat count=20971520
	# Create a 40GB file on the root
	#dd if=/dev/zero of=/lvm-data.dat count=83886080 sparse
	qemu-img create /lvm-data.dat 40G
	# Setup the loopback device
	losetup /dev/loop0 /lvm-data.dat
	# Create the PV
	pvcreate /dev/loop0
	# Create the VG
	vgcreate pkgosvg0 /dev/loop0
	# Activate the pkgosvg0
	vgchange -a y pkgosvg0
	echo "Done!"
}

setup_real_hdd_based_lvm_vg () {
	echo "===> Creating new volume group on device ${OTCI_LVM_DEVICE} (will destroy everything there...)"
	parted /dev/${OTCI_LVM_DEVICE} mklabel msdos -s
	parted /dev/${OTCI_LVM_DEVICE} mkpart primary ext4 -a optimal 2048 48G
	parted /dev/${OTCI_LVM_DEVICE} set 1 lvm on
	pvcreate /dev/${OTCI_LVM_DEVICE}1 -ff -y
	vgcreate pkgosvg0 /dev/${OTCI_LVM_DEVICE}1
	vgchange -a y pkgosvg0
	echo "Done!"
}

setup_loopback_based_swift () {
	### NOTE: this comes from http://docs.openstack.org/developer/swift/development_saio.html ###
	echo "===> Installing Swift and xfsprogs"
	DEBIAN_FRONTEND=noninteractive ${APTGET} install swift swift-proxy swift-account swift-container swift-object swift-object-expirer xfsprogs

	if [ "${LVMTYPE}" = "loopback" ] ; then
		echo "===> Creating swift HDDs using a 20 GB loopback file at /srv/swift-disk"
		# Create the loopback device
		mkdir -p /srv
		qemu-img create /srv/swift-disk 20G
		mkfs.xfs /srv/swift-disk

		# Mount it
		mkdir /mnt/sdb1
		echo "/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0" >>/etc/fstab
		mount /mnt/sdb1
	elif [ "${LVMTYPE}" = "resetup" ] ; then
		echo "===> Creating swift HDDs using a 48GB file on /dev/${OTCI_LVM_DEVICE}2"
		mkdir -p /srv

		# Create the partition and the FS
		parted /dev/${OTCI_LVM_DEVICE} mkpart primary xfs -a optimal 48G 96G
		sleep 5
		mkfs.xfs /dev/${OTCI_LVM_DEVICE}2 -f

		# Mount it
		mkdir /mnt/sdb1
		echo "/dev/${OTCI_LVM_DEVICE}2 /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0" >>/etc/fstab
		mount /mnt/sdb1
	fi

	echo "===> Configuring Swift & rsync"
	# Setup swift disks
	mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
	chown swift:swift /mnt/sdb1/*
	for x in `seq 1 4`; do ln -s /mnt/sdb1/$x /srv/$x; done
	mkdir -p /srv/1/node/sdb1 /srv/1/node/sdb5 \
		/srv/2/node/sdb2 /srv/2/node/sdb6 \
		/srv/3/node/sdb3 /srv/3/node/sdb7 \
		/srv/4/node/sdb4 /srv/4/node/sdb8 \
		/var/run/swift
	chown -R swift:swift /var/run/swift
	# **Make sure to include the trailing slash after /srv/$x/**
	for x in `seq 1 4`; do chown -R swift:swift /srv/$x/; done

	# Common Post-Device Setup
	mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
	chown swift:swift /var/cache/swift*

	# Enable rsyncd for swift
	cp /usr/share/openstack-deploy/saio/rsyncd.conf /etc
	sed -i s/RSYNC_ENABLE=false/RSYNC_ENABLE=true/ /etc/default/rsync
	service rsync restart

	# Copy the saio config files for swift
	rm -rf /etc/swift/
	mkdir -p /etc/swift/
	cp -rfv /usr/share/openstack-deploy/saio/swift/* /etc/swift/
	chown -R swift:swift /etc/swift

	# Customize the config (ie: keystone authtoken)
	pkgos_inifile set /etc/swift/proxy-server.conf filter:authtoken admin_password ${RC_KEYSTONE_ADMINPASS}
	pkgos_inifile set /etc/swift/proxy-server.conf filter:authtoken identity_uri http://${DEFROUTE_IP}:35357/
	pkgos_inifile set /etc/swift/proxy-server.conf filter:authtoken auth_uri http://${DEFROUTE_IP}:5000/
	pkgos_inifile set /etc/swift/proxy-server.conf filter:authtoken auth_url http://${DEFROUTE_IP}:5000/

	# Create the swift ring
	chmod +x /usr/share/openstack-deploy/saio/bin/remakerings
	/usr/share/openstack-deploy/saio/bin/remakerings

	# Restart swift after the config is good
	for i in `ls /etc/init.d/swift-*` ; do $i stop ; done
	for i in `ls /etc/init.d/swift-*` ; do $i start ; done

	echo "===> Creating swift endpoints in Keystone catalog"
	# Setup the endpoint
	openstack --os-identity-api-version=3 service create --description "OpenStack Object Storage" --name swift object-store
	openstack --os-identity-api-version=3 endpoint create --region regionOne swift public http://${DEFROUTE_IP}:8080/v1/AUTH_%\(tenant_id\)s
	openstack --os-identity-api-version=3 endpoint create --region regionOne swift admin http://${DEFROUTE_IP}:8080/v1/AUTH_%\(tenant_id\)s
	openstack --os-identity-api-version=3 endpoint create --region regionOne swift internal http://${DEFROUTE_IP}:8080/v1/AUTH_%\(tenant_id\)s
	#openstack --os-domain-name default --os-identity-api-version=3 endpoint create --publicurl http://${DEFROUTE_IP}:8080/v1/AUTH_%\(tenant_id\)s --adminurl http://${DEFROUTE_IP}:8080/ --internalurl http://${DEFROUTE_IP}:8080/v1/AUTH_%\(tenant_id\)s --region regionOne swift
}

install_cinder () {
	# At this point in time, cinder should already be preseeded by openstack-deploy,
	# so just installing it this way should be fine
	DEBIAN_FRONTEND=noninteractive ${APTGET} install cinder-api cinder-volume python-cinderclient cinder-backup cinder-scheduler
	if [ -x /usr/bin/lsb_release ] && [ `lsb_release -a | grep Codename | awk '{print $2}'` = "wheezy" ] ; then
		DEBIAN_FRONTEND=noninteractive ${APTGET} install -t wheezy-backports tgt || true
	else
		DEBIAN_FRONTEND=noninteractive ${APTGET} install tgt || true
	fi
	# Set configuration for swift-backup (normally not needed...)
	#pkgos_inifile set /etc/cinder/cinder.conf backup_swift_tenant admin
	#pkgos_inifile set /etc/cinder/cinder.conf backup_swift_user admin
	#pkgos_inifile set /etc/cinder/cinder.conf backup_swift_key admin
}

restart_swift_again () {
	echo "===> Stopping swift..."
	for i in /etc/init.d/swift* ; do $i stop ; done
	echo "===> Waiting 5 seconds..."
	sleep 5
	echo "===> Starting swift..."
	for i in /etc/init.d/swift* ; do $i start ; done
}

# Param: $1 = name
#        $2 = ram
#        $3 = disk
#        $4 = vcpus
create_flavor_if_not_exists () {
	RET=$(openstack flavor list --format=csv | q -d , -H 'SELECT ID FROM - WHERE `Name`="'${1}'"' 2>/dev/null)
	if [ -z "${RET}" ] ; then
		openstack flavor create --ram ${2} --disk ${3} --vcpus ${4} ${1}
	RET=$(openstack flavor list --format=csv | q -d , -H 'SELECT ID FROM - WHERE `Name`="'${1}'"')
	fi
}

set_nova_flavors () {
	create_flavor_if_not_exists m1.tiny    512  1 1
	M1_TINY_FLID=$RET
	create_flavor_if_not_exists m1.small  2048 20 1
	M1_SMALL_FLID=$RET
	create_flavor_if_not_exists m1.medium 4096 40 2
	M1_MEDIUM_FLID=$RET
	create_flavor_if_not_exists m1.large  8192 80 4
	M1_LARGE_FLID=$RET

	pkgos_inifile set ${TEMPEST_CONF} compute flavor_ref ${M1_TINY_FLID}
	pkgos_inifile set ${TEMPEST_CONF} compute flavor_ref_alt ${M1_SMALL_FLID}
}

prepare_node_for_trove () {
	openstack project create trove_for_trove_usage
	openstack user create --password trove --project trove_for_trove_usage --email root@localhost --enable regular_trove_user
	openstack user create --password trove --project trove_for_trove_usage --email root@localhost --enable admin_trove_user
	openstack role add --user admin_trove_user --project trove_for_trove_usage admin

	# TODO: fix this by packaging rabbitmqadmin within the rabbitmq-server package.
	# This is already commited to git on Alioth, though a backport should be done.
	echo "===> Downloading rabbitmqadmin to declare queues and exchanges"
	wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/rabbitmq_v3_6_0/bin/rabbitmqadmin -O /usr/bin/rabbitmqadmin
	chmod +x /usr/bin/rabbitmqadmin

	# The management is needed for rabbitmqadmin to work
	rabbitmq-plugins enable rabbitmq_management
	# Restarting is necessary to enable plugins
	invoke-rc.d rabbitmq-server restart
	# Add a new user to the rabbitmq for trove to use
	rabbitmqctl add_user trove trove
	# Set it as admin
	rabbitmqctl set_user_tags trove administrator
	# Set permissions
	rabbitmqadmin --username=trove --password=trove --host=localhost declare permission vhost=/ user=trove configure='.*' write='.*' read='.*'
	# Declare the exchange
	rabbitmqadmin --username=trove --password=trove --host=localhost declare exchange name=trove type=topic durable=true

	echo "#!/bin/sh

set -e
set -x

. /etc/pkgos/pkgos.conf
. /root/osinstallrc

APTGET=\"apt-get -o Dpkg::Options::=--force-confnew --force-yes -y\"

cp /etc/apt/sources.list.d/openstack.list \${BODI_CHROOT_PATH}/etc/apt/sources.list.d
echo \"#!/bin/sh
exit 101
\" >\${BODI_CHROOT_PATH}/usr/sbin/policy-rc.d
chmod +x \${BODI_CHROOT_PATH}/usr/sbin/policy-rc.d

chroot \${BODI_CHROOT_PATH} \${APTGET} update
chroot \${BODI_CHROOT_PATH} \${APTGET} install \${TARGET_OPENSTACK_REL}-\${TARGET_DISTRO}-archive-keyring
chroot \${BODI_CHROOT_PATH} \${APTGET} update

echo \"\${RC_MYSQL_SERVER_PKG_NAME} mysql-server/root_password password \${RC_MYSQL_PASSWORD}
\${RC_MYSQL_SERVER_PKG_NAME} mysql-server/root_password seen true
\${RC_MYSQL_SERVER_PKG_NAME} mysql-server/root_password_again password \${RC_MYSQL_PASSWORD}
\${RC_MYSQL_SERVER_PKG_NAME} mysql-server/root_password_again seen true
\" >\${BODI_CHROOT_PATH}/root/mysql-password-preseed
chroot \${BODI_CHROOT_PATH} debconf-set-selections /root/mysql-password-preseed
rm \${BODI_CHROOT_PATH}/root/mysql-password-preseed

DEBIAN_FRONTEND=noninteractive chroot \${BODI_CHROOT_PATH} \${APTGET} install -y trove-guestagent heat-cfntools mysql-server-5.5 percona-xtrabackup
rm \${BODI_CHROOT_PATH}/usr/sbin/policy-rc.d
mkdir -p \${BODI_CHROOT_PATH}/root/.ssh
cp /root/.ssh/id_rsa.pub \${BODI_CHROOT_PATH}/root/.ssh/authorized_keys
cp /root/.ssh/id_rsa.pub \${BODI_CHROOT_PATH}/root/.ssh/authorized_keys2
" >/root/trove-hook

pkgos-fix-config-default /etc/trove/trove-guestagent.conf oslo_messaging_rabbit rabbit_host ${RC_KEYSTONE_ENDPOINT_IP}
pkgos-fix-config-default /etc/trove/trove-guestagent.conf oslo_messaging_rabbit rabbit_userid trove
pkgos-fix-config-default /etc/trove/trove-guestagent.conf oslo_messaging_rabbit rabbit_password trove
pkgos-fix-config-default /etc/trove/trove-guestagent.conf DEFAULT swift_url http://${RC_KEYSTONE_ENDPOINT_IP}:8080/v1/AUTH_
pkgos-fix-config-default /etc/trove/trove-guestagent.conf DEFAULT os_region_name regionOne
pkgos-fix-config-default /etc/trove/trove-guestagent.conf DEFAULT swift_service_type object-store
pkgos-fix-config-default /etc/trove/trove-guestagent.conf DEFAULT trove_auth_url http://${RC_KEYSTONE_ENDPOINT_IP}:5000/v2.0
	chmod +x /root/trove-hook
	build-openstack-debian-image -r jessie --hook-script /root/trove-hook -p trovepass -u ${DEBIAN_REPO_PARAM} -s ${DEBIAN_REPO_PARAM}

#trove-manage datastore_update mysql ""
#trove-manage datastore_version_update mysql 5.5 mysql aefce61e-af5a-4139-8f38-e7a32207a329 mysql-server-5.5 1
#trove-manage datastore_update mysql 5.5

	glance --os-username admin_trove_user --os-password trove --os-project-name trove_for_trove_usage image-create --name trove-image --visibility public --container-format ovf --disk-format qcow2 --owner admin_trove_user --file debian-jessie-8.0.0-1-amd64.qcow2

	echo "#cloud-config
packages:
- trove-guestagent
- mysql-server-5.5

# config file for trove guestagent
write_files:
- path: /etc/trove/trove-guestagent.conf
  content: |
rabbit_host = ${RC_KEYSTONE_ENDPOINT_IP}
rabbit_password = trove
rabbit_userid = trove

" >/etc/trove/cloudinit/mysql.cloudinit
}

deploy_tempest_install_pkgs
create_non_admin_keystone_user
build_and_upload_image
fix_tempest_config
gen_ssh_root_key
if [ "${LVMTYPE}" = "loopback" ] ; then
	setup_loopback_based_lvm_vg
elif [ "${LVMTYPE}" = "resetup" ] ; then
	setup_real_hdd_based_lvm_vg
fi
setup_loopback_based_swift
install_cinder
restart_swift_again
set_nova_flavors
#prepare_node_for_trove