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