问题:gwcli.utils.GatewayAPIError:连接到 http://localhost:5001/api/config 的未知错误

问题描述

请帮助我,因为这让我不寒而栗。

根据文档[CONfigURING THE ISCSI TARGET USING THE COMMAND LINE INTERFACE](Configuring the iSCSI Target using the Command Line Interface — Ceph Documentation),我已经安装了ceph-iscsi、python-rtslib、targetcli和tcmu-runner .当我尝试使用 gwcli 配置 iSCSI 目标时,我收到一些错误消息:

$[root@node1:~] gwcli -d
Adding ceph cluster 'ceph' to the UI
Fetching ceph osd information
Querying ceph for state information
Traceback (most recent call last):
  File "/usr/bin/gwcli",line 194,in <module>
    main()
  File "/usr/bin/gwcli",line 105,in main
    root_node.refresh()
  File "/usr/lib/python2.7/site-packages/ceph_iscsi-3.4-py2.7.egg/gwcli/gateway.py",line 62,in refresh
  File "/usr/lib/python2.7/site-packages/ceph_iscsi-3.4-py2.7.egg/gwcli/gateway.py",line 99,in _get_config
  File "utils.py",line 451,in __getattr__
gwcli.utils.GatewayAPIError: UnkNown error connecting to http://localhost:5001/api/config

首先,我检查了这三个服务的状态:rbd-target-apirbd-target-gwtcmu-runner。他们都运行良好。然后,我尝试使用 curl 命令从 http://localhost:5001/api/config 获取配置信息,它也运行良好。配置信息如下:

[root@node1:~]$ curl --insecure --user admin:admin -X GET http://localhost:5001/api/config
{
  "created": "2021/07/12 07:45:31","discovery_auth": {
    "mutual_password": "","mutual_password_encryption_enabled": false,"mutual_username": "","password": "","password_encryption_enabled": false,"username": ""
  },"disks": {},"epoch": 0,"gateways": {},"targets": {},"updated": "","version": 11
}

这里有些奇怪。这里有一些奇怪的东西。从控制台消息来看,gwcli 命令执行失败,但从 /var/log/rbd-target-api/rbd-target-api.log 中打印的日志消息来看,该命令似乎执行得很好。 rbd-target-api.log 如下所示。

# /var/log/rbd-target-api/rbd-target-api.log

# before running gwcli command
2021-07-13 14:06:48,933     INFO [_internal.py:87:_log()] - ::ffff:127.0.0.1 - - [13/Jul/2021 14:06:48] "POST / HTTP/1.1" 404 -
2021-07-13 14:06:48,935     INFO [_internal.py:87:_log()] - ::ffff:127.0.0.1 - - [13/Jul/2021 14:06:48] "POST / HTTP/1.1" 404 -

# after running gwcli command
2021-07-13 14:06:51,359    DEBUG [common.py:505:refresh()] - config refresh - current config is {u'updated': u'',u'created': u'2021/07/12 07:45:31',u'disks': {},u'epoch': 0,u'version': 11,u'gateways': {},u'targets': {},u'discovery_auth': {u'username': u'',u'password_encryption_enabled': False,u'mutual_username': u'',u'mutual_password_encryption_enabled': False,u'mutual_password': u'',u'password': u''}}
2021-07-13 14:06:51,359    DEBUG [common.py:139:_open_ioctx()] - (_open_ioctx) opening connection to rbd pool
2021-07-13 14:06:51,360    DEBUG [common.py:146:_open_ioctx()] - (_open_ioctx) connection opened
2021-07-13 14:06:51,360    DEBUG [common.py:118:_read_config_object()] - _read_config_object reading the config object
2021-07-13 14:06:51,361    DEBUG [common.py:168:_get_ceph_config()] - (_get_rbd_config) config object contains '{
    "created": "2021/07/12 07:45:31","discovery_auth": {
        "mutual_password": "","username": ""
    },"version": 11
}'
2021-07-13 14:06:51,362     INFO [_internal.py:87:_log()] - ::1 - - [13/Jul/2021 14:06:51] "GET /api/config HTTP/1.1" 200 -
2021-07-13 14:06:54,256     INFO [_internal.py:87:_log()] - ::ffff:192.168.15.62 - - [13/Jul/2021 14:06:54] "GET /api/config HTTP/1.1" 403 -
2021-07-13 14:06:54,258     INFO [_internal.py:87:_log()] - ::ffff:192.168.15.62 - - [13/Jul/2021 14:06:54] "GET /api/config HTTP/1.1" 403 -
2021-07-13 14:06:54,261     INFO [_internal.py:87:_log()] - ::ffff:192.168.15.62 - - [13/Jul/2021 14:06:54] "GET /api/config HTTP/1.1" 403 -
2021-07-13 14:06:54,263     INFO [_internal.py:87:_log()] - ::ffff:192.168.15.62 - - [13/Jul/2021 14:06:54] "GET /api/config HTTP/1.1" 403 -
2021-07-13 14:06:54,265     INFO [_internal.py:87:_log()] - ::ffff:192.168.15.62 - - [13/Jul/2021 14:06:54] "GET /api/config HTTP/1.1" 403 -

如上所示,rbd-target-api 守护进程可以接收来自 gwcli获取配置请求。 http 状态代码是 200,守护进程也生成了配置对象。 gwcli 好像出了点问题?

另外,我也尝试过重启rbd-target-api服务,但是没有任何改变。

我的环境如下:

  • 操作系统:Centos 7 Linux 5.11.16-1.el7.elrepo.x86_64 x86_64
  • 应用版本:
    • ceph-iscsi:3.4-1.el7
    • gwcli:2.7
    • tcmu-runner: 1.4.0-rc1
    • python-rtslib:2.1.74-1.el7_9

我的 iscsi-gateway.cfg 如下所示,我确保此文件已复制到 node1、node2 和 node3。 node1、node2和node3是三个远程服务器。

$ cat /etc/ceph/iscsi-gateway.cfg 
[config]
# Name of the Ceph storage cluster. A suitable Ceph configuration file allowing
# access to the Ceph storage cluster from the gateway node is required,if not
# colocated on an OSD node.
cluster_name = ceph

# Place a copy of the ceph cluster's admin keyring in the gateway's /etc/ceph
# drectory and reference the filename here
gateway_keyring = ceph.client.admin.keyring

# API settings.
# The API supports a number of options that allow you to tailor it to your
# local environment. If you want to run the API under https,you will need to
# create cert/key files that are compatible for each iSCSI gateway node,that is
# not locked to a specific node. SSL cert and key files *must* be called
# 'iscsi-gateway.crt' and 'iscsi-gateway.key' and placed in the '/etc/ceph/' directory
# on *each* gateway node. With the SSL files in place,you can use 'api_secure = true'
# to switch to https mode.

# To support the API,the bear minimum settings are:
api_secure = false

# Additional API configuration options are as follows,defaults shown.
api_user = admin
api_password = admin
api_port = 5001
trusted_ip_list = node1,node2,node3

这个问题困扰我好几天了。谁能给我一些提示或建议?

提前致谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...