OpenStack standalone Ubuntu virtual machine environment installation and deployment experience and a brief introduction to the source code structure

Source: Internet
Author: User
OpenStack standalone Ubuntu virtual machine environment installation and deployment experience and a brief introduction to the source code structure (suitable for beginners ). See the OneStack script for details. I. openstack installation and deployment

OpenStack standalone Ubuntu virtual machine environment installation and deployment experience and a brief introduction to the source code structure (suitable for beginners ).

See the http://www.linuxidc.com/Linux/2012-06/63879.htm for the OneStack script.

This article provides a summary of Openstack learning in the last month, including the problem record during installation and deployment in a standalone environment and the source code learning process. It is suitable for beginners.

I. openstack installation and deployment

Currently, the official installation and deployment documents and the OneStack script in Chinese are displayed.

According to the two documents, you can build an environment in the Ubuntu environment of the virtual machine, and some problems may occur in the middle. You can find and solve them.

Because OneStack is Chinese, every sentence in the script has a detailed description, it will be much easier to learn.

You can directly change the IP address in the script to the IP address of your machine, and run the script to work normally.

/Etc/network/interfaces can be changed or not, depending on the specific situation, for example, the virtual machine uses DHCP to automatically assign an IP address, it will change to an IP address after a certain period of time to access the network, anyway, as long as the IP address corresponds to the configuration, OK.

Generally, virtual machines cannot support KVM, so remember to change the cmd_type to qemu.

If you do not know the cause of the failure, you can manually install the module one by one based on the script to find the cause.

For example, if the installation starts from keystone and the test is complete, install glance, nova, and dashbord in sequence.

If you build a source code debugging environment, you can use git clone or apt-get source to obtain the source code. The ide I use is eclipse + pdev. I used to use eclipse.

You can use pip install for source code installation.

If there are still problems that have not been solved, you can refer to the following, maybe it is a problem I have encountered.

1. services such as compute cannot be started properly due to service congestion
After the Nova-compute service is started, it blocks the connection to libmongod. If the virsh list is blocked, run the command killall-9 dmidecode and restart the nova-compute.

2. debug the eventlet when you start the nova-* service. change monkey_patch () to eventlet. monkey_patch (all = False, socket = True, select = True). Otherwise, an error occurs during thread switching.

3. It is blocked when the network service is started. If iptables is obtained in the log, files in lock/nova are deleted and restarted.

4. If the Volume XXX (such as nova-volumes) does not exist when the nova-volumes service is started, you need to create a new partition and create a volume group name for volumes allocation.
Pvcreate/dev/sda6
Can't open/dev/sda6 exclusively. Mounted filesystem?
The above error occurs because the partition file is in use and umount is required.
Pvcreate/dev/sda6
Physical volume "/dev/sda6" successfully created
After creating a physical volume, you can run the "pvdisplay" command to view the physical volume status.
Pvdisplay
--- NEW Physical volume ---
PV Name/dev/sda6
VG Name
PVs Size 1.06 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
Pvuuid N2LgeT-RB4Y-8YEP-lO2J-tDWu-UeCT-4Obl8p
If you need to mount the volume at startup, modify/etc/fstab and add a row of the volume according to the rules.


Create logical volume group
Vgcreate nova-volumes/dev/sda6

If you still have some questions, remember them first. If you have any questions, add them. Below is a brief introduction to the source code of several modules.

Ii. Read Source Code

Keystone, glance, and nova have very similar structures. They use the wsgi protocol, webob, paste, and routes frameworks. People like me who have never touched Python before may have never touched these things, first, you can get a general idea of these frameworks, and then look at the source code to get a general idea of what is going on.

Let's talk about the keystone process. The following is recorded during the learning process. It is directly posted. There may be errors. If you have any questions, please point out. Thank you.

When starting the keystone service, you need to find and parse the keystone. conf configuration file and parse the logging log configuration through the logging. conf configured in keystone. conf.

Deploy. appconfig will parse the section of main section in paste. deploy Configuration
Deploy. loadapp in create_server
In the beginning, load app context is the same as appconfig. Then, use the create method to parse the components of the paste configuration and perform initialization.
Use = egg: Paste # urlmap first gets the parsing execution, enters paste. urlmap # urlmap_factory, and passes in the config map obtained by loadContext as the parameter.
Here, urlmap will correspond to the app through the configured uri. For example, if it is the/2.0 Path in composite: admin, it will continue to find a pipeline: admin_api in each section pre.
Find the configuration of the last application in pipeline and put it in context. app_context. Here is admin_service.
The protocol of Admin_service is paste. app_factory, And the execution method is keystone. service: admin_app_factory.
Find all filters in the same way and put them into context. filter_contexts. Then, use this pipeline context to call the create method. In pipeline, create app context is used first and then create filter context in sequence.
(From here we will return to the keystone module from the deploy module) Create app context and execute admin_app_factory.
Parsing directory template:
Catalog. RegionOne. identity. publicURL
Region = RegionOne
Service = identity
Key = publicURL
String in json format
{'Regionone': {'Identity ': {'publicurl': 'http: // localhost: $ {public_port} s/v2.0 '}}}
Finally, the entire directory template is parsed into a dictionary object in json format.
After parsing, A version_controller with adminURL directory information is obtained,
Add route information to routes. mapper, and then return the constructed router to urlmap.
The route object stores the Request Path, controller information, and action information.
So far, Keystone-all is completed, and two servers are started waiting for the request. One is admin_port waiting, and the other is public_port waiting.
When a request arrives at the service, it executes the filters according to the paste configuration, and then enters the module method for execution according to the route table configuration.

The above introduction mainly focuses on the paste and routes processes. keystone uses these frameworks to provide REST APIs to reduce coupling and provide user authentication functions for each module.
The following describes the glance project.
1. registry provides http Services for DB operations. glance api operates the image metadata stored in the database through http requests to registry,
Although the registry api is accessible, users generally do not directly operate the registry api

2. After the glance-api and glance-registry start the service, find the paste configuration file based on the Application name and project name, and deploy the routing information.
Put the image metadata in the HTTP request header and request the glance-api address as the image file.
Glance-api receives requests and parses request header information starting with x-image-meta and x-image-meta-property-as image metadata,
Then, use the registry client to request the registry service, store the image metadata in the DB, and obtain the ID value as the name of the image file,
After the image file is stored or otherwise, the registry Service is requested to update the metadata information such as the image status again.

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.