Attach Volume operation (part I)-5 minutes a day to play OpenStack (53)

Source: Internet
Author: User

In the previous section we created the volume, this section discusses how to volume attach to Instance, and today is the first part.

The main purpose of Volume is to provide instance for use as a virtual hard disk. The Volume is mounted on the instance via the Attach operation. In this section we will discuss in detail how Cinder is implemented Attach.

In the previous section, we successfully created the volume based on the LVM provider. Each volume is actually a LV in the VG on the storage node.

So the question is: How can the local LV on the storage node be mounted on the instance of the compute node? Typically, storage nodes and compute nodes are different physical nodes.

The solution is to use ISCSI, as shown in

ISCSI is a client-server architecture with target and initiator two terms.

Target
A device that provides iSCSI storage resources, simply put, is an iSCSI server.

Initiator
Devices that use iSCSI storage resources, that is, iSCSI clients.

Initiator needs to establish an ISCSI connection with Target, perform a login operation, and then use the block storage device above target. The block storage device provided by Target supports a variety of implementations, and the LV is used in our experimental environment. The Cinder storage node Cinder-volume uses the TGT software by default to manage and monitor ISCSI target, nova-compute using ISCSIADM to perform initiator-related operations on compute nodes.

Let's take a look at the flowchart of Attach operation

    1. Send attach request to Cinder-api

    2. Cinder-api sending messages

    3. Cinder-volume Initializing the volume connection

    4. Nova-compute will volume attach to instance

Let's discuss each step in detail below.

send attach request to Cinder-api

The customer (which can be an OpenStack end user, or another program) sends a request to CINDER-API: "Please attach this volume to the specified instance.

Here we will volume "vol-1" Attach to instance "C2". Before the attach operation, the virtual disks on the C2 are as follows:

Go to GUI Action menu Project, Compute, Volumes

Select volume "Vol-1" and click "Manage Attachments"

In the Attach to Instance drop-down list, select Instance "C2"

Click "Attach Volume"

Cinder-api will receive the attach volume request, the attach request actually contains two steps:

    1. initializing volume connections volume is created, only the corresponding storage objects (such as LV) are created in volume provider, and the compute nodes are unusable. The Cinder-volume needs to export the volume in some way, and the compute nodes will be able to access it. The export process is "initializing the volume Connection". The following is a CINDER-API log file/opt/stack/logs/c-api.log in the relevant information initialize_connection the specific work is done mainly by Cinder-volume, will be discussed in detail later.

    2. Attach volume after initializing the volume connection, The compute node mounts the volume to the specified instance, completing the attach operation. The following is information about the records in Cinder-api log file/opt/stack/logs/c-api.log

Attach's specific work is done mainly by Nova-compute, and will be discussed in detail later.

Cinder-api sending Messages

Cinder-api in two steps to complete the attach operation, so the corresponding will be sent to RabbitMQ successively two messages:

    1. initializing volume connections CINDER-API does not print a log of sent messages, only the/opt/stack/cinder/cinder/volume/api.py is viewed through source code, by Initialize_connection

    2. Attach volume Cinder-api The log for sending messages is not printed and can only be viewed from source code

In the next section we discuss how Cinder-volume and nova-compute implement attach operations.

Attach Volume operation (part I)-5 minutes a day to play OpenStack (53)

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.