openstack创建实例失败无法挂载卷

安装openstack的ocata版本的时候创建实例一直提示失败,日志显示如下:

nova-compute.log日志报错如下:

2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [req-c61a967f-6ddf-443c-ae20-095cdd8664fe b1cbd0c020e747bbb60f31af3c2144fe 9e3f35168cff4146b9abd2f76b43c2f8 - - -] [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f] 实例块设备设置失败: VolumeNotCreated: \u5728\u7b49\u5f85218 \u79d2\u621661\u5c1d\u8bd5\u540e\uff0c\u537751533dfd-af2c-45d4-81f6-dd760367ea21\u4ecd\u7136\u6ca1\u6709\u521b\u5efa\u6210\u529f\u3002\u5b83\u7684\u72b6\u6001\u662fcreating\u3002
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f] Traceback (most recent call last):
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1587, in _prep_block_device
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     wait_func=self._await_block_device_map_created)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 512, in attach_block_devices
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     _log_and_attach(device)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 509, in _log_and_attach
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     bdm.attach(*attach_args, **attach_kwargs)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 402, in attach
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     self._call_wait_func(context, wait_func, volume_api, vol['id'])
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 361, in _call_wait_func
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     {'volume_id': volume_id, 'exc': exc})
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     self.force_reraise()
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     six.reraise(self.type_, self.value, self.tb)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/virt/block_device.py", line 351, in _call_wait_func
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     wait_func(context, volume_id)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]   File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1260, in _await_block_device_map_created
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f]     volume_status=volume_status)
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f] VolumeNotCreated: \u5728\u7b49\u5f85218 \u79d2\u621661\u5c1d\u8bd5\u540e\uff0c\u537751533dfd-af2c-45d4-81f6-dd760367ea21\u4ecd\u7136\u6ca1\u6709\u521b\u5efa\u6210\u529f\u3002\u5b83\u7684\u72b6\u6001\u662fcreating\u3002
2020-09-08 23:48:00.030 2843 ERROR nova.compute.manager [instance: ea6882f1-24b3-48e4-b846-dca4926ea31f] 

cinder中存储节点volume.log的报错显示使用了tgtadm的工具管理iscsi,但是实际配置配置了iscsi_helper 为lioadm。

Stderr: u'/usr/bin/cinder-rootwrap: Executable not found: tgtadm (filter match = tgtadm)\n'
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server Traceback (most recent call last):
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/server.py", line 155, in _process_incoming
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     res = self.dispatcher.dispatch(message)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 222, in dispatch
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     return self._do_dispatch(endpoint, method, ctxt, args)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 192, in _do_dispatch
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     result = func(ctxt, **new_args)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/volume/manager.py", line 1499, in initialize_connection
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     volume, connector)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py", line 839, in create_export
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     volume_path)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/volume/targets/iscsi.py", line 210, in create_export
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     **portals_config)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/utils.py", line 796, in _wrapper
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     return r.call(f, *args, **kwargs)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/retrying.py", line 223, in call
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     return attempt.get(self._wrap_exception)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/retrying.py", line 261, in get
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     six.reraise(self.value[0], self.value[1], self.value[2])
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/retrying.py", line 217, in call
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/volume/targets/tgt.py", line 138, in create_iscsi_target
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     run_as_root=True)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/cinder/utils.py", line 123, in execute
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     return processutils.execute(*cmd, **kwargs)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server   File "/usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py", line 400, in execute
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server     cmd=sanitized_cmd)
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server ProcessExecutionError: Unexpected error while running command.
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server Command: sudo cinder-rootwrap /etc/cinder/rootwrap.conf tgtadm --lld iscsi --op show --mode target
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server Exit code: 96
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server Stdout: u''
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server Stderr: u'/usr/bin/cinder-rootwrap: Executable not found: tgtadm (filter match = tgtadm)\n'
2020-09-08 23:11:52.114 3475 ERROR oslo_messaging.rpc.server 

后面通过一些的查找资料发现官方文档留的一个坑,在配置lvm的部分原始配置文件里面没有[lvm]这个配置段。而我们常规的配置时候往往会忽略这个问题。
所以配置应该是这样的,在cinder.conf文件的末尾加入下面的配置:

[lvm] //这个也要加入到配置文件中,因为原始配置文件没有这个就导致找不到这个部分配置
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

配置完成后实例就可以创建成功。这个问题困扰了我很多天,希望能够帮助到大家。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值