7d458408c3
Add missing steps during the creation of the database instance. Include outputs expected from dmesg. Change-Id: Id3463d7c7d952ebac947cd35e4f2d0b674c5c379
38 lines
956 B
Python
38 lines
956 B
Python
# step-1
|
|
import shade
|
|
|
|
conn = shade.openstack_cloud(cloud='myfavoriteopenstack')
|
|
|
|
# step-2
|
|
volume = conn.create_volume(size=1, display_name='test')
|
|
|
|
# step-3
|
|
volumes = conn.list_volumes()
|
|
for vol in volumes:
|
|
print(vol)
|
|
|
|
# step-4
|
|
db_group = conn.create_security_group('database', 'for database service')
|
|
conn.create_security_group_rule(db_group['name'], 22, 22, 'TCP')
|
|
conn.create_security_group_rule(db_group['name'], 3306, 3306, 'TCP')
|
|
|
|
userdata = '''#!/usr/bin/env bash
|
|
curl -L -s http://git.openstack.org/cgit/openstack/faafo/plain/contrib/install.sh | bash -s -- \
|
|
-i database -i messaging
|
|
'''
|
|
|
|
instance = conn.create_server(wait=True, auto_ip=False,
|
|
name='app-database',
|
|
image=image_id,
|
|
flavor=flavor_id,
|
|
key_name='demokey',
|
|
security_groups=[db_group['name']],
|
|
userdata=userdata)
|
|
|
|
# step-5
|
|
conn.attach_volume(instance, volume, '/dev/vdb')
|
|
|
|
# step-6
|
|
conn.detach_volume(instance, volume)
|
|
conn.delete_volume(volume['id'])
|