openstack detach logs - Murray-LIANG/forgetful GitHub Wiki
-
OpenStack Nova detach process logs of Newton version
- 1. Get connector properties (219ms)
- 2. Detach volume from VM
- 3. Start retrying detach until device
vdb
is gone -
4. Calling os-brick to detach iSCSI volume (790ms)
- 4.1 Lock
connect_volume
acquired byos_brick.initiator.connectors.iscsi.disconnect_volume
- 4.2 Rescan multipath
- 4.3 Get the multipath WWN
- 4.4 Remove multipath device
/dev/sdd
- 4.5 Flush multipath device 36006016015e03a00ab2df25bb82d0ea9
- 4.6 Get multipath LUNs to remove
- 4.7 Flushing IO for device
/dev/sdd
- 4.8 Remove SCSI device
/dev/sdd
- 4.9 Flushing IO for device
/dev/sdc
- 4.10 Remove SCSI device
/dev/sdc
- 4.11 Disconnect multipath device /dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9
- 4.12 Lock
connect_volume
released byos_brick.initiator.connectors.iscsi.disconnect_volume
- 4.1 Lock
-
5. POST call to cinder, action
os-terminate_connection
-
6. POST call to cinder, action
os-detach
get_connector_properties: call {
'execute': None,
'my_ip': '172.16.1.11',
'enforce_multipath': True,
'host': 'newton',
'root_helper': 'sudo nova-rootwrap /etc/nova/rootwrap.conf',
'multipath': True}
$ multipathd show status
path checker states:
up 3
paths: 2
busy: False
$ cat /etc/iscsi/initiatorname.iscsi
## DO NOT EDIT OR REMOVE THIS FILE!
## If you remove this file, the iSCSI daemon will not start.
## If you change the InitiatorName, existing access control lists
## may reject this initiator. The InitiatorName must be unique
## for each iSCSI initiator. Do NOT duplicate iSCSI InitiatorNames.
InitiatorName=iqn.1993-08.org.debian:01:7cc8838d1c0
systool -c fc_host -v
Error opening class fc_host
Detach volume 5ed0cc5c-158c-4857-9bd5-3556884a23f0 from mountpoint /dev/vdb
The xml used by libvirt
to detach device from VM
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9"/>
<target bus="virtio" dev="vdb"/>
<serial>5ed0cc5c-158c-4857-9bd5-3556884a23f0</serial>
</disk>
disconnect_volume: call {
'args': (
<os_brick.initiator.connectors.iscsi.ISCSIConnector object at 0x7fe51cd174d0>,
{
u'target_luns': [197, 197],
u'target_iqns': [
u'iqn.1992-04.com.emc:cx.fnm00150600267.a0',
u'iqn.1992-04.com.emc:cx.fnm00150600267.b0' ],
u'device_path': u'/dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9',
u'target_discovered': True,
u'encrypted': False,
u'qos_specs': None,
u'target_iqn': u'iqn.1992-04.com.emc:cx.fnm00150600267.a0',
u'target_portals': [u'10.245.47.95: 3260', u'10.245.47.96: 3260'],
u'volume_id': u'5ed0cc5c-158c-4857-9bd5-3556884a23f0',
u'target_lun': 197,
u'access_mode': u'rw',
u'target_portal': u'10.245.47.95: 3260'
},
None),
'kwargs': {}
}
$ multipath -r
reload: 36006016015e03a00ab2df25bb82d0ea9 undef DGC,VRAID
size=3.0G features='1 queue_if_no_path' hwhandler='1 emc' wp=undef
|-+- policy='round-robin 0' prio=50 status=undef
| `- 2:0:0:197 sdd 8:48 active ready running
`-+- policy='round-robin 0' prio=10 status=undef
`- 3:0:0:197 sdc 8:32 active ready running
$ /lib/udev/scsi_id --page 0x83 --whitelisted /dev/disk/by-path/ip-10.245.47.95:3260-iscsi-iqn.1992-04.com.emc:cx.fnm00150600267.a0-lun-197
36006016015e03a00ab2df25bb82d0ea9
# Find Multipath device file for volume WWN 36006016015e03a00ab2df25bb82d0ea9
# Checking to see if /dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9 exists yet.
# /dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9 has shown up.
# Checking to see if /dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9 is read-only.
$ lsblk -o NAME,RO -l -n
sdc 0
36006016015e03a00ab2df25bb82d0ea9 0
sdd 0
36006016015e03a00ab2df25bb82d0ea9 0
sdf 0
vda 0
vda1 0
loop0 0
# Block device /dev/disk/by-id/dm-uuid-mpath-36006016015e03a00ab2df25bb82d0ea9 is not read-only.
$ multipath -l /dev/sdd
36006016015e03a00ab2df25bb82d0ea9 dm-0 DGC,VRAID
size=3.0G features='2 queue_if_no_path retain_attached_hw_handler' hwhandler='1 emc' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| `- 2:0:0:197 sdd 8:48 active undef running
`-+- policy='round-robin 0' prio=0 status=enabled
`- 3:0:0:197 sdc 8:32 active undef running
# Found multipath device = /dev/mapper/36006016015e03a00ab2df25bb82d0ea9
$ multipath -f 36006016015e03a00ab2df25bb82d0ea9
multipath LUNs to remove
[
{'device': u'/dev/sdd',
'host': u'2',
'id': u'0',
'channel': u'0',
'lun': u'197'},
{'device': u'/dev/sdc',
'host': u'3',
'id': u'0',
'channel': u'0',
'lun': u'197'}]
$ blockdev --flushbufs /dev/sdd
$ tee -a /sys/block/sdd/device/delete
$ blockdev --flushbufs /dev/sdc
$ tee -a /sys/block/sdc/device/delete
$ multipath -ll
# no output
$ multipath -r
# no output
Held 0.790s
$ curl -g -i -X POST \
http://172.16.1.11:8776/v2/ca2fbd57936b45bf9abdb536dc152a6d/volumes/5ed0cc5c-158c-4857-9bd5-3556884a23f0/action \
-H "User-Agent: python-cinderclient" -H "Content-Type: application/json" \
-H "Accept: application/json" -H "X-Auth-Token: {SHA1}deea2e5c2c82807813e48cc3ce629c6ad98c9a7a" \
-d '{"os-terminate_connection": {"connector": {"platform": "x86_64", "host": "newton", "do_local_attach": false, "ip": "172.16.1.11", "os_type": "linux2", "multipath": true, "initiator": "iqn.1993-08.org.debian:01:7cc8838d1c0"}}}'
$ curl -g -i -X POST \
http://172.16.1.11:8776/v2/ca2fbd57936b45bf9abdb536dc152a6d/volumes/5ed0cc5c-158c-4857-9bd5-3556884a23f0/action \
-H "User-Agent: python-cinderclient" -H "Content-Type: application/json" \
-H "Accept: application/json" -H "X-Auth-Token: {SHA1}deea2e5c2c82807813e48cc3ce629c6ad98c9a7a" \
-d '{"os-detach": {"attachment_id": "c0e36b23-5be9-49af-b1fb-f6635e5c186e"}}'