Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
slapos
Commits
3f3a78a1
Commit
3f3a78a1
authored
Oct 02, 2013
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Redeploy Openstack Controller Grizzly with quantum
parent
ef4c8b23
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
932 additions
and
30 deletions
+932
-30
software/openstack/instance-main.cfg
software/openstack/instance-main.cfg
+15
-5
software/openstack/software.cfg
software/openstack/software.cfg
+45
-16
software/openstack/templates/keystone_basic.sh
software/openstack/templates/keystone_basic.sh
+61
-0
software/openstack/templates/keystone_endpoints_basic.sh
software/openstack/templates/keystone_endpoints_basic.sh
+138
-0
software/openstack/templates/network.py
software/openstack/templates/network.py
+24
-0
software/openstack/templates/openstack-install.sh.in
software/openstack/templates/openstack-install.sh.in
+1
-2
software/openstack/templates/ssh-configure.py.in
software/openstack/templates/ssh-configure.py.in
+20
-7
software/openstack/templates/stack_controller_grizzly.sh.in
software/openstack/templates/stack_controller_grizzly.sh.in
+628
-0
No files found.
software/openstack/instance-main.cfg
View file @
3f3a78a1
...
@@ -111,16 +111,19 @@ shell-path = ${dash:location}/bin/dash
...
@@ -111,16 +111,19 @@ shell-path = ${dash:location}/bin/dash
[install-script]
[install-script]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${openstack-
install:location}/${openstack-install
:filename}
url = ${openstack-
grizzly:location}/${openstack-grizzly
:filename}
output = $${directory:nova}/
openstack_install
.sh
output = $${directory:nova}/
stack_controller_grizzly
.sh
mode = 0700
mode = 0700
nova-url = https://github.com/openstack-dev/devstack.git
#nova-url = https://github.com/openstack-dev/devstack.git
image-url = $${slap-parameter:glance-image-url}
image-name = $${slap-parameter:glance-image-name}
slap-ipv4 = $${slap-network-information:local-ipv4}
slap-ipv4 = $${slap-network-information:local-ipv4}
nova-passwd = $${master-passwd:passwd}
nova-passwd = $${master-passwd:passwd}
nova-user = $${slap-parameter:system-user}
nova-user = $${slap-parameter:system-user}
vnc-url = $${request-openstack-vnc-frontend:connection-url}
vnc-url = $${request-openstack-vnc-frontend:connection-url}
devstack-revision = $${slap-parameter:devstack-revision}
project = $${slap-parameter:project}
user-name = $${slap-parameter:user-name}
[nova-conf-run]
[nova-conf-run]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
...
@@ -133,6 +136,9 @@ ssh-port = $${tunnel-ipv6-ssh:ipv6-port}
...
@@ -133,6 +136,9 @@ ssh-port = $${tunnel-ipv6-ssh:ipv6-port}
system-user = $${slap-parameter:system-user}
system-user = $${slap-parameter:system-user}
system-passwd = $${slap-parameter:system-passwd}
system-passwd = $${slap-parameter:system-passwd}
nova-configure = $${install-script:output}
nova-configure = $${install-script:output}
keystone-endpoints-script = ${openstack-keystone-endpoints-script:location}/${openstack-keystone-endpoints-script:filename}
keystone-script = ${openstack-keystone-script:location}/${openstack-keystone-script:filename}
floating-ip-generate = ${network-floating-ip-generate:location}/${network-floating-ip-generate:filename}
nova-result = $${directory:log}
nova-result = $${directory:log}
python_path = ${buildout:executable}
python_path = ${buildout:executable}
eggs-dir = ${buildout:eggs-directory}
eggs-dir = ${buildout:eggs-directory}
...
@@ -315,10 +321,14 @@ nbd2-host =
...
@@ -315,10 +321,14 @@ nbd2-host =
system-user = stack
system-user = stack
system-passwd = openstack
system-passwd = openstack
project = slapos
user-name = slapos
glance-image-url = http://download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img
glance-image-name = cirros-0.3.1-x86_64
domain =
domain =
virtual-hard-drive-url =
virtual-hard-drive-url =
virtual-hard-drive-md5sum =
virtual-hard-drive-md5sum =
#Using devstack to auto install openstack. We just specify here the commit to use
#Using devstack to auto install openstack. We just specify here the commit to use
devstack-revision = 0b29d86930fb9ba00dbb8e593b0a9fcee3559810
#devstack-revision =
\ No newline at end of file
\ No newline at end of file
software/openstack/software.cfg
View file @
3f3a78a1
...
@@ -35,7 +35,7 @@ eggs =
...
@@ -35,7 +35,7 @@ eggs =
[template-openstack-main]
[template-openstack-main]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-main.cfg
url = ${:_profile_base_location_}/instance-main.cfg
md5sum =
96147d4052fac19fe9a6a72ecc1233ad
md5sum =
bf86f17749961de846ef191bf96c8ad1
output = ${buildout:directory}/template-openstack-main.cfg
output = ${buildout:directory}/template-openstack-main.cfg
mode = 0644
mode = 0644
...
@@ -67,12 +67,32 @@ md5sum = 136339c0d704bb11af3839726e24c47f
...
@@ -67,12 +67,32 @@ md5sum = 136339c0d704bb11af3839726e24c47f
[compute-script-run]
[compute-script-run]
<= template-download
<= template-download
filename = ssh-configure.py.in
filename = ssh-configure.py.in
md5sum = e10b3796e028b65465a05b6a0c6f9762
md5sum = 2a4f82db89a01ed0866682a30bce185b
[network-floating-ip-generate]
<= template-download
filename = network.py
#md5sum =
[openstack-install]
[openstack-install]
<= template-download
<= template-download
filename = openstack-install.sh.in
filename = openstack-install.sh.in
md5sum = 1094a575e8bf577b1ed5f2ab91556b1b
md5sum = 5cd174f8e94f5d975d7940ac65d8e9f4
[openstack-grizzly]
<= template-download
filename = stack_controller_grizzly.sh.in
#md5sum =
[openstack-keystone-script]
<= template-download
filename = keystone_basic.sh
#md5sum =
[openstack-keystone-endpoints-script]
<= template-download
filename = keystone_endpoints_basic.sh
#md5sum =
[slapos.cookbook-repository]
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
recipe = slapos.recipe.build:gitclone
...
@@ -137,39 +157,44 @@ signature-certificate-list =
...
@@ -137,39 +157,44 @@ signature-certificate-list =
Jinja2 = 2.7.1
Jinja2 = 2.7.1
MarkupSafe = 0.18
MarkupSafe = 0.18
Werkzeug = 0.9.4
Werkzeug = 0.9.4
apache-libcloud = 0.13.
1
apache-libcloud = 0.13.
2
async = 0.6.1
async = 0.6.1
buildout-versions = 1.7
buildout-versions = 1.7
gitdb = 0.5.4
gitdb = 0.5.4
itsdangerous = 0.23
itsdangerous = 0.23
lxml = 3.2.3
lxml = 3.2.3
meld3 = 0.6.10
meld3 = 0.6.10
paramiko = 1.11.0
paramiko = 1.12.0
plone.recipe.command = 1.1
pycrypto = 2.6
pycrypto = 2.6
slapos.recipe.build = 0.12
slapos.recipe.build = 0.12
slapos.recipe.cmmi = 0.2
slapos.recipe.cmmi = 0.2
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.5
slapos.recipe.template = 2.5
slapos.toolbox = 0.3
6
slapos.toolbox = 0.3
7
smmap = 0.8.2
smmap = 0.8.2
websockify = 0.5.1
websockify = 0.5.1
z3c.recipe.scripts = 1.0.1
z3c.recipe.scripts = 1.0.1
# Required by:
# Required by:
# slapos.core==0.35.1
# slapos.core==0.35.1
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
Flask = 0.10.1
Flask = 0.10.1
# Required by:
# Required by:
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
GitPython = 0.3.2.RC1
GitPython = 0.3.2.RC1
# Required by:
# Required by:
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
atomize = 0.1.1
atomize = 0.1.1
# Required by:
# Required by:
# slapos.toolbox==0.36
# paramiko==1.12.0
ecdsa = 0.9
# Required by:
# slapos.toolbox==0.37
feedparser = 5.1.3
feedparser = 5.1.3
# Required by:
# Required by:
...
@@ -193,8 +218,8 @@ netifaces = 0.8-1
...
@@ -193,8 +218,8 @@ netifaces = 0.8-1
numpy = 1.7.1
numpy = 1.7.1
# Required by:
# Required by:
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
psutil = 1.
0.1
psutil = 1.
1.0
# Required by:
# Required by:
# slapos.core==0.35.1
# slapos.core==0.35.1
...
@@ -202,11 +227,11 @@ pyflakes = 0.7.3
...
@@ -202,11 +227,11 @@ pyflakes = 0.7.3
# Required by:
# Required by:
# slapos.cookbook==0.83.1
# slapos.cookbook==0.83.1
pytz = 2013
d
pytz = 2013
.7
# Required by:
# Required by:
# slapos.cookbook==0.83.1
# slapos.cookbook==0.83.1
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
slapos.core = 0.35.1
slapos.core = 0.35.1
# Required by:
# Required by:
...
@@ -219,9 +244,13 @@ unittest2 = 0.5.1
...
@@ -219,9 +244,13 @@ unittest2 = 0.5.1
# Required by:
# Required by:
# slapos.cookbook==0.83.1
# slapos.cookbook==0.83.1
# slapos.toolbox==0.3
6
# slapos.toolbox==0.3
7
xml-marshaller = 0.9.7
xml-marshaller = 0.9.7
# Required by:
# Required by:
# slapos.core==0.35.1
# slapos.core==0.35.1
zope.interface = 4.0.5
zope.interface = 4.0.5
\ No newline at end of file
cliff = 1.4.5
cmd2 = 0.6.7
pyparsing = 2.0.1
requests = 2.0.0
\ No newline at end of file
software/openstack/templates/keystone_basic.sh
0 → 100644
View file @
3f3a78a1
#!/bin/bash -xe
#
# Keystone basic configuration
# Mainly inspired by https://github.com/openstack/keystone/blob/master/tools/sample_data.sh
# Modified by Bilel Msekni / Institut Telecom
#
# Modified by Alain Takoudjou Kamdem
#
# Support: openstack@lists.launchpad.net
# License: Apache Software License (ASL) 2.0
#
source
localrc
HOST_IP
=
${
HOST_IP
:-
10
.10.100.51
}
ADMIN_PASSWORD
=
${
ADMIN_PASSWORD
:-
openstack
}
SERVICE_PASSWORD
=
${
SERVICE_PASSWORD
:-
openstack
}
export
SERVICE_TOKEN
=
"ADMIN"
export
SERVICE_ENDPOINT
=
"http://
${
HOST_IP
}
:35357/v2.0"
SERVICE_TENANT_NAME
=
${
SERVICE_TENANT_NAME
:-
service
}
get_id
()
{
echo
`
$@
|
awk
'/ id / { print $4 }'
`
}
# Tenants
ADMIN_TENANT
=
$(
get_id keystone tenant-create
--name
=
admin
)
SERVICE_TENANT
=
$(
get_id keystone tenant-create
--name
=
$SERVICE_TENANT_NAME
)
# Users
ADMIN_USER
=
$(
get_id keystone user-create
--name
=
admin
--pass
=
"
$ADMIN_PASSWORD
"
--email
=
admin@domain.com
)
# Roles
ADMIN_ROLE
=
$(
get_id keystone role-create
--name
=
admin
)
KEYSTONEADMIN_ROLE
=
$(
get_id keystone role-create
--name
=
KeystoneAdmin
)
KEYSTONESERVICE_ROLE
=
$(
get_id keystone role-create
--name
=
KeystoneServiceAdmin
)
# Add Roles to Users in Tenants
keystone user-role-add
--user-id
$ADMIN_USER
--role-id
$ADMIN_ROLE
--tenant-id
$ADMIN_TENANT
keystone user-role-add
--user-id
$ADMIN_USER
--role-id
$KEYSTONEADMIN_ROLE
--tenant-id
$ADMIN_TENANT
keystone user-role-add
--user-id
$ADMIN_USER
--role-id
$KEYSTONESERVICE_ROLE
--tenant-id
$ADMIN_TENANT
# The Member role is used by Horizon and Swift
MEMBER_ROLE
=
$(
get_id keystone role-create
--name
=
Member
)
# Configure service users/roles
NOVA_USER
=
$(
get_id keystone user-create
--name
=
nova
--pass
=
"
$SERVICE_PASSWORD
"
--tenant-id
$SERVICE_TENANT
--email
=
nova@domain.com
)
keystone user-role-add
--tenant-id
$SERVICE_TENANT
--user-id
$NOVA_USER
--role-id
$ADMIN_ROLE
GLANCE_USER
=
$(
get_id keystone user-create
--name
=
glance
--pass
=
"
$SERVICE_PASSWORD
"
--tenant-id
$SERVICE_TENANT
--email
=
glance@domain.com
)
keystone user-role-add
--tenant-id
$SERVICE_TENANT
--user-id
$GLANCE_USER
--role-id
$ADMIN_ROLE
QUANTUM_USER
=
$(
get_id keystone user-create
--name
=
quantum
--pass
=
"
$SERVICE_PASSWORD
"
--tenant-id
$SERVICE_TENANT
--email
=
quantum@domain.com
)
keystone user-role-add
--tenant-id
$SERVICE_TENANT
--user-id
$QUANTUM_USER
--role-id
$ADMIN_ROLE
CINDER_USER
=
$(
get_id keystone user-create
--name
=
cinder
--pass
=
"
$SERVICE_PASSWORD
"
--tenant-id
$SERVICE_TENANT
--email
=
cinder@domain.com
)
keystone user-role-add
--tenant-id
$SERVICE_TENANT
--user-id
$CINDER_USER
--role-id
$ADMIN_ROLE
software/openstack/templates/keystone_endpoints_basic.sh
0 → 100644
View file @
3f3a78a1
#!/bin/bash -xe
#
# Keystone basic Endpoints
# Mainly inspired by https://github.com/openstack/keystone/blob/master/tools/sample_data.sh
# Modified by Bilel Msekni / Institut Telecom
#
# Modified by Alain Takoudjou Kamdem
#
# Support: openstack@lists.launchpad.net
# License: Apache Software License (ASL) 2.0
#
source
localrc
# Host address
HOST_IP
=
${
HOST_IP
:-
10
.10.100.51
}
EXT_HOST_IP
=
$PUBLIC_ADDRESS
# MySQL definitions
MYSQL_USER
=
openstack
MYSQL_DATABASE
=
keystone
MYSQL_HOST
=
$HOST_IP
MYSQL_PASSWORD
=
$MYSQLPASS
# Keystone definitions
KEYSTONE_REGION
=
RegionOne
export
SERVICE_TOKEN
=
ADMIN
export
SERVICE_ENDPOINT
=
"http://
${
HOST_IP
}
:35357/v2.0"
while
getopts
"u:D:p:m:K:R:E:T:vh"
opt
;
do
case
$opt
in
u
)
MYSQL_USER
=
$OPTARG
;;
D
)
MYSQL_DATABASE
=
$OPTARG
;;
p
)
MYSQL_PASSWORD
=
$OPTARG
;;
m
)
MYSQL_HOST
=
$OPTARG
;;
K
)
MASTER
=
$OPTARG
;;
R
)
KEYSTONE_REGION
=
$OPTARG
;;
E
)
export
SERVICE_ENDPOINT
=
$OPTARG
;;
T
)
export
SERVICE_TOKEN
=
$OPTARG
;;
v
)
set
-x
;;
h
)
cat
<<
EOF
Usage:
$0
[-m mysql_hostname] [-u mysql_username] [-D mysql_database] [-p mysql_password]
[-K keystone_master ] [ -R keystone_region ] [ -E keystone_endpoint_url ]
[ -T keystone_token ]
Add -v for verbose mode, -h to display this message.
EOF
exit
0
;;
\?
)
echo
"Unknown option -
$OPTARG
"
>
&2
exit
1
;;
:
)
echo
"Option -
$OPTARG
requires an argument"
>
&2
exit
1
;;
esac
done
if
[
-z
"
$KEYSTONE_REGION
"
]
;
then
echo
"Keystone region not set. Please set with -R option or set KEYSTONE_REGION variable."
>
&2
missing_args
=
"true"
fi
if
[
-z
"
$SERVICE_TOKEN
"
]
;
then
echo
"Keystone service token not set. Please set with -T option or set SERVICE_TOKEN variable."
>
&2
missing_args
=
"true"
fi
if
[
-z
"
$SERVICE_ENDPOINT
"
]
;
then
echo
"Keystone service endpoint not set. Please set with -E option or set SERVICE_ENDPOINT variable."
>
&2
missing_args
=
"true"
fi
if
[
-z
"
$MYSQL_PASSWORD
"
]
;
then
echo
"MySQL password not set. Please set with -p option or set MYSQL_PASSWORD variable."
>
&2
missing_args
=
"true"
fi
if
[
-n
"
$missing_args
"
]
;
then
exit
1
fi
keystone service-create
--name
nova
--type
compute
--description
'OpenStack Compute Service'
keystone service-create
--name
cinder
--type
volume
--description
'OpenStack Volume Service'
keystone service-create
--name
glance
--type
image
--description
'OpenStack Image Service'
keystone service-create
--name
keystone
--type
identity
--description
'OpenStack Identity'
keystone service-create
--name
ec2
--type
ec2
--description
'OpenStack EC2 service'
keystone service-create
--name
quantum
--type
network
--description
'OpenStack Networking service'
create_endpoint
()
{
case
$1
in
compute
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':8774/v2/$(tenant_id)s'
--adminurl
'http://'
"
$HOST_IP
"
':8774/v2/$(tenant_id)s'
--internalurl
'http://'
"
$HOST_IP
"
':8774/v2/$(tenant_id)s'
;;
volume
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':8776/v1/$(tenant_id)s'
--adminurl
'http://'
"
$HOST_IP
"
':8776/v1/$(tenant_id)s'
--internalurl
'http://'
"
$HOST_IP
"
':8776/v1/$(tenant_id)s'
;;
image
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':9292/v2'
--adminurl
'http://'
"
$HOST_IP
"
':9292/v2'
--internalurl
'http://'
"
$HOST_IP
"
':9292/v2'
;;
identity
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':5000/v2.0'
--adminurl
'http://'
"
$HOST_IP
"
':35357/v2.0'
--internalurl
'http://'
"
$HOST_IP
"
':5000/v2.0'
;;
ec2
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':8773/services/Cloud'
--adminurl
'http://'
"
$HOST_IP
"
':8773/services/Admin'
--internalurl
'http://'
"
$HOST_IP
"
':8773/services/Cloud'
;;
network
)
keystone endpoint-create
--region
$KEYSTONE_REGION
--service-id
$2
--publicurl
'http://'
"
$EXT_HOST_IP
"
':9696/'
--adminurl
'http://'
"
$HOST_IP
"
':9696/'
--internalurl
'http://'
"
$HOST_IP
"
':9696/'
;;
esac
}
for
i
in
compute volume image object-store identity ec2 network
;
do
id
=
`
mysql
-h
"
$MYSQL_HOST
"
-u
"
$MYSQL_USER
"
-p
"
$MYSQL_PASSWORD
"
"
$MYSQL_DATABASE
"
-ss
-e
"SELECT id FROM service WHERE type='"
$i
"';"
`
||
exit
1
create_endpoint
$i
$id
done
software/openstack/templates/network.py
0 → 100644
View file @
3f3a78a1
#!/usr/bin/env python
#Print Network address and generate range of 60 IPV4s for Openstack floatings IPs
import
os
import
sys
from
netaddr
import
IPNetwork
def
getNetwork
(
ipaddress
,
mask
):
net
=
str
(
IPNetwork
(
'%s/%s'
%
(
ipaddress
,
mask
)).
cidr
.
network
)
net_cidr
=
str
(
IPNetwork
(
'%s/%s'
%
(
ipaddress
,
mask
)).
cidr
)
items
=
ipaddress
.
split
(
'.'
)
base
=
"%s.%s.%s"
%
(
items
[
0
],
items
[
1
],
items
[
2
])
if
int
(
items
[
3
])
+
60
<
254
:
ranges
=
"%s.%s %s.%s"
%
(
base
,
(
int
(
items
[
3
])
+
1
),
base
,
(
int
(
items
[
3
])
+
60
))
else
:
ranges
=
"%s.%s %s.%s"
%
(
base
,
(
int
(
items
[
3
])
-
1
),
base
,
(
int
(
items
[
3
])
-
60
))
return
net
+
" "
+
net_cidr
+
" "
+
ranges
if
__name__
==
'__main__'
:
print
getNetwork
(
sys
.
argv
[
1
],
sys
.
argv
[
2
])
exit
(
0
)
\ No newline at end of file
software/openstack/templates/openstack-install.sh.in
View file @
3f3a78a1
...
@@ -84,5 +84,4 @@ fi
...
@@ -84,5 +84,4 @@ fi
#Allow openstack images to access to internet
#Allow openstack images to access to internet
#sudo iptables -t nat -A POSTROUTING -s $FLOATING_RANGE -j MASQUERADE
#sudo iptables -t nat -A POSTROUTING -s $FLOATING_RANGE -j MASQUERADE
exit
0
exit
0
\ No newline at end of file
software/openstack/templates/ssh-configure.py.in
View file @
3f3a78a1
...
@@ -24,6 +24,9 @@ hostname = '${:host-ip}'
...
@@ -24,6 +24,9 @@ hostname = '${:host-ip}'
ssh_run = os.path.join('${:nova-result}', 'nova-configure.log')
ssh_run = os.path.join('${:nova-result}', 'nova-configure.log')
ssh_check = os.path.join('${:nova-result}', 'ssh_check.log')
ssh_check = os.path.join('${:nova-result}', 'ssh_check.log')
nova_configure = '${:nova-configure}'
nova_configure = '${:nova-configure}'
keystone_script = '${:keystone-script}'
keystone_endpoints_script = '${:keystone-endpoints-script}'
floating_ip_generate_script = '${:floating-ip-generate}'
instance = '${:instance}'.strip() #Type: manage or compute
instance = '${:instance}'.strip() #Type: manage or compute
def getClient():
def getClient():
...
@@ -42,7 +45,7 @@ def installCompute():
...
@@ -42,7 +45,7 @@ def installCompute():
#Install nova components and services
#Install nova components and services
print "Installing nova..."
print "Installing nova..."
install_command = "echo %s | sudo -S /bin/
sh configure.sh
" % password
install_command = "echo %s | sudo -S /bin/
bash -xe configure.sh 2>&1 | tee install.log
" % password
stdin, stdout, stderr = client.exec_command(install_command)
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'a') as output:
with open(ssh_run, 'a') as output:
output.write(stdout.read())
output.write(stdout.read())
...
@@ -55,17 +58,27 @@ def installCompute():
...
@@ -55,17 +58,27 @@ def installCompute():
output.write(stdout.read())
output.write(stdout.read())
def installManage():
def installManage():
#copy keystone configure and network address generate scripts
sftp = client.open_sftp()
result = sftp.put(keystone_script, 'keystone_basic.sh' )
print 'Keystone Basic Configuration script has been copied successfully! File size: %s' % result.st_size
result = sftp.put(keystone_endpoints_script, 'keystone_endpoints_basic.sh' )
print 'Keystone Endpoints Configuration script has been copied successfully! File size: %s' % result.st_size
result = sftp.put(floating_ip_generate_script, 'network.py' )
print 'Network generate script has been copied successfully! File size: %s' % result.st_size
sftp.close()
#Install nova components and services
#Install nova components and services
print "Downloading and installing Openstack on computer..."
print "Downloading and installing Openstack on computer..."
install_command = "echo %s | sudo -S /bin/
sh configure.sh
" % password
install_command = "echo %s | sudo -S /bin/
bash -xe configure.sh 2>&1 | tee install.log
" % password
stdin, stdout, stderr = client.exec_command(install_command)
stdin, stdout, stderr = client.exec_command(install_command)
with open(ssh_run, 'w') as output:
with open(ssh_run, 'w') as output:
output.write(stdout.read())
output.write(stdout.read())
#Check installation status
#Check nova service status
#Check nova service status
print "Checking nova service status..."
print "Checking nova service status..."
nova_command = '
nova-manage service list'
nova_command = '
echo %s | sudo -S nova-manage service list' % password
stdin, stdout, stderr = client.exec_command(nova_command)
stdin, stdout, stderr = client.exec_command(nova_command)
with open(ssh_check, 'w') as output:
with open(ssh_check, 'w') as output:
output.write(stdout.read())
output.write(stdout.read())
...
@@ -77,11 +90,11 @@ if __name__ == '__main__':
...
@@ -77,11 +90,11 @@ if __name__ == '__main__':
time.sleep(5)
time.sleep(5)
try:
try:
#Try to run openstack command before all other system process are started
#Try to run openstack command before all other system process are started
time.sleep(
3
0)
time.sleep(
2
0)
#Write file configure.sh to use.
#Write file configure.sh to use.
sftp = client.open_sftp()
sftp = client.open_sftp()
result = sftp.put(nova_configure, 'configure.sh' )
result = sftp.put(nova_configure, 'configure.sh' )
print 'Nova configuration
file
has been copied successfully! File size: %s' % result.st_size
print 'Nova configuration
scipt
has been copied successfully! File size: %s' % result.st_size
sftp.close()
sftp.close()
if instance == "manage":
if instance == "manage":
installManage()
installManage()
...
...
software/openstack/templates/stack_controller_grizzly.sh.in
0 → 100644
View file @
3f3a78a1
#!/bin/bash -xe
#stack_controller_grizzly.sh: Should install and configure all needed openstack packages.
#This script should work on SlapOS environment, using a Virtual Machine
# Warning: this script has been tested only on Ubuntu 12.04.
#sudo su
export
DEBIAN_FRONTEND
=
noninteractive
apt-get
-y
install
ubuntu-cloud-keyring python-software-properties software-properties-common python-keyring
echo
deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/grizzly main
>>
/etc/apt/sources.list.d/grizzly.list
apt-get update
apt-get
-y
upgrade
apt-get
-y
dist-upgrade
###############################################################################################
##### Configure Network
###############################################################################################
apt-get
install
-y
openvswitch-switch openvswitch-datapath-lts-raring-dkms
apt-get
install
-y
vlan bridge-utils
#br-int will be used for VM integration
ovs-vsctl add-br br-int
#br-ex is used to make to access the internet (not covered in this guide)
ovs-vsctl add-br br-ex
ovs-vsctl add-port br-ex eth0
if
[
-f
network.conf
]
then
IPv4
=
`
cat
network.conf |
cut
-d
:
-f1
`
MASK
=
`
cat
network.conf |
cut
-d
:
-f2
`
GATEWAY
=
`
cat
network.conf |
cut
-d
:
-f3
`
BCAST
=
`
cat
network.conf |
cut
-d
:
-f4
`
else
GATEWAY
=
`
route |
grep
default |
awk
'{print $2}'
`
MASK
=
`
ifconfig eth0 |
grep
'inet adr:'
|
awk
'{ print $4}'
|
cut
-d
:
-f2
`
BCAST
=
`
ifconfig eth0 |
grep
'inet adr:'
|
awk
'{ print $3}'
|
cut
-d
:
-f2
`
IPv4
=
`
ip addr show eth0 |
grep
'inet '
|
awk
'{print $2}'
|
cut
-d
/
-f1
`
echo
"
$IPv4
:
$MASK
:
$GATEWAY
:
$BCAST
"
>
network.conf
fi
/bin/cat
<<
EOF
> /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#For Exposing OpenStack API over the internet
# VM internet Access
auto eth0
iface eth0 inet manual
up ifconfig
\$
IFACE 0.0.0.0 up
up ip link set
\$
IFACE promisc on
down ip link set
\$
IFACE promisc off
down ifconfig
\$
IFACE down
auto br-ex
iface br-ex inet static
address
$IPv4
netmask
$MASK
broadcast
$BCAST
gateway
$GATEWAY
dns-nameservers 8.8.8.8
#Not internet connected(used for OpenStack management)
#auto eth0
#iface eth0 inet static
#address 10.10.100.51
#netmask 255.255.255.0
EOF
chmod
644 /etc/network/interfaces
/etc/init.d/networking restart
###############################################################################################
##### Network Fowarding
###############################################################################################
sed
-i
's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/'
/etc/sysctl.conf
# To save you from rebooting, perform the following
sysctl net.ipv4.ip_forward
=
1
iptables
--table
nat
--append
POSTROUTING
--out-interface
eth1
-j
MASQUERADE
iptables
--append
FORWARD
--in-interface
br-ex
-j
ACCEPT
###############################################################################################
##### Variables to use
###############################################################################################
/bin/cat
<<
EOF
> localrc
MYSQLPASS=
${
:nova-passwd
}
ADMIN_PASSWORD=
${
:nova-passwd
}
SERVICE_PASSWORD=
${
:nova-passwd
}
RABBIT_PASS=
${
:nova-passwd
}
HOST_IP=
$IPv4
PUBLIC_ADDRESS=
$IPv4
EXT_HOST_IP=
$IPv4
USER_PASSWORD=
\$
ADMIN_PASSWORD
USER_NAME=
${
:user-name
}
PROJECT=
${
:project
}
EOF
source
localrc
CURRENT_DIR
=
`
pwd
`
###############################################################################################
##### Install Mysql, ntp, MysqlDB and RabbitMQ
###############################################################################################
apt-get
install
-y
mysql-server python-mysqldb
mysqladmin
-u
root password
$MYSQLPASS
/sbin/stop mysql
sed
-i
's/127.0.0.1/0.0.0.0/g'
/etc/mysql/my.cnf
service mysql restart
sleep
5
apt-get
install
-y
rabbitmq-server
apt-get
install
-y
ntp
sed
-i
's/server ntp.ubuntu.com/server ntp.ubuntu.com\nserver 127.127.1.0\nfudge 127.127.1.0 stratum 10/g'
/etc/ntp.conf
service ntp restart
sleep
1.5
##############################################################################
## Create MySQL accounts and databases of Nova, Glance, Keystone and Cinder
##############################################################################
/bin/cat
<<
EOF
| /usr/bin/mysql -uroot -p
$MYSQLPASS
DROP DATABASE IF EXISTS keystone;
DROP DATABASE IF EXISTS glance;
DROP DATABASE IF EXISTS nova;
DROP DATABASE IF EXISTS cinder;
DROP DATABASE IF EXISTS horizon;
DROP DATABASE IF EXISTS quantum;
CREATE DATABASE keystone;
CREATE DATABASE glance;
CREATE DATABASE nova;
CREATE DATABASE cinder;
CREATE DATABASE horizon;
CREATE DATABASE quantum;
GRANT ALL ON keystone.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
GRANT ALL ON glance.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
GRANT ALL ON nova.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
GRANT ALL ON cinder.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
GRANT ALL ON horizon.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
GRANT ALL ON quantum.* TO 'openstack'@'%' IDENTIFIED BY '
$MYSQLPASS
';
EOF
###############################################################################################
##### Install Keystone
###############################################################################################
apt-get
install
-y
keystone
service keystone status
CONF
=
/etc/keystone/keystone.conf
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
"s/^#*connection *=.*/connection = mysql:
\/\/
openstack:
$MYSQLPASS
@
$HOST_IP
\/
keystone/"
\
$CONF
.orig
>
$CONF
# -e "s/^#* *admin_token *=.*/admin_token = $ADMIN_PASSWORD/" \
service keystone restart
sleep
1.5
keystone-manage db_sync
sleep
1.5
cd
$CURRENT_DIR
source
localrc
chmod
+x keystone_basic.sh
chmod
+x keystone_endpoints_basic.sh
./keystone_basic.sh
./keystone_endpoints_basic.sh
/bin/cat
<<
EOF
> creds
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=
$ADMIN_PASSWORD
export OS_AUTH_URL="http://
$EXT_HOST_IP
:5000/v2.0/"
EOF
source
creds
keystone user-list
###############################################################################################
##### Install and configure Glance
###############################################################################################
apt-get
install
-y
glance
service glance-api status
service glance-registry status
CONF
=
/etc/glance/glance-api.conf
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
"s#^sql_connection *=.*#sql_connection = mysql://openstack:
$MYSQLPASS
@
$HOST_IP
/glance#"
\
-e
's/^#*flavor *=.*/flavor = keystone/'
\
$CONF
.orig
>
$CONF
CONF
=
/etc/glance/glance-api-paste.ini
cp
$CONF
$CONF
.orig
sed
-e
"/delay_auth_decision/a
\a
uth_host =
$HOST_IP
"
\
-e
"/delay_auth_decision/a
\a
uth_port = 35357"
\
-e
"/delay_auth_decision/a
\a
uth_protocol = http"
\
-e
"/delay_auth_decision/a
\a
dmin_tenant_name = service"
\
-e
"/delay_auth_decision/a
\a
dmin_user = glance"
\
-e
"/delay_auth_decision/a
\a
dmin_password =
$ADMIN_PASSWORD
"
\
$CONF
.orig
>
$CONF
# -e "s/^auth_host *=.*/auth_host = $HOST_IP/" \
# -e 's/%SERVICE_TENANT_NAME%/service/' \
# -e 's/%SERVICE_USER%/glance/' \
# -e "s/%SERVICE_PASSWORD%/$SERVICE_PASSWORD/" \
# -e 's[^#* *config_file *=.*[config_file = /etc/glance/glance-api-paste.ini[' \
# -e "s/127.0.0.1/$HOST_IP/" \
# -e "s/localhost/$HOST_I/" \
# -e "s/^rabbit_host *=.*/rabbit_host = 127.0.0.1/" \
# -e 's/^notifier_strategy *=.*/notifier_strategy = rabbit/' \
# -e "s/^rabbit_host *=.*/rabbit_host = $HOST_IP/" \
# -e 's/^rabbit_userid *=.*/rabbit_userid = nova/' \
# -e "s/^rabbit_password *=.*/rabbit_password = $RABBIT_PASS/" \
# -e "s/^rabbit_virtual_host *=.*/rabbit_virtual_host = \/nova/" \
CONF
=
/etc/glance/glance-registry.conf
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
"s/^sql_connection *=.*/sql_connection = mysql:
\/\/
openstack:
$MYSQLPASS
@
$HOST_IP
\/
glance/"
\
-e
's/^#*flavor *=.*/flavor=keystone/'
\
$CONF
.orig
>
$CONF
# -e "s/127.0.0.1/$HOST_IP/" \
# -e "s/localhost/$HOST_IP/" \
# -e 's/^#* *config_file *=.*/config_file = \/etc\/glance\/glance-registry-paste.ini/' \
# -e "s/^auth_host *=.*/auth_host = $HOST_IP/" \
# -e 's/%SERVICE_TENANT_NAME%/service/' \
# -e 's/%SERVICE_USER%/glance/' \
# -e "s/%SERVICE_PASSWORD%/$ADMIN_PASSWORD/" \
CONF
=
/etc/glance/glance-registry-paste.ini
cp
$CONF
$CONF
.orig
sed
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_host =
$HOST_IP
"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_port = 35357"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_protocol = http"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_tenant_name = service"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_user = glance"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_password =
$ADMIN_PASSWORD
"
\
$CONF
.orig
>
$CONF
service glance-api restart
;
service glance-registry restart
sleep
1.5
glance-manage db_sync
service glance-registry restart
;
service glance-api restart
sleep
1.5
glance image-create
--name
${
:image-name
}
--is-public
true
--container-format
bare
--disk-format
qcow2
--location
${
:image-url
}
glance image-list
###############################################################################################
##### Install and configure Quantum
###############################################################################################
apt-get
install
-y
quantum-server quantum-plugin-openvswitch quantum-plugin-openvswitch-agent dnsmasq quantum-dhcp-agent quantum-l3-agent
#Replace configuration file:
CONF
=
/etc/quantum/api-paste.ini
cp
$CONF
$CONF
.orig
sed
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_host =
$HOST_IP
"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_port = 35357"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
uth_protocol = http"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_tenant_name = service"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_user = quantum"
\
-e
"/keystoneclient.middleware.auth_token:filter_factory/a
\a
dmin_password =
$ADMIN_PASSWORD
"
\
$CONF
.orig
>
$CONF
CONF
=
/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
cp
$CONF
$CONF
.orig
sed
-e
"s/^sql_connection *=.*/sql_connection = mysql:
\/\/
openstack:
$MYSQLPASS
@
$HOST_IP
\/
quantum/"
\
-e
"s/^# firewall_driver *=.*/firewall_driver = quantum.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver/"
\
-e
"/^# Example: bridge_mappings/a
\t
enant_network_type = gre"
\
-e
"/^# Example: bridge_mappings/a
\t
unnel_id_ranges = 1:1000"
\
-e
"/^# Example: bridge_mappings/a
\i
ntegration_bridge = br-int"
\
-e
"/^# Example: bridge_mappings/a
\t
unnel_bridge = br-tun"
\
-e
"/^# Example: bridge_mappings/a
\l
ocal_ip =
$HOST_IP
"
\
-e
"/^# Example: bridge_mappings/a
\e
nable_tunneling = True"
\
$CONF
.orig
>
$CONF
CONF
=
/etc/quantum/metadata_agent.ini
cp
$CONF
$CONF
.orig
sed
-e
"s/^auth_url *=.*/auth_url = http:
\/\/
$HOST_IP
:35357
\/
v2.0/"
\
-e
's/%SERVICE_TENANT_NAME%/service/'
\
-e
's/%SERVICE_USER%/quantum/'
\
-e
"s/%SERVICE_PASSWORD%/
$ADMIN_PASSWORD
/"
\
-e
"s/^# nova_metadata_ip *=.*/nova_metadata_ip = 127.0.0.1/"
\
-e
"s/^# nova_metadata_port *=.*/nova_metadata_port = 8775/"
\
-e
"s/^# metadata_proxy_shared_secret *=.*/metadata_proxy_shared_secret = helloOpenStack/"
\
$CONF
.orig
>
$CONF
CONF
=
/etc/quantum/quantum.conf
cp
$CONF
$CONF
.orig
sed
-e
"s/^auth_host *=.*/auth_host =
$HOST_IP
/"
\
-e
's/%SERVICE_TENANT_NAME%/service/'
\
-e
's/%SERVICE_USER%/quantum/'
\
-e
"s/%SERVICE_PASSWORD%/
$ADMIN_PASSWORD
/"
\
$CONF
.orig
>
$CONF
cd
/etc/init.d/
;
for
i
in
$(
ls
quantum-
*
)
;
do
sudo
service
$i
restart
;
done
sleep
1.5
service dnsmasq restart
sleep
1.5
###############################################################################################
##### Install and configure Nova
###############################################################################################
apt-get
-y
install
cpu-checker
#kvm-ok
#sleep 1.5
apt-get
install
-y
kvm libvirt-bin pm-utils
CONF
=
/etc/libvirt/qemu.conf
cp
$CONF
$CONF
.orig
/bin/cat
<<
EOF
>>
$CONF
cgroup_device_acl = [
"/dev/null", "/dev/full", "/dev/zero",
"/dev/random", "/dev/urandom",
"/dev/ptmx", "/dev/kvm", "/dev/kqemu",
"/dev/rtc", "/dev/hpet","/dev/net/tun"
]
EOF
virsh net-destroy default
virsh net-undefine default
CONF
=
/etc/libvirt/libvirtd.conf
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
's/^#listen_tls *=.*/listen_tls = 0/'
\
-e
's/^#listen_tcp *=.*/listen_tcp = 1/'
\
-e
's/^#auth_tcp *=.*/auth_tcp = "none"/'
\
$CONF
.orig
>
$CONF
CONF
=
/etc/init/libvirt-bin.conf
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
's/^env libvirtd_opts=.*/env libvirtd_opts="-d -l"/'
\
$CONF
.orig
>
$CONF
CONF
=
/etc/default/libvirt-bin
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
's/^libvirtd_opts=.*/libvirtd_opts="-d -l"/'
\
$CONF
.orig
>
$CONF
service dbus restart
&&
service libvirt-bin restart
sleep
1.5
#Install Nova-* services
apt-get
install
-y
nova-api nova-cert novnc nova-consoleauth nova-scheduler nova-novncproxy nova-doc nova-conductor nova-compute-kvm
cd
/etc/init.d/
;
for
i
in
$(
ls
nova-
*
)
;
do
service
$i
status
;
cd
;
done
CONF
=
/etc/nova/api-paste.ini
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
"s/^auth_host *=.*/auth_host =
$HOST_IP
/"
\
-e
's/%SERVICE_TENANT_NAME%/service/'
\
-e
's/%SERVICE_USER%/nova/'
\
-e
"s/%SERVICE_PASSWORD%/
$ADMIN_PASSWORD
/"
\
-e
"s/^#signing_dir *=.*/signing_dirname =
\/
tmp
\/
keystone-signing-nova/"
\
$CONF
.orig
>
$CONF
CONF
=
/etc/nova/nova.conf
cp
$CONF
$CONF
.orig
/bin/cat
<<
EOF
>
$CONF
[DEFAULT]
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/run/lock/nova
verbose=True
api_paste_config=/etc/nova/api-paste.ini
compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
rabbit_host=
$HOST_IP
nova_url=http://
$HOST_IP
:8774/v1.1/
sql_connection=mysql://openstack:
$MYSQLPASS
@
$HOST_IP
/nova
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
# Auth
use_deprecated_auth=false
auth_strategy=keystone
# Imaging service
glance_api_servers=
$HOST_IP
:9292
image_service=nova.image.glance.GlanceImageService
# Vnc configuration
novnc_enabled=true
novncproxy_base_url=http://
$PUBLIC_ADDRESS
:6080/vnc_auto.html
novncproxy_port=6080
vncserver_proxyclient_address=
$HOST_IP
vncserver_listen=0.0.0.0
# Network settings
network_api_class=nova.network.quantumv2.api.API
quantum_url=http://
$HOST_IP
:9696
quantum_auth_strategy=keystone
quantum_admin_tenant_name=service
quantum_admin_username=quantum
quantum_admin_password=
$SERVICE_PASSWORD
quantum_admin_auth_url=http://
$HOST_IP
:35357/v2.0
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
linuxnet_interface_driver=nova.network.linux_net.LinuxOVSInterfaceDriver
#If you want Quantum + Nova Security groups
firewall_driver=nova.virt.firewall.NoopFirewallDriver
security_group_api=quantum
#If you want Nova Security groups only, comment the two lines above and uncomment line -1-.
#-1-firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
#Metadata
service_quantum_metadata_proxy = True
quantum_metadata_proxy_shared_secret = helloOpenStack
metadata_host =
$HOST_IP
metadata_listen = 127.0.0.1
metadata_listen_port = 8775
# Compute #
compute_driver=libvirt.LibvirtDriver
# Cinder #
volume_api_class=nova.volume.cinder.API
osapi_volume_listen_port=5900
EOF
CONF
=
/etc/nova/nova-compute.conf
cp
$CONF
$CONF
.orig
/bin/cat
<<
EOF
>
$CONF
[DEFAULT]
libvirt_type=qemu
libvirt_ovs_bridge=br-int
libvirt_vif_type=ethernet
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
libvirt_use_virtio_for_bridges=True
EOF
nova-manage db
sync
cd
/etc/init.d/
;
for
i
in
$(
ls
nova-
*
)
;
do
sudo
service
$i
restart
;
done
sleep
1.5
nova-manage service list
sleep
1.5
###############################################################################################
##### Install and configure Cinder
###############################################################################################
apt-get
install
-y
cinder-api cinder-scheduler cinder-volume iscsitarget open-iscsi iscsitarget-dkms
sed
-i
's/false/true/g'
/etc/default/iscsitarget
service iscsitarget start
service open-iscsi start
CONF
=
/etc/cinder/cinder.conf
cp
$CONF
$CONF
.orig
/bin/cat
<<
EOF
>
$CONF
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
api_paste_confg = /etc/cinder/api-paste.ini
iscsi_helper = ietadm
volume_name_template = volume-%s
volume_group = cinder-volumes
verbose = True
auth_strategy = keystone
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
volumes_dir = /var/lib/cinder/volumes
# LOGGING
log_file=cinder.log
log_dir=/var/log/cinder
# OSAPI
osapi_volume_extension = cinder.api.openstack.volume.contrib.standard_extensions
osapi_max_limit = 2000
# RABBIT
#rabbit_host=
$HOST_IP
#rabbit_virtual_host=/nova
#rabbit_userid=nova
#rabbit_password=
$RABBIT_PASS
# MYSQL
sql_connection = mysql://openstack:
$MYSQLPASS
@
$HOST_IP
/cinder
debug = True
EOF
CONF
=
/etc/cinder/api-paste.ini
cp
$CONF
$CONF
.orig
/bin/sed
\
-e
"s/^service_host *=.*/service_host =
$PUBLIC_ADDRESS
/"
\
-e
"s/^auth_host *=.*/auth_host =
$HOST_IP
/"
\
-e
's/%SERVICE_TENANT_NAME%/service/'
\
-e
's/%SERVICE_USER%/cinder/'
\
-e
"s/%SERVICE_PASSWORD%/
$ADMIN_PASSWORD
/"
\
$CONF
.orig
>
$CONF
cinder-manage db
sync
CINDER_VOL_DIR
=
/var/lib/cinder
cd
$CINDER_VOL_DIR
dd
if
=
/dev/zero
of
=
cinder-volumes
bs
=
1
count
=
0
seek
=
2G
losetup /dev/loop2 cinder-volumes
#Skip this part
#fdisk /dev/loop2
#n
#p
#1
#ENTER
#ENTER
#t
#8e
#w
pvcreate /dev/loop2
vgcreate cinder-volumes /dev/loop2
/bin/cat
<<
EOF
> /etc/init.d/cinder-setup-backing-file
losetup /dev/loop2
$CINDER_VOL_DIR
/cinder-volumes
exit 0
EOF
sudo chmod
755 /etc/init.d/cinder-setup-backing-file
sudo ln
-s
/etc/init.d/cinder-setup-backing-file /etc/rc2.d/S10cinder-setup-backing-file
cd
$CURRENT_DIR
###############################################################################################
##### Restore user access on files
###############################################################################################
for
i
in
nova keystone glance cinder
do
chown
-R
$i
/etc/
$i
done
rm
-r
/var/log/cinder/cinder
*
cd
/etc/init.d/
;
for
i
in
$(
ls
cinder-
*
)
;
do
sudo
service
$i
restart
;
done
sleep
1.5
cd
/etc/init.d/
;
for
i
in
$(
ls
cinder-
*
)
;
do
sudo
service
$i
status
;
done
sleep
1.5
###############################################################################################
##### Install Horizon
###############################################################################################
apt-get
-y
install
openstack-dashboard memcached
dpkg
--purge
openstack-dashboard-ubuntu-theme
service apache2 restart
;
service memcached restart
###############################################################################################
##### Configure quantum network
###############################################################################################
apt-get
install
-y
python-netaddr
cd
$CURRENT_DIR
function
get_id
()
{
echo
`
"
$@
"
|
awk
'/ id / { print $4 }'
`
}
source
creds
MEMDER_ROLE
=
$(
keystone role-list |
grep
" Member"
|
awk
'{print $2}'
)
ADMIN_ROLE
=
$(
keystone role-list |
grep
" admin"
|
awk
'{print $2}'
)
L3_AGENT_ID
=
$(
quantum agent-list |
grep
" L3 agent"
|
awk
'{print $2}'
)
PROJECT_ID
=
$(
get_id keystone tenant-create
--name
$PROJECT
)
USER_ID
=
$(
get_id keystone user-create
--name
=
$USER_NAME
--pass
=
$USER_PASSWORD
--tenant-id
$PROJECT_ID
--email
=
$USER_NAME
@domain.com
)
keystone user-role-add
--tenant-id
$PROJECT_ID
--user-id
$USER_ID
--role-id
$MEMDER_ROLE
quantum net-create
--tenant-id
$PROJECT_ID
net_
$PROJECT
SUBNET_ID
=
$(
get_id quantum subnet-create
--tenant-id
$PROJECT_ID
net_
$PROJECT
50.50.1.0/24
--dns_nameservers
list
=
true
8.8.8.7 8.8.8.8
)
ROUTER_ID
=
$(
get_id quantum router-create
--tenant-id
$PROJECT_ID
router_
$PROJECT
)
quantum l3-agent-router-add
$L3_AGENT_ID
router_
$PROJECT
quantum router-interface-add
$ROUTER_ID
$SUBNET_ID
cd
/etc/init.d/
;
for
i
in
$(
ls
quantum-
*
)
;
do
sudo
service
$i
restart
;
done
sleep
2
cd
$CURRENT_DIR
chmod
+x network.py
EXT_NET_ID
=
$(
get_id quantum net-create
--tenant-id
$ADMIN_ROLE
ext_net
--router
:external
=
True
)
NETWORK
=
`
./network.py
$IPv4
$MASK
|
cut
-d
' '
-f2
`
POOL_START
=
`
./network.py
$IPv4
$MASK
|
cut
-d
' '
-f3
`
POOL_END
=
`
./network.py
$IPv4
$MASK
|
cut
-d
' '
-f4
`
quantum subnet-create
--tenant-id
$ADMIN_ROLE
--allocation-pool
start
=
$POOL_START
,end
=
$POOL_END
--gateway
$IPv4
ext_net
$NETWORK
--enable_dhcp
=
False
quantum router-gateway-set
$ROUTER_ID
$EXT_NET_ID
/bin/cat
<<
EOF
> creds_
$PROJECT
export OS_TENANT_NAME=
$PROJECT
export OS_USERNAME=
$USER_NAME
export OS_PASSWORD=
$USER_PASSWORD
export OS_AUTH_URL="http://
$PUBLIC_ADDRESS
:5000/v2.0/"
EOF
source
creds_
$PROJECT
nova
--no-cache
secgroup-add-rule default icmp
-1
-1
0.0.0.0/0
nova
--no-cache
secgroup-add-rule default tcp 22 22 0.0.0.0/0
quantum floatingip-create ext_net
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment