How to quickly deploy an OpenStack environment--devstack project

Source: Internet
Author: User
Tags chmod zip ssh git clone

Preface

Every time you mention deploying OpenStack is a very complex thing, and of course many people will mention the use of devstack to quickly deploy OpenStack, generally we use devstack to deploy the development environment, It can be implemented on a machine to deploy a standalone version of the OpenStack environment containing the main components, I have never tried, these two days have been applied, the greatest feeling is that although it is really silly, but often encounter inexplicable problems.


Devstack

Devstack Automatic source installation, users only need to download the response of the Branch (version) script, modify the relevant configuration file, you can automate the installation, automation to solve the dependency, the very aspect.


Environment

Testing VMs in a native virtual machine environment is generally WorkStation

It should be noted that the user can choose the two workstation network mode, must be able to achieve the connection of the extranet.


1, Bridging mode (disadvantage, because the bridge mode is directly connected to the local network hosting host, so the related virtual machine may occupy the existing IP resources)

2, NAT (can be connected to the outside network, but also can share an IP segment for virtual machine IP use, recommended use)



3, because OpenStack needs to obtain a fixed connection IP, and does not recommend the use of DHCP, so the above does not check the DHCP, and the virtual machine fixed the relevant IP address.

4, I use the virtual machine os for Ubuntu 14.04 LTS, set fixed IP

root@controller:~# cat/etc/network/interfaces
# This file describes the network interfaces available on your system
  # and how to activate them. For more information, see Interfaces (5).

# The Loopback network interface
Auto lo
iface lo inet Loopback

# The Primary network interface
Auto eth0< C7/>iface eth0 inet static
        address 192.168.27.128
        netmask 255.255.255.0
        Gateway 192.168.27.2
        Network 192.168.27.0
        broadcast 192.168.27.255
        # Dns-* Options is implemented by the RESOLVCONF package, if Inst alled
        dns-nameservers 114.114.114.114

5, set apt source, because you may install the latest version of OpenStack, so it is recommended to modify the source to the national Ubuntu official source

root@controller:~# cat/etc/apt/sources.list
deb http://cn.archive.ubuntu.com/ubuntu/trusty main restricted Universe Multiverse
Deb Http://cn.archive.ubuntu.com/ubuntu/trusty-security main restricted universe multiverse
deb Http://cn.archive.ubuntu.com/ubuntu/trusty-updates main restricted universe Multiverse
Deb/http cn.archive.ubuntu.com/ubuntu/trusty-proposed main restricted universe Multiverse
Deb/http Cn.archive.ubuntu.com/ubuntu/trusty-backports Main restricted Universe multiverse


After setting up update Apt-get update

6. Install git and download Devstack related version

Apt-get Install git

Download Devstack related Mitaka (latest version)

Cd/home
git clone http://git.trystack.cn/openstack-dev/devstack.git-b Stable/mitaka

Create a stack user directly from a tool script (root user run stack.sh is not currently supported)

cd/home/devstack/tools/
./create-stack-user.sh

Modify Devstack Directory Permissions

Chown-r stack:stack/home/devstack
chmod 777/dev/pts/0

Switch Stack user

Su Stack
cd/home/devstack

7, enter the/home/devstack directory, we can see the following documents

stack@controller:/home/devstack$ ll Total 372 drwxr-xr-x stack stack 4096 Jul 12:46./drwxr-xr-x 4 root root 4 096 Jul 12 10:03..  /drwxr-xr-x 9 Stack stack 4096 Jul 12:46 accrc/-rwxr-xr-x 1 stack stack 3306 Jul 10:03 clean.sh* drwxr-xr-x 2 Stack stack 4096 Jul 10:03 data/drwxr-xr-x 3 stack stack 4096 Jul 10:03 doc/drwxr-xr-x 2 stack stack 4096 Ju L 10:03 driver_certs/-rw-r--r--1 stack stack 923 Jul 10:03 exerciserc drwxr-xr-x 2 stack stack 4096 Jul 12 10 : exercises/-rwxr-xr-x 1 Stack stack 1974 Jul 10:03 exercise.sh* drwxr-xr-x 2 stack stack 4096 Jul 10:03 extr As.d/drwxr-xr-x 9 Stack stack 4096 Jul 10:51 files/-rw-r--r--1 stack stack 24769 Jul 10:03 functions-rw-r--r-  -1 Stack stack 73963 Jul 10:03 functions-common-rw-r--r--1 stack stack 3774 Jul 10:03 future.rst drwxr-xr-x 2 Stack stack 4096 Jul 10:03 gate/drwxr-xr-x 8 stack stack 4096 Jul 10:03. git/-rw-r--r--1 Stack Stack v J UL 12 10:03. gitignore-rw-r--r--1 Stack stack 109 Jul 10:03. gitreview-rw-r--r--1 Stack stack 14888 Jul 10:03 HAC  King.rst drwxr-xr-x 2 stack stack 4096 Jul 10:03 inc/drwxr-xr-x 8 stack stack 4096 Jul 10:03 lib/-rw-r--r--1  Stack stack 10143 Jul 10:03 license-rw-rw-r--1 stack stack 1726 Jul 11:34 local.conf-rw-r--r--1 Stack stack  1738 Jul 12:32. localrc.auto-rw-r--r--1 Stack stack 340 Jul 10:03. mailmap-rw-r--r--1 Stack stack 1506 Jul 10:03 maintainers.rst-rw-r--r--1 Stack stack 2489 Jul 10:03 makefile-rw-r--r--1 Stack stack 3822 Jul 12 10: OPENRC drwxr-xr-x 2 stack stack 4096 Jul 10:03 pkg/-rw-r--r--1 stack stack, 12:35. prereqs-rw-r--r --1 stack stack 3795 Jul 10:03 readme.md-rwxr-xr-x 1 Stack stack 1188 Jul 10:03 run_tests.sh* drwxr-xr-x 2nd ACK stack 4096 Jul 10:03 samples/-rw-r--r--1 stack stack 481 Jul 10:03 setup.cfg-rwxr-xr-x 1 Stack Stack 7 Bayi Jul 10:03 setup.py*-rw-r--r--1 stack stack 672 Jul 12:46. stackenv-rw-r--r--1 Stack stack 33564 Jul 10:03 stackrc-rw-r--r--  1 stack stack 4908 Jul 12:45 stack-screenrc-rwxr-xr-x 1 stack stack 40292 Jul 10:03 stack.sh* drwxr-xr-x 2 stack Stack 4096 Jul 10:03 tests/drwxr-xr-x 4 stack stack 4096 Jul 10:03 tools/-rw-r--r--1 Stack stack 1644 Jul 1 2 10:03 tox.ini-rwxr-xr-x 1 stack stack 4204 Jul 10:03 unstack.sh*-rw-r--r--1 stack stack 396 Jul 12:38 user
 Rc_early

stack.sh #自动化部署的入口; Determine whether there are LOCALRC files; No, enter interactive mode; Yes, enter configuration mode (if you need input stack.sh required parameters, such as: Database password, Rabbit MQ password, Service TOKEN, etc.) LOCALRC #配置文件; The parameters of the incoming stack.sh, which node Nova deploys, What is the username password OPENRC #环境变量脚本; When you execute the OpenStack command, you import some environment variables such as: Export Os_username = admin unstack.sh #卸载脚本 Lib #每个服务的自动化安装脚 It usually holds nova,swift and other automated installation scripts, all commands executed during manual installation; one file per OpenStack service

8, in general, we need to create a local.conf file in this directory, which can set our relevant information:

For example, git source address settings, Host IP settings, external network and private network IP segment settings, installation components selection and version, related password settings, log path settings.

[[LOCAL|LOCALRC]] # use trystack git mirror git_base=http://git.trystack.cn novnc_repo=http://git.trystack.cn/kanaka/ Novnc.git spice_repo=http://git.trystack.cn/git/spice/spice-html5.git #OFFLINE =true reclone=true # Define images to be
Automatically downloaded during the Devstack built process. Download_default_images=false image_urls= "Http://images.trystack.cn/cirros/cirros-0.3.4-x86_64-disk.img" host_ip
=192.168.27.128 # Credentials Database_password=pass admin_password=pass service_password=pass SERVICE_TOKEN=pass Rabbit_password=pass Horizon_branch=stable/mitaka Keystone_branch=stable/mitaka NOVA_BRANCH=stable/mitaka NEUTRON_ Branch=stable/mitaka Glance_branch=stable/mitaka Cinder_branch=stable/mitaka #keystone Keystone_token_format=uuid # #Heat Heat_branch=stable/mitaka enable_service H-eng h-api h-api-cfn H-API-CW # # Swift Swift_branch=stable/mitaka Enable D_services+=,s-proxy,s-object,s-container,s-account Swift_replicas=1 swift_hash=011688b44136573e209e # Enabling NeuTron (Network) Service disable_service n-net enable_service q-svc enable_service q-agt enable_service q-dhcp Enable_servi Ce q-l3 enable_service q-meta enable_service q-metering enable_service Neutron # Neutron options Q_use_secgroup=true FLO Ating_range= "192.168.27.0/24" fixed_range= "10.0.0.0/24" q_floating_allocation_pool=start=192.168.27.102,end= 192.168.27.110 public_network_gateway= "192.168.27.2" Q_l3_enabled=true public_interface=eth0 q_use_providernet_for
_public=true ovs_physical_bridge=br-ex public_bridge=br-ex Ovs_bridge_mappings=public:br-ex # #VLAN configuration.
Q_PLUGIN=ML2 enable_tenant_vlans=true # Logging Logfile=/opt/stack/logs/stack.sh.log verbose=true LOG_COLOR=True Screen_logdir=/opt/stack/logs

9. Next, only the stack user is required to execute the./stack.sh



Finished installation effect




Installation time estimated 20 minutes, before the installation also read a lot of blog introduction, Devstack installation may not be successful, as expected, I also touched n a hole to be completed.


Issue 1: The following errors are frequently seen during the installation process

+functions-common:apt_get:1122 return 0 +tools/install_pip.sh:main:127 install_get_pip +tools/install_pip.sh: install_get_pip:49 [[-r/home/stack/devstack/files/get-pip.py]] +tools/install_pip.sh:install_get_pip:66 [[!-R/ HOME/STACK/DEVSTACK/FILES/GET-PIP.PY]] +tools/install_pip.sh:install_get_pip:69 local timecond= +tools/install_ pip.sh:install_get_pip:70 [[-r/home/stack/devstack/files/get-pip.py]] +tools/install_pip.sh:install_get_pip:74 Curl-f–retry 6–retry-delay 5-o/home/stack/devstack/files/get-pip.py https://bootstrap.pypa.io/get-pip.py total% Re ceived% xferd Average speed time Time time current Dload Upload Total spent left speed 1488k 1488k 0 0 6489 0 0:0 3:54 0:03:54–:–:–23270 +tools/install_pip.sh:install_get_pip:77 touch/home/stack/devstack/files/ get-pip.py.downloaded +tools/install_pip.sh:install_get_pip:79 sudo-h-E python/home/stack/devstack/files/ Get-pip.py-c/home/stack/devstack/tools/cap-pip.txt Collecting pip!=8 (from-c/home/stack/devstaCk/tools/cap-pip.txt (line 1))/tmp/tmpfip0vp/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318:  Snimissingwarning:an HTTPS request has been made, and the SNI (Subject Name Indication) extension to TLS are not available On the This platform. This could cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this.
For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. /tmp/tmpfip0vp/pip.zip/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122:insecureplatformwarning:a true Sslcontext object is not available. This prevents URLLIB3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this.
For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. Downloading PIP-8.1.2-PY2.PY3-NONE-ANY.WHL (1.2MB) 24% |####### |296kB 4.7kb/s ETA 0:03:11exception:traceback (most recent call last): File "/tmp/tmpfip0vp/pip.zip/pip/basecommand.py", 
Line 215, in main status = Self.run (options, args) File '/tmp/tmpfip0vp/pip.zip/pip/commands/install.py ', line 299, in Run
Requirement_set.prepare_files (Finder) File "/tmp/tmpfip0vp/pip.zip/pip/req/req_set.py", line 370, in Prepare_files ignore_dependencies=self.ignore_dependencies)) File "/tmp/tmpfip0vp/pip.zip/pip/req/req_set.py", line 587, in _ Prepare_file session=self.session, hashes=hashes) file "/tmp/tmpfip0vp/pip.zip/pip/download.py", line 810, in Unpack_ URL hashes=hashes file "/tmp/tmpfip0vp/pip.zip/pip/download.py", line 649, in Unpack_http_url hashes) file "/tmp/
tmpfip0vp/pip.zip/pip/download.py ", line 871, in _download_http_url _download_url (resp, link, content_file, hashes) File "/tmp/tmpfip0vp/pip.zip/pip/download.py", line 595, in _download_url hashes.check_against_chunks (downloaded_ Chunks) File "/tmp/tmpfip0vp/pip.zip/pip/utils/hashes.py", line +, inCheck_against_chunks for Chunk in Chunks:file "/tmp/tmpfip0vp/pip.zip/pip/download.py", line 563, and written_chunks for C Hunk in Chunks:file "/tmp/tmpfip0vp/pip.zip/pip/utils/ui.py", line 139, with ITER for x in It:file "/tmp/tmpfip0vp/pip.zip /pip/download.py ", line 552, in Resp_read decode_content=false): File"/tmp/tmpfip0vp/pip.zip/pip/_vendor/requests/ packages/urllib3/response.py ", line 353, in stream data = Self.read (Amt=amt, decode_content=decode_content) File"/tmp/ tmpfip0vp/pip.zip/pip/_vendor/requests/packages/urllib3/response.py ", line +, in read Flush_decoder = True File"/usr /lib/python2.7/contextlib.py ", line +, in __exit__ self.gen.throw (type, value, Traceback) File"/tmp/tmpfip0vp/pip.zip /pip/_vendor/requests/packages/urllib3/response.py ", line 242, in _error_catcher raise Readtimeouterror (Self._pool,
None, ' Read timed out. ') Readtimeouterror:httpsconnectionpool (host= ' pypi.python.org ', port=443): Read timed out.

Workaround: This is due to the default Devstack in using Pip to download the Django framework, due to the foreign source instability, often there is a time-out situation, it is recommended to use domestic sources, such as the use of watercress source.

1. Create a. Pip folder (preceded by a ".") in the root directory.

2, enter the. pip folder to create the pip.conf file, enter the following content

[Global]
Trusted-host =  pypi.douban.com
index-url = http://pypi.douban.com/simple

Question 2: I don't have a record of the process, but the mistakes I've seen in my mind can't be resolved images.trystack.cn

Solve: This problem to solve, direct ping images.trystack.cn get the IP address of the relevant domain name, and then enter/etc/hosts, add the domain name and IP corresponding relationship can be.


Issue 3: Virtual machine created in demo tenant, set floating IP, cannot ping.

Resolution: This is my personal low-level error, did not pay attention to the demo combination of security groups, set ICMP and ssh can be both ping and SSH link.





How can I access OpenStack normally after restarting Devstack?


1. If you are a physical machine, there is a STACK-SCREENRC under the/home/devstack file

stack@controller:/home/devstack$ screen-c STACK-SCREENRC
cannot open your terminal '/DEV/PTS/33 '-please check.

This issue occurs after you switch the root user chmod 777/dev/pts/33 after re-executing

2. If you are a virtual machine, you will not connect the IP of the virtual machine.

Because Eth0 Bridge to Br-ex above go, and restart after Br-ex no IP configuration, eth0 from Br-ex up, or manually through Ifconfig configuration IP, can solve the problem.


Of course, you can also create a snapshot through Vmwork station, each time you need to restore only to the snapshot, or you will not even the virtual machine's IP can be connected.

Another way to do this is to create a dual network card for your virtual machine, managing the control network separately from the external network, or you can solve the problem.



Reference Document: http://www.chenshake.com/openstack-project-series-3-devstack/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.