Detach Volume operation-5 minutes a day to play OpenStack (55)

Source: Internet
Author: User

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984276078712.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498541555018958.jpg "style=" border:0px;float:none; "/>

in the previous section we succeeded in adding volume to instance through the attach operation, and The opposite operation is detach, which is to unload the volume from the instance.

Is the flowchart of the Detach operation

650 "this.width=650;" title= "/HTTP// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467497984356034717.png "src=" http// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467498541721067251.jpg "style=" border:0px; White-space:normal;float:none; "/>

    1. Send to Cinder-api Detach request

    2. cinder-api send message

    3. nova-compute Detach volume

    4. cinder-volume Delete target

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 detach specify volume on instance.

Here we will detach instance "C2" on the volume "Vol-1" into the GUI Operation menu Project, Compute, Volumes.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498044801052862.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498541821036893.jpg "alt=" Image397.png "style=" border:0px; "/>

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

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984243023774.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498541887045272.jpg "style=" border:0px;white-space:normal;float:none; "/>

Click "Detach Volume".

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984432058753.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498541987049475.jpg "style=" border:0px;white-space:normal;float:none; "/>

Confirm again.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984452088527.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542076062861.jpg "style=" border:0px;white-space:normal;float:none; "/>

CINDER-API will receive a request for detach volume. The log file is in/opt/stack/logs/c-api.log.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984450079829.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542164019883.jpg "style=" border:0px;white-space:normal;float:none; "/>

Cinder-api sending Messages

CINDER-API sends a message detach message. CINDER-API does not print the log that sends the message, only the source code to view the/opt/stack/cinder/cinder/volume/api.py, the method is detach.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984545063791.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542250083910.jpg "style=" border:0px;white-space:normal;float:none; "/>

The operation of the Detach is done jointly by Nova-compute and Cinder-volume:

    1. First Nova-compute detach the volume from the instance and then disconnects the ISCSI target.

    2. Finally cinder-volume Delete the volume related ISCSI target.

These two steps are discussed in detail in the next two subsections.

Nova-compute Detach Volume

Nova-compute first detach the volume from the instance. The log is/opt/stack/logs/n-cpu.log.

650 "this.width=650;" title= "/HTTP// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467497984540068908.png "src=" http// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467498542361067256.jpg "style=" border:0px; White-space:normal;float:none; "/>

At this point, you can see the virtual disks in the XML configuration file that are not already volume by Virsh edit.
650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984644053897.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542434022460.jpg "style=" border:0px;white-space:normal;float:none; "/>

Next, disconnect the ISCSI target.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984671064820.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542550026228.jpg "style=" border:0px;white-space:normal;float:none; "/>

Here are a few steps:

  1. Flush the data in the cache to volume.
    650) this.width=650; "title="/HTTP// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467497984675002515.png "src=" http// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467498542614058488.jpg "style=" border:0px; White-space:normal;float:none; "/>

  2. Remove the SCSI device that corresponds to the volume on the Compute node.
    650) this.width=650; "title="/HTTP// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467497984789021407.png "src=" http// 7xo6kd.com1.z0.glb.clouddn.com/upload-ueditor-image-20160703-1467498542701039067.jpg "style=" border:0px; White-space:normal;float:none; "/>

  3. Disconnect the ISCSI target with the Iscsiadm logout,delete operation.
    650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984821020614.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542795022779.jpg "style=" border:0px;white-space:normal;float:none; "/>

Compue-nova completed the detach work, the next Cinder-volume can delete the volume related target.

Cinder-volume Delete Target

The storage node Cinder-volume deletes the volume corresponding target through the tgt-admin command. The log file is/opt/stack/logs/c-vol.log.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984812001706.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498542908033673.jpg "style=" border:0px;white-space:normal;float:none; "/>

At this point detach volume operation has been completed, the GUI will also update volume attach information.

650) this.width=650; "Title=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467497984869051376.png "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498543029093265.jpg "style=" border:0px;white-space:normal;float:none; "/>

The above is detach volume analysis, the next section we discuss extend operation.

650) this.width=650; "title=" "src=" http://7xo6kd.com1.z0.glb.clouddn.com/ Upload-ueditor-image-20160703-1467498543097032221.jpg "style=" Border:0px;vertical-align:middle;color:rgb ( 63,63,63); font-family: ' Microsoft Yahei '; Font-size:15px;line-height:21.75px;text-align:justify;background-color: RGB (246,246,246); "/>

Detach Volume operation-5 minutes a day to play OpenStack (55)

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.