Launch and shut off operation details-5 minutes a day to play OpenStack (30)

Source: Internet
Author: User
Tags rabbitmq

This section details the instance launch and shut off operations, as well as tips on how to quickly locate useful information in the log.

Launch

Launch instance should count Nova's most important operations.

Careful study of Lanuch operations can help us fully understand the coordination and operational mechanisms of the Nova sub-services.

We have discussed each nova-* sub-service in detail in the launch operation as an example. We will not repeat them here, just to review the process.

  1. The customer (which can be an OpenStack end-user or other program) sends a request to the API (NOVA-API): "Create a Instance for me"

  2. After the API has made some necessary processing of the request, a message is sent to Messaging (RabbitMQ): "Let Scheduler create a Instance"

  3. Scheduler (Nova-scheduler) Gets the message from Messaging to the API, then executes the scheduling algorithm and selects node A from several compute nodes

  4. Scheduler sent a message to Messaging: "Create this Instance on compute node A"

  5. The Compute (nova-compute) of compute node A gets the message Scheduler sent to it from Messaging and then creates Hypervisor from the Driver Instance of this node.

  6. During the Instance creation process, Compute sends a message to conductor (Nova-conductor) through Messaging if the database information needs to be queried or updated, conductor is responsible for database access.

Shut Off

Below is the flowchart of shut off instance

    1. Send a request to NOVA-API

    2. Nova-api sending messages

    3. Nova-compute Performing actions

Let's discuss each step in detail below.

send a request to Nova-api

The customer (which can be an OpenStack end user or another program) sends a request to the API (NOVA-API): "Help me close this Instance."

View Log/opt/stack/logs/n-api.log

Talk a little more about how to quickly find useful information in a log file. For beginners, this is not an easy thing, because there are a lot of entries and content in the log, especially when the debug option is opened, it is easy to be dazzled by people.

Here are a few tips for you:

  1. First determine the large scope, such as before the operation with Tail-f to print the log file, so that the need to view the log must be in the print output after the operation of these contents. You can also use timestamps to determine the required log range.

  2. Use the code module to quickly locate useful information. nova-* Sub-services have their own specific code modules:
    Nova-api
    Nova.api.openstack.compute.servers
    Nova.compute.api
    Nova.api.openstack.wsgi

    Nova-compute
    Nova.compute.manager
    nova.virt.libvirt.*

    Nova-scheduler
    Nova.scheduler.*

  3. Use the Request ID to find related log information. In the above log, we can use the Request ID "REQ-1758B389-A2D0-44CC-A95A-6F75E4DC07FD" to quickly locate other log entries in the N-api.log phase and shut off operation. It should be added that the Request ID is a cross-log file, and this feature helps us to find the relevant information in the log files of other sub-services, and we will see the application of this technique shortly after.

Nova-api sending Messages

Nova-api sent a message to Messaging (RabbitMQ): "Close this Instance" Nova-api did not log the action to send the message, but we can verify it by looking at the source code. When it comes to source code, you might think you're in a haystack. In fact, it is very simple, the above log has been clearly told we need to see the source code in/opt/stack/nova/nova/compute/api.py 1977 lines, the method is force_stop.

The Force_stop method finally calls the Stop_instance method of the object Self.compute_rpcapi. In the OpenStack source code, the object named Xxx_rpcapi is the message queue of XXX. The Xxx_rpcapi.yyy () method represents a message that sends a YYY operation to the message queue of XXX.

So the function of Self.compute_rpcapi.stop_instance () is to send a stop instance message to the Nova-compute message queue on RabbitMQ.

Here is a note: The premise of closing instance is that instance is currently running on a compute node, so there is no need for Nova-scheduler to help us pick the right node, which is different from the launch operation.

Nova-compute Performing Actions

View the log/opt/stack/logs/n-cpu.log on the COMPUTE node

Here we take advantage of the Request ID "REQ-1758B389-A2D0-44CC-A95A-6F75E4DC07FD" to quickly locate the log entry in N-cpu.log to Nova-compute close instance.

Summary

When analyzing an operation, we first need to clarify the internal process of the operation, and then go to the corresponding node to view the log. For example, the process for shut off is:

    1. Send a request to NOVA-API

    2. Nova-api sending messages

    3. Nova-compute Performing actions

1, 22 steps are performed on the control node to view the log of the NOVA-API. The 3rd step is performed on the compute nodes, viewing the logs of the Nova-compute.

Launch and shut off operation details-5 minutes a day to play OpenStack (30)

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.