报错日志/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地址。