|
Install OpenStack all-in-one
by Chef Cookbook
My Environment Overview:
(you must change the ips according to your own environment)
OpenStack all-in-one node (is a real PC)
hostname: allinone
IP: 9.123.141.69, 10.10.0.1, 172.40.0.1
Chef Server (is a VM on the above PC):
hostname: chef-svr
IP: 9.123.141.215, 10.10.0.20
Network for installing OpenStack: 10.10.0.0 (Because my chef server is a vm on all-in-one node pc, so I can not use network of 9.123.141.0 for installation)
Network for management: 9.123.141.0 (Office network)
Network for Vms in OpenStack: 172.40.0.0
Chef Server web console: http://9.123.141.215:4040, username: admin, default password: chef321go
1 Prepare environment
1.1 Prepare environment for all-in-one node
1.1.1 If the all-in-one node has a previous installation of OpenStack (no matter it was successful or failed), you should run the clean.sh to avoid any duplicate settings of components in OpenStack. (Please upload the files bellow onto the all-in-one node firstly).
# cd /root/openstack-cookbooks-allinone
# bin/clean.sh
1.1.2 Set yum repos for all-in-one node
[rbel6]
name=RBEL 6
baseurl=http://9.115.78.35/rbel6
enabled=1
gpgcheck=0
[rhel63]
name=RHEL ISO
baseurl=http://9.115.78.35/rhel/6.3/x86_64/
enabled=1
gpgcheck=0
You should pass BSO before installing OpenStack to ensure all-in-one node can access the yum repo on 9.115.78.35.
1.1.3 Make sure the following packages are installed on the all-in-one node
gcc
gcc-c++
python
ruby
ruby-devel
1.1.4 Add a network bridge for OpenStack Vms on all-in-one node
# vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
BOOTPROTO=static
BROADCAST=172.40.0.255
IPADDR=172.40.0.1
NETMASK=255.255.0.0
NETWORK=172.40.0.0
ONBOOT=yes
TYPE=Bridge
And then restart the network service:
# service network restart
1.1.5 Prepare volume group for cinder
Create a volume group called "cinder-volumes" on all-in-one node (the command is “vgcreate”). This step is optional, if you cannot create a volume group called “cinder-volumes”, you can use the existing one (use command “vgdisplay” to check the name of current volume group).
1.1.6 Remove vhost_net module on all-in-one node
(you may need to stop all the vms on that machine at first)
# rmmod vhost_net
1.2 Prepare environment for Chef Server
1.2.1 Upload necessary packages of Chef and OpenStack to chef server
/install/ibm-rpms
/install/prereq-rpms
1.2.2 Add host info to chef server
# vi /etc/hosts
10.10.0.1 allinone
1.2.3 Upload images to Chef Server “/install/images/cirros/*.*”
cirros-0.3.0-x86_64-blank.img
cirros-0.3.0-x86_64-initrd
cirros-0.3.0-x86_64-vmlinuz
1.2.4 Upload mysql package to Chef Server
/install/mysql-2.9.0.gem
2. Install and config Chef Server
(You can skip this step if chef server is already installed and configured)
(I used the xCAT Server as the Chef Server: chef-svr)
2.1 Make sure SELinux and Firewall are disabled.
2.2 Add yum repos
# vi /etc/yum.repo.d/rbel.repo
[rbel6]
name=RBEL 6
baseurl=http://9.115.78.35/rbel6
enabled=1
gpgcheck=0
2.3 Set the ntp server
Modify the ntp config file:
# vi /etc/ntp.conf
Enable the local ntp server:
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
Disable the public ntp servers, and wait several minutes:
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org
2.4 Start ntpd
# chkconfig ntpd on
# service ntpd start
2.5 Install Chef server
# yum -y install rubygem-chef-server
2.6 Start Chef server
# setup-chef-server.sh
2.7 Add the first API client, API client can be used to upload cookbooks.
# knife configure -i
All questions use default option, if no error occur, the first API client will be setup. After that, run command "knife node list" to verify. If no output, then API client is ready.
# knife node list
3. Prepare Cookbooks and Settings on Chef Server
# cd /root/openstack-cookbooks-allinone
3.1 Modify environment/openstack-ibm-working.json
"ipv4_cidr": "172.40.0.0/16",
"gem_repo":{
"url":"http://10.10.0.20/install",
"mysql_gem":"mysql-2.9.0.gem"
},
"networks": [
{
"bridge_dev": "",
"ipv4_cidr": "172.40.0.0/16",
"bridge": "br0",
}
"osops_networks": {
"glance": "9.123.141.0/24",
"nova": "9.123.141.0/24",
"public": "9.123.141.0/24",
"management": "9.123.141.0/24"
},
"mysql": {
"db": {
"bind_host": "0.0.0.0"
},
},
"network": {
"public": "9.123.141.69/25"
}
3.2 Modify cookbooks/nova/attributes/default.rb
default["nova"]["network"]["public_interface"] = "br0" (the NIC on nova node which just used for communicate with VMs of OpenStack)
default["nova"]["network"]["dmz_cidr"] = "172.40.0.0/16"
3.3 Modify cookbooks/cinder/templates/default/cinder.conf.erb
iscsi_ip_address = 9.123.141.69
If the name of your volume_group if not “cinder-volumes” (can be shown by command of vgdisplay), you should change this line:
volume_group = cinder-volumes
to the following value:
volume_group = <your volume group name>
3.4 Modify the following lines of file “/root/openstack-cookbooks-allinone/openrc”
export OS_AUTH_URL=http://9.123.141.69:5000/v2.0/
export EC2_URL=http://9.123.141.69:8773/services/Cloud
3.5 Reload cookbooks
# cd /root/openstack-cookbooks-allinone
# bin/reload_cookbooks
4. Install OpenStack for all-in-one node
Install OpenStack from Chef Server
# cd /root/openstack-cookbooks-allinone
# bin/allinone
It doesn't matter if you see the following log info at the beginning:
allinone ERROR: Error installing dep_selector:
ERROR: Failed to build gem native extension.
If the installation is successful, it will end with log info as follows:
allinone [2013-02-18T22:43:00+08:00] INFO: Chef Run complete in 275.639166 seconds
allinone [2013-02-18T22:43:00+08:00] INFO: Running report handlers
allinone [2013-02-18T22:43:00+08:00] INFO: Report handlers complete
allinone Chef Client finished, 150 resources updated
5. Configure OpenStack on all-in-one node
5.1 Sync system time of all-in-one node with chef server
# service ntpd stop
# ntpdate chef-svr
# service ntpd start
5.2 Modify settings for nova
# vi /etc/nova/nova.conf
5.2.1 Check settings for glance api servers in nova.conf:
If there are more than one glance api servers as follows:
glance_api_servers=9.123.141.69:9292,10.10.0.123:9292
That is added by chef server automatically because there are more than one glance nodes in the same chef server. You can edit that line manually:
glance_api_servers=9.123.141.69:9292
5.2.2 Add settings for quotas in nova.conf
skip_isolated_core_check=true
max_cores=128
cpu_allocation_ratio=16.0
quota_cores=128
quota_instances=500
quota_floating_ips=1000
quota_metadata_items=300
quota_security_group_rules=200
quota_security_groups=200
quota_volumes=100
5.2.3 Add settings for allowing resize to same host in nova.conf
# COMPUTE/APIS: if you have separate configs for separate services
# this flag is required for both nova-api and nova-compute
allow_resize_to_same_host=True
5.2.4 Add settings for libvirt inject key, to make ssh key can work
# vi /etc/nova/nova.conf
libvirt_inject_key=true
(In our current cookbook, it is set to false)
5.3 Install guestfs-tools, to make ssh key can work
# yum install libguestfs-tools
5.4 Restart nova api and network service
# service openstack-nova-api restart
# service openstack-nova-network restart
or
# /etc/init.d/openstack-nova-api restart
# /etc/init.d/openstack-nova-network restart
5.3 Reboot the all-in-one node to make sure there isn't any problem after reboot.
6. Verify the OpenStack on all-in-one node
6.1 Copy config files
After OpenStack installed, run these commands on Chef Server:
# cd /root/openstack-cookbooks-allinone
# scp root@allinone:openrc .
# scp bin/upload_image.sh root@allinone:
6.2 On all-in-one node
# . openrc
add the following line into /etc/profile
. openrc
# nova-manage service list
Make sure all service is normal, with a sign of “:)”.
# glance image-list
There is no image yet.
# ./upload_image.sh
# glance image-list
Now we can see the image info in the list, and the status is active.
# nova boot vm01 --image=<image_id> --flavor=1
nova boot vm01 --image=a4a3abaa-d888-4459-bb21-d81b4b30a201 --flavor=1
nova boot vm02 --image=35577069-f54d-43e5-bc46-b83fbad1099b --flavor=1
# nova list
# nova volume-create 1
# nova volume-list
# nova volume-attach <vm_id> <volume_id> /dev/vdb
# nova volume-list
6.3 ssh to the vm
# ssh cirros@<ip>, password: cubswin:)
# sudo su
# fdisk -l
# fdisk /dev/vdb
# mkfs.ext3 /dev/vdb1
# mkdir /data
# mount /dev/vdb1 /data
# cd /data
# vi test.txt
|
|