kolla(Ocata)部署場景下,lvm的雲硬碟掛載不上

weixin_33782386發表於2017-08-20

報錯日誌/var/lib/docker/volumes/kolla_logs/_data/nova/nova-compute.log:

2017-05-29 17:54:34.543 6 WARNING os_brick.initiator.connectors.iscsi [req-54078aea-1d60-4cf7-a725-90544ddc3792 71171b238f074421a933ce60aa6bf22d d21ec75080474958928e5168973d68d7 - - -] Failed to connect to iSCSI portal 127.0.0.1:3260.
2017-05-29 17:54:34.543 6 ERROR os_brick.initiator.connectors.iscsi [req-54078aea-1d60-4cf7-a725-90544ddc3792 71171b238f074421a933ce60aa6bf22d d21ec75080474958928e5168973d68d7 - - -] Could not login to any iSCSI portal.
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [req-54078aea-1d60-4cf7-a725-90544ddc3792 71171b238f074421a933ce60aa6bf22d d21ec75080474958928e5168973d68d7 - - -] [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701] Driver failed to attach volume 10ba032a-80a3-4dc7-aba5-0869123ed97a at /dev/vdb
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701] Traceback (most recent call last):
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/nova/virt/block_device.py", line 273, in attach
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     device_type=self['device_type'], encryption=encryption)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1217, in attach_volume
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     self._connect_volume(connection_info, disk_info)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 1158, in _connect_volume
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     vol_driver.connect_volume(connection_info, disk_info)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/nova/virt/libvirt/volume/iscsi.py", line 64, in connect_volume
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     device_info = self.connector.connect_volume(connection_info['data'])
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/os_brick/utils.py", line 137, in trace_logging_wrapper
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     return f(*args, **kwargs)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/oslo_concurrency/lockutils.py", line 271, in inner
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     return f(*args, **kwargs)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/os_brick/utils.py", line 61, in _wrapper
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     return r.call(f, *args, **kwargs)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/retrying.py", line 206, in call
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     return attempt.get(self._wrap_exception)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/retrying.py", line 247, in get
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     six.reraise(self.value[0], self.value[1], self.value[2])
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/retrying.py", line 200, in call
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/os_brick/initiator/connectors/iscsi.py", line 405, in connect_volume
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     connection_properties)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]   File "/var/lib/kolla/venv/lib/python2.7/site-packages/os_brick/initiator/connectors/iscsi.py", line 236, in _get_potential_volume_paths
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701]     raise exception.FailedISCSITargetPortalLogin(message=msg)
2017-05-29 17:54:34.544 6 ERROR nova.virt.block_device [instance: ae5c1c52-32be-4d3b-a60b-f5db5d6c6701] FailedISCSITargetPortalLogin: Could not login to any iSCSI portal.

在nova-compute去執行虛擬機器掛在的時候,會去獲取本地機器的ip,組成iscsid portal。
然而獲取ip的函式有問題,特別是針對多網路卡的ip配置場景,不能獲取預先在tgtd容器中配置好的管理ip地址。

D:\code\nova\nova\conf\netconf.py程式碼如下:

import socket

from oslo_config import cfg
from oslo_utils import netutils

# netutils.get_my_ipv4()這個函式有問題。獲取到的ip地址是127.0.0.1
netconf_opts = [
    cfg.StrOpt("my_ip",
               default=netutils.get_my_ipv4(),
               help="""
The IP address which the host is using to connect to the management network.

Possible values:

* String with valid IP address. Default is IPv4 address of this host.

Related options:

* metadata_host
* my_block_storage_ip
* routing_source_ip
* vpn_ip
"""),
    cfg.StrOpt("my_block_storage_ip",
               default="$my_ip",
               help="""

而tgtd的容器配置是配置了本地的管理ip地址192.168.102.21。見/etc/kolla/tgtd/config.josn配置

{
    "command": "tgtd -d 1 -f --iscsi portal=192.168.102.21:3260",
    "config_files": []
}

應改成為:

{
    "command": "tgtd -d 1 -f --iscsi portal=0.0.0.0:3260",
    "config_files": []
}

改完之後重啟tgtd容器。

或者修改ansible 端,修改配置檔案C:\code\kolla-ansible\ansible\roles\iscsi\templates\tgtd.json.j2,重新執行playbook。

ps:最好的辦法是修改D:\code\nova\nova\conf\netconf.py程式碼,獲取真正的管理段ip地址。

相關文章