summaryrefslogtreecommitdiffstats
path: root/meta-openstack/Documentation
diff options
context:
space:
mode:
authorMustapha Lansana <Mustapha.Lansana@windriver.com>2014-07-30 19:08:55 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-09-26 09:09:21 -0400
commitcaf76c8322f247d0829dc9a18009bee0b1195a06 (patch)
tree84751c17810440a9e560d486f57d9dc16074faf1 /meta-openstack/Documentation
parentef4a3055abee950950c2aac127854eb9e83f2793 (diff)
downloadmeta-cloud-services-caf76c8322f247d0829dc9a18009bee0b1195a06.tar.gz
openstackchef: decentralized openstack-chef class implementation
This class provides a framework for recipes(packages) to register their configuration files with the deploychef package. This class works together with the deploychef package. This implementation makes it possible for the deploychef package, with the help of chef-solo, to recreate registered configuration files at run-time. Only services that inherit this class and register their configuration files are re-configurable at run-time; and by configurable, we mean to make chefsolo templates out of their configuration files and to be aware of the list of daemons that need to be killed/started at run-time. Therefore, openstackchef class requires the recipes/classes inheriting it to advertise their configuration files, list of start/stop daemons and finally a special callback function when necessary. In order to avoid duplication of common placeholders and substitution across the various recipes inheriting this class, we keep a dictionary of common placeholders and substitutions, but rely on the recipes to define the values these placeholders take at run-time. See the description at the top of the class files (openstackchef.bbclass and openstackchef_inc.bbclass ) for more details. This class makes chef-solo template files out of the configuration files exposed to it by the recipes. The resulting templates are stored at /opt/deploychef/cookbooks/openstack/templates/default. on the resulting rootfs. It also creates a file containing a set of chef-solo default template values known as attributes in chef-solo world. The default values are provided by the recipes and classes inheriting this class. The chefsolo attributes file is stored at /opt/deploychef/cookbooks/openstack/attributes/default.rb at the end of rootfs creation process. At run-time, the deploychef package whose package files are stored at '/opt/deploychef', makes a call to chef-solo. Chef-solo in turn uses the attributes and templates files to overwrite the configuration files for services like neutron, nova, swift, etc.. that registered configuration files with openstackchef class at build time. See accompanying documentation for further explanation. Signed-off-by: Mustapha Lansana <Mustapha.Lansana@windriver.com>
Diffstat (limited to 'meta-openstack/Documentation')
-rw-r--r--meta-openstack/Documentation/README.openstackchef219
1 files changed, 219 insertions, 0 deletions
diff --git a/meta-openstack/Documentation/README.openstackchef b/meta-openstack/Documentation/README.openstackchef
new file mode 100644
index 0000000..7ddf23a
--- /dev/null
+++ b/meta-openstack/Documentation/README.openstackchef
@@ -0,0 +1,219 @@
1openstackchef.bbclass
2=========
3When an openstack image is built for a CONTROLLER, COMPUTE or allinone,
4there are build-time variables that are hard-coded into the image.
5These hardcoded variables need to be provided up front at
6build time and cannot be changed easily at run-time.
7What this means is that an image built for a specific deployment
8environment cannot be easily deployed to another environment.
9
10Openstackchef class enables openstack related services like, nova, postgresql,
11neutron, etc to be re-configured at run-time. This means that if all the
12services of an openstack installation inherits the openstackchef class,
13openstackchef can successfully re-configure an openstack installation.
14
15For example, at build time, many of the openstack services need to know ahead of
16time, the IP address of the node on which CONTROLLER and COMPUTE will be deployed.
17Once this IP address is built into the image, it cannot be changed at runtime.
18In other words, if you build a CONTROLLER image for a machine with IP address
19of 192.168.7.2, you cannot use that image on a machine with a different IP address.
20
21This is very restrictive, since it does not allow the re-use of CONTROLLER/COMPUTE
22images.
23
24Openstackchef.bbclass facilitates the reuse of openstack images across multiple
25machines. It does this by providing a mechanism for openstack related services
26to register all configuration files that have run-time dependent variables like IP
27address in them.
28
29By inheriting openstackchef, and registering these configuration files
30with openstackchef, the services are no longer tied to a specific
31run-time environment. This is because, openstackchef makes it possible
32for the registered configuration files to be recreated at run-time when
33any of the environment variables changes.
34
35The configuration files are registered with openstackchef by assigning
36them to the variable CHEF_SERVICES_CONF_FILES in the recipe file.
37
38See example below for barbican:
39
40CHEF_SERVICES_CONF_FILES :="\
41 ${sysconfdir}/${SRCNAME}/vassals/barbican-api.ini \
42 ${sysconfdir}/${SRCNAME}/vassals/barbican-admin.ini \
43 "
44Openstackchef makes chef-solo templates out of
45the registered files. At run-time, the deploychef package
46makes a call to chef-solo, which in-turn use the template files
47to recreate the registered configuration files.
48
49Also see additional description in the openstackchef.bbclass header.
50
51In addition to the simple placeholder/value substitution that is
52done by the openstackchef class when creating the templates,
53there are times when recipes need to do morethan a simple placeholder
54substitution. For cases like these, openstackchef provides a mechanism for
55the recipes to provide a special callback function. Openstackchef class
56then makes a call to this special callback function to do any additional substitution.
57
58The special shell callback function is registered with openstackchef by
59assigning it to the variable CHEF_SERVICES_SPECIAL_FUNC.
60
61The python-neutron recipe defines a special function and specifies it
62as shown below.
63
64CHEF_SERVICES_SPECIAL_FUNC := "deploychef_services_special_func"
65
66Whenever the configuration files of any openstack service
67changes, the service usually needs to reload the configuration file.
68The list of scripts/priority levels responsible for restarting
69the service when its configuration files change are assumed to
70be provided by the following variables:
71
72INITSCRIPT_PACKAGES
73INITSCRIPT_NAME_x or INITSCRIPT_NAME
74INITSCRIPT_PARAMS_x or INITSCRIPT_PARAMS
75
76Here is an example of how python-barbican specifies these variables.
77INITSCRIPT_PACKAGES = "${SRCNAME}"
78INITSCRIPT_NAME_${SRCNAME} = "barbican-api"
79INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
80
81In addition, there are services that might need to be restarted but does
82not necessary have a configuration file. These services can also advertise
83themselves to openstackchef with the above variables.
84
85However, failure to provide appropriate values for the above variables after
86registering a set of configuration files for an openstack service will
87lead to the service not working properly.
88
89Dependencies
90------------
91This class depends on the deploychef package for run-time implementation of
92the class. However, the end user does not have to do anything about this
93dependency, because it's resolved at build time and all deploychef package
94files are automatically included on the rootfs of resulting image.
95Openstackchef class creates the template files used by the deploychef package
96to reconfigure an openstack node.
97
98Deploychef executes chefsolo at run-time to recreate
99the configuration files for openstack services from template files
100created by openstackchef.bbclass at build time.
101Chefsolo in turn uses the attributes and templates files to overwrite
102the configuration files for services like neutron, nova, swift, etc..
103that had registered their configuration files with openstackchef class
104at build time.
105
106The base directory for the deploychef package is /opt/deploychef.
107There are many files that goes into the re-configuration of an
108openstack deployment, however, two are worth mentioning.
109
1101 . Default variables in openstack and the values they hold can be found in:
111
112/opt/deploychef/cookbooks/openstack/attributes/default.rb
113
1142. A shell script file that should be executed to reconfigure the stack
115on CONTROLLER, COMPUTE or allinone nodes.
116
117/opt/deploychef/run-deploychef
118
119The script file above should be executed when any of the run-time environment
120variables found at /opt/deploychef/cookbooks/openstack/attributes/default.rb
121is changed.
122
123Run-time
124-------
125Allinone: An allinone node boots-up with openstack re-configured and all services
126accessible either through the command-line or through horizon.
127
128CONTROLLER & COMPUTE:
129Both CONTROLLER and COMPUTE nodes boots-up with their respective IP address
130updated using the IP address on the interface of the machine on which they run.
131
132For the CONTROLLER, you should be able to access horizon at this point. However,
133both the CONTROLLER and COMPUTE are not aware of each other at this point.
134
135For them to be made aware of each other, we need to inform the COMPUTE node of
136the location of the CONTROLLER node, similarly, we need to inform the CONTROLLER
137node about the location of the COMPUTE node.
138
139In order to accomplish this on each node, edit IP address field in the file
140
141/opt/deploychef/cookbooks/openstack/attributes/default.rb
142
143On the CONTROLLER node, change COMPUTE's IP address to the IP address
144of the machine on which you have openstack COMPUTE deployed.
145
146Assuming COMPUTE's IP address was set to "192.168.7.4" at build-time and the
147current IP address of the machine on which you have COMPUTE deployed is
148"128.224.149.164". Then the line
149
150default["COMPUTE_IP"] = "192.168.7.4"
151
152should be changed to
153
154default["COMPUTE_IP"] = "128.224.149.164"
155
156
157Now cd into the base directory of deploychef and execute the script
158'run-deploychef'.
159
160cd /opt/deploychef
161./run-deploychef
162
163Note: It's important that you 'cd' into /opt/deploychef when running
164run-deploychef script, because this script makes a call to chefsolo which
165references files from /opt/depoychef base directory.
166
167Wait for the script to finish executing and you are shown the prompt.
168
169In a similar vein, repeat the above process on the COMPUTE node, but this
170time, it's the CONTROLLER's IP address you will be changing. Leave the COMPUTE's
171IP address as is.
172Assuming CONTROLLER's IP address was set to "192.168.7.2" at build-time and the
173current IP address of the machine on which you have CONTROLLER deployed is
174"128.224.149.162". Then the line
175
176default["CONTROLLER_IP"] = "192.168.7.2"
177
178should be changed to
179
180default["CONTROLLER_IP"] = "128.224.149.162"
181
182
183Again 'cd' into the base directory of deploychef and execut the script
184'run-deploychef'.
185
186cd /opt/deploychef
187./run-deploychef
188
189
190At this point, both COMPUTE and CONTROLLER have been configured and should be
191communicating with one another.
192
193Maintenance
194-----------
195This class is maintained by Wind River Systems, Inc.
196Contact <support@windriver.com> or your support representative for more
197information on submitting changes.
198
199
200Building with openstack.bbclass
201-------------------------
202This class should be inherited by recipe/class files of openstack services in order
203for the functionality described above to work.
204If any component of openstack is left out, that component will
205not work correctly when the stack is reconfigured at run-time, and as a result,
206the openstack deployment will not work.
207
208
209License
210-------
211Copyright (C) 2014 Wind River Systems, Inc.
212
213The right to copy, distribute or otherwise make use of this software may
214be licensed only pursuant to the terms of an applicable Wind River license
215agreement. No license to Wind River intellectual properly rights is granted
216herein. All rights not licensed by Wind River are reserved by Wind River.
217
218Source code included in tree is under the LICENSE
219stated in class file (.bbclass file) unless other stated.