Openstack is a Cloud Orchestration software. Devstack script provides a development environment for Openstack. Devstack provides a great way to get hands-on with Openstack. I had written 2 earlier blogs on installing Devstack for Openstack Icehouse and Openstack Juno. I received multiple queries on installation related issues. To make this simple, I created Vagrant images for different Openstack releases. With this, VM creation and Devstack installation can all be done with a single script. In this blog, I will walk-thru the steps for the installation.
Vagrant makes it easier to create and share VMs and this makes Vagrant Devops friendly. For getting started on Vagrant, you can refer to my earlier blog on Vagrant.
My Development environment:
Windows 7 machine with Virtualbox 4.3.28 and Vagrant 1.7.2.
- Install Virtualbox from here. For basics of Virtualbox, please refer my earlier blog on Virtualbox.
- Install Vagrant from here.
Following are typical issues I have seen folks facing when running Devstack:
- There are some pre-requisite software that needs to be installed before running Devstack like setting up Python environment etc.
- It is needed to setup VM with atleast 4G RAM and 8G hard disk. Otherwise, either Stacking will fail or instance creation will fail.
- 2 Network interfaces needs to be created, 1 for Internet access and another which Openstack uses. If this is not done, it can cause issues.
- Devstack configuration is mentioned in localrc/local.conf. Here details on Openstack service configuration is mentioned. It is needed to make sure that the configuration is correct and does not cause conflicts.
- I have uploaded my Vagrant scripts and Devstack scripts to github.
- We need to download the Vagrant script from my github location. The only thing to be modified is the private IP address for the VM. This is the host-only interface for Virtualbox. This private IP address can directly be accessed from the host machine.
- We can do “vagrant up” after this. This will create VM(which includes setting up hard disk, memory and networking), setup pre-requisite software, download Devstack and then do the stacking.
- After this, we can access horizon from the localhost using the private IP address. We can also ssh to the VM and access the Openstack services.
Workflow in detail:
First step is to download Vagrant scripts:
git clone https://github.com/smakam/vagrant.git
This contains scripts for Icehouse, Juno and Kilo releases.
Next, we need to pick private IP address for the VM. For this, we can check the host-only interfaces already present in Virtualbox.
$ VBoxManage list -l hostonlyifs Name: VirtualBox Host-Only Ethernet Adapter #6 GUID: 9aea0754-b2ed-44ec-83ca-02e8e52f445e DHCP: Disabled IPAddress: 192.168.236.1 NetworkMask: 255.255.255.0 IPV6Address: fe80:0000:0000:0000:95d6:98f7:2993:4dd8 IPV6NetworkMaskPrefixLength: 64 HardwareAddress: 08:00:27:00:50:16 MediumType: Ethernet Status: Up VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #6 | | Name: VirtualBox Host-Only Ethernet Adapter GUID: 759f41ac-c5ef-46fd-9508-7fa4b83b6da4 DHCP: Disabled IPAddress: 192.168.56.1 NetworkMask: 255.255.255.0 IPV6Address: IPV6NetworkMaskPrefixLength: 0 HardwareAddress: 08:00:27:00:84:68 MediumType: Ethernet Status: Up VBoxNetworkName: HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter
I already had 6 host-only networks. We can either pick 1 of the networks and allocate IP from that subnet for the VM or we can create a new host-only network. To create a new network;
VBoxManage hostonlyif create
Lets say that we want to run Openstack Juno. Lets first go to Juno directory:
$ pwd /c/Users/../vagrant/devstack/juno ~/vagrant/devstack/juno (master) $ ls Vagrantfile bootstrap.sh
“Vagrantfile” specifies the VM environment and “bootstrap.sh” contains the initial setup scripts that are run in the VM. The only change needed is to set the IP address in these 2 files. Lets say that I pick a private IP address in Host-only adapter 6 network, I can choose any IP address in “192.168.236.x” subnet.
In Vagrantfile, we can set the IP address in this line. Here, we picked “192.168.236.100”.
config.vm.network "private_network", ip: "192.168.236.100"
In bootstrap.sh, we can set the IP address in this line.
sed -i '/HOST_IP/ c HOST_IP=192.168.236.100' local.conf
Now, we can run “vagrant up” in that directory. This will take 30 mins – 1 hr based on your internet connection the first time.
When everything goes well, this is what we should see in the end:
This is your host ip: 192.168.236.100 Horizon is now available at http://192.168.236.100/ Keystone is serving at http://192.168.236.100:5000/ The default users are: admin and demo The password: openstack
To login to the VM, we can do “vagrant ssh” from same directory. If there are failures in the above step, console logs usually helps. If there are failures in stacking, you can login to VM and check for logs in “/opt/stack/logs”.
I have modified local.conf file in Devstack directory to start minimum number of Openstack services. I have commented out many services. If you want to turn them on, you can uncomment some of those respective lines. Also, I have set the “OFFLINE” flag as False. After running the Devstack for first time, you can set the OFFLINE flag to True for further iterations. You can set the OFFLINE flag back to False when changing local.conf.
Since the private network is accessible from host machine, we can access Horizon interface by going to “http://192.168.236.100” from the host machine browser. I also tried creating nova instances and made sure that they get created successfully.
I have tried the above procedure with Openstack Kilo and Icehouse releases as well using the above script and they work fine. Please let me know if this simplifies Devstack installation process