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; "/>
-
Send to Cinder-api Detach request
-
cinder-api send message
-
nova-compute Detach volume
-
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:
First Nova-compute detach the volume from the instance and then disconnects the ISCSI target.
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:
-
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; "/>
-
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; "/>
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)