After you have installed Openstack via devstack, what if you need to change the IP address of OpenStack's controller/compute nodes for whatever reason?
OpenStack deployment via devstack is stateless or ephemeral by design. As such, all OpenStack configuration files and databases are re-generated from scratch every time you run stack.sh. Therefore, when the IP address of any OpenStack node changes, you just need to redefine HOST_IP/SERVICE_HOST environment variables in localrc. All relevant OpenStack configuration files will then automatically be re-generated by stack.sh.
In your OpenStack development environment, if the IP address of an OpenStack node changes often, it is useful to define HOST_IP environment variable in localrc as follows, instead of defining it statically (e.g., 192.168.1.10).
HOST_IP=`ifconfig eth0 | sed -ne 's/.*inet addr:\([^ ]*\).*/\1/p'`
One caveat: there is one more configuration file (besides localrc) that you need to manually update when the IP address of the controller node changes. stack.sh generates a user-specific MySQL configuration file in ~/.my.cnf, and includes the IP address of MySQL server there. If the MySQL configuration file already exists, stack.sh does not overwrite the file. Thus, you need to update the IP address manually, or comment out if-clause in stack.sh, as follows.
# if [[ ! -e $HOME/.my.cnf ]]; then cat <
$HOME/.my.cnf [client] user=$MYSQL_USER password=$MYSQL_PASSWORD host=$MYSQL_HOST EOF chmod 0600 $HOME/.my.cnf # fi
Without this change, you may encounter a MySQL connection timeout error on OpenStack controller node while running stack.sh, because it attempts to access MySQL server at an old IP address.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.