openstack 命令 输出不能加载属性解决

现象

用openstack 命令的时候,总是显示Could not load ‘server_volume_set’: module ‘openstackclient.compute.v2.server_volume’ has no attribute 'SetServerVolume’这些没用的信息。要说为什么会这样。原因还是我自作聪明的安装了python-openstackclient-6.xxx的高版本的包,结果不好用,卸载后导致原来的命令总是输出一些垃圾信息。虽然能将命令执行成功,但是总显示这些没用的很是碍眼。

[root@controller neutron]# openstack server list
Could not load 'server_volume_set': module 'openstackclient.compute.v2.server_volume' has no attribute 'SetServerVolume'
Could not load 'image_stage': module 'openstackclient.image.v2.image' has no attribute 'StageImage'
Could not load 'quota_delete': module 'openstackclient.common.quota' has no attribute 'DeleteQuota'
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+
| ID                                   | Name    | Status | Networks                            | Image                    | Flavor           |
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+
| 5cfbb50d-faa2-44dc-bebf-f31a4109577f | server1 | ACTIVE | neutron1=192.168.0.57, 192.168.0.66 | N/A (booted from volume) | baremetal-flavor |
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+

卸载安装

我先把 /usr/lib/python3/site-packages/openstackclient/ 和 /usr/local/lib/python3/site-packages/openstackclient 这两个删除,然后执行命令

yum install python3-openstackclient -y

结果还不如之前的,之前只有三个模块,现在好了,编程了一堆了,更是头疼了。

[root@controller site-packages]# yum install python3-openstackclient
Repository extras is listed more than once in the configuration
上次元数据过期检查:0:07:00 前,执行于 2023年05月06日 星期六 18时42分51秒。
依赖关系解决。
=====================================================================================================================================================================================
 软件包                                                架构                             版本                                   仓库                                             大小
=====================================================================================================================================================================================
安装:
 python3-openstackclient                               noarch                           5.8.0-1.el8                            centos-openstack-yoga                           1.3 M
安装依赖关系:
 python-openstackclient-lang                           noarch                           5.8.0-1.el8                            centos-openstack-yoga                            57 k
安装弱的依赖:
 bash-completion                                       noarch                           1:2.7-5.el8                            baseos                                          274 k

事务概要
=====================================================================================================================================================================================
安装  3 软件包

总下载:1.6 M
安装大小:9.0 M
确定吗?[y/N]: y
下载软件包:
(1/3): python-openstackclient-lang-5.8.0-1.el8.noarch.rpm                                                                                            153 kB/s |  57 kB     00:00
(2/3): bash-completion-2.7-5.el8.noarch.rpm                                                                                                          572 kB/s | 274 kB     00:00
(3/3): python3-openstackclient-5.8.0-1.el8.noarch.rpm                                                                                                962 kB/s | 1.3 MB     00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                 431 kB/s | 1.6 MB     00:03
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                      1/1
  安装    : bash-completion-1:2.7-5.el8.noarch                                                                                                                                   1/3
  安装    : python-openstackclient-lang-5.8.0-1.el8.noarch                                                                                                                       2/3
  安装    : python3-openstackclient-5.8.0-1.el8.noarch                                                                                                                           3/3
  运行脚本: python3-openstackclient-5.8.0-1.el8.noarch                                                                                                                           3/3
Could not load 'server_migration_abort': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_force_complete': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_list': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_show': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_volume_set': module 'openstackclient.compute.v2.server_volume' has no attribute 'SetServerVolume'
Could not load 'image_metadef_namespace_create': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_delete': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_list': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_set': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_show': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_stage': module 'openstackclient.image.v2.image' has no attribute 'StageImage'
Could not load 'image_task_list': No module named 'openstackclient.image.v2.task'
Could not load 'image_task_show': No module named 'openstackclient.image.v2.task'
Could not load 'network_subport_list': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_create': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_delete': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_list': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_set': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_show': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_unset': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'router_ndp_proxy_create': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_delete': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_list': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_set': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_show': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'block_storage_cleanup': No module named 'openstackclient.volume.v3.block_storage_cleanup'
Could not load 'block_storage_cluster_list': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_cluster_set': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_cluster_show': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_log_level_list': No module named 'openstackclient.volume.v3.block_storage_log_level'
Could not load 'block_storage_log_level_set': No module named 'openstackclient.volume.v3.block_storage_log_level'
Could not load 'block_storage_resource_filter_list': No module named 'openstackclient.volume.v3.block_storage_resource_filter'
Could not load 'block_storage_resource_filter_show': No module named 'openstackclient.volume.v3.block_storage_resource_filter'
Could not load 'block_storage_snapshot_manageable_list': No module named 'openstackclient.volume.v3.block_storage_manage'
Could not load 'block_storage_volume_manageable_list': No module named 'openstackclient.volume.v3.block_storage_manage'
Could not load 'volume_revert': No module named 'openstackclient.volume.v3.volume'
Could not load 'volume_summary': No module named 'openstackclient.volume.v3.volume'
Could not load 'quota_delete': module 'openstackclient.common.quota' has no attribute 'DeleteQuota'
The 'openstack bgp speaker show dragents' CLI is deprecated and will be removed in the future. Use 'openstack bgp dragent list' CLI instead.

  验证    : python-openstackclient-lang-5.8.0-1.el8.noarch                                                                                                                       1/3
  验证    : python3-openstackclient-5.8.0-1.el8.noarch                                                                                                                           2/3
  验证    : bash-completion-1:2.7-5.el8.noarch                                                                                                                                   3/3

已安装:
  bash-completion-1:2.7-5.el8.noarch                   python-openstackclient-lang-5.8.0-1.el8.noarch                   python3-openstackclient-5.8.0-1.el8.noarch

完毕!
[root@controller site-packages]# openstack server list
Could not load 'server_migration_abort': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_force_complete': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_list': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_migration_show': No module named 'openstackclient.compute.v2.server_migration'
Could not load 'server_volume_set': module 'openstackclient.compute.v2.server_volume' has no attribute 'SetServerVolume'
Could not load 'image_metadef_namespace_create': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_delete': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_list': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_set': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_metadef_namespace_show': No module named 'openstackclient.image.v2.metadef_namespaces'
Could not load 'image_stage': module 'openstackclient.image.v2.image' has no attribute 'StageImage'
Could not load 'image_task_list': No module named 'openstackclient.image.v2.task'
Could not load 'image_task_show': No module named 'openstackclient.image.v2.task'
Could not load 'network_subport_list': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_create': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_delete': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_list': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_set': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_show': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'network_trunk_unset': No module named 'openstackclient.network.v2.network_trunk'
Could not load 'router_ndp_proxy_create': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_delete': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_list': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_set': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'router_ndp_proxy_show': No module named 'openstackclient.network.v2.ndp_proxy'
Could not load 'block_storage_cleanup': No module named 'openstackclient.volume.v3.block_storage_cleanup'
Could not load 'block_storage_cluster_list': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_cluster_set': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_cluster_show': No module named 'openstackclient.volume.v3.block_storage_cluster'
Could not load 'block_storage_log_level_list': No module named 'openstackclient.volume.v3.block_storage_log_level'
Could not load 'block_storage_log_level_set': No module named 'openstackclient.volume.v3.block_storage_log_level'
Could not load 'block_storage_resource_filter_list': No module named 'openstackclient.volume.v3.block_storage_resource_filter'
Could not load 'block_storage_resource_filter_show': No module named 'openstackclient.volume.v3.block_storage_resource_filter'
Could not load 'block_storage_snapshot_manageable_list': No module named 'openstackclient.volume.v3.block_storage_manage'
Could not load 'block_storage_volume_manageable_list': No module named 'openstackclient.volume.v3.block_storage_manage'
Could not load 'volume_revert': No module named 'openstackclient.volume.v3.volume'
Could not load 'volume_summary': No module named 'openstackclient.volume.v3.volume'
Could not load 'quota_delete': module 'openstackclient.common.quota' has no attribute 'DeleteQuota'
....

上网搜了一圈

参考了一下这个https://bugs.launchpad.net/python-novaclient/+bug/1579157
pip3 install python-openstackclient

[root@controller ~]# pip3 install python-openstackclient
Requirement already satisfied: python-openstackclient in /usr/local/lib/python3.6/site-packages (6.3.0.dev15)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (5.5.1)
Requirement already satisfied: cliff>=3.5.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (3.10.1)
Requirement already satisfied: iso8601>=0.1.11 in /usr/lib/python3.6/site-packages (from python-openstackclient) (0.1.12)
Collecting openstacksdk>=0.103.0
  Downloading openstacksdk-1.1.0-py3-none-any.whl (1.6 MB)
     |████████████████████████████████| 1.6 MB 759 kB/s
Requirement already satisfied: osc-lib>=2.3.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (2.5.0)
Requirement already satisfied: oslo.i18n>=3.15.3 in /usr/lib/python3.6/site-packages (from python-openstackclient) (5.1.0)
Requirement already satisfied: oslo.utils>=3.33.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (4.12.2)
Requirement already satisfied: python-keystoneclient>=3.22.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (4.4.0)
Collecting python-openstackclient
  Downloading python_openstackclient-5.8.0-py3-none-any.whl (984 kB)
     |████████████████████████████████| 984 kB 21.5 MB/s
Requirement already satisfied: python-cinderclient>=3.3.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (8.3.0)
Requirement already satisfied: python-novaclient>=17.0.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (17.7.0)
Requirement already satisfied: openstacksdk>=0.61.0 in /usr/lib/python3.6/site-packages (from python-openstackclient) (0.61.0)
Requirement already satisfied: stevedore>=2.0.1 in /usr/lib/python3.6/site-packages (from python-openstackclient) (3.5.0)
Installing collected packages: python-openstackclient
  Attempting uninstall: python-openstackclient
    Found existing installation: python-openstackclient 6.3.0.dev15
    Uninstalling python-openstackclient-6.3.0.dev15:
      Successfully uninstalled python-openstackclient-6.3.0.dev15
Successfully installed python-openstackclient-5.8.1.dev4

误打误撞把原先安装的python-openstackclient-6.3.0.dev15包卸载了,但是还是不好用啊。我决定拼一把执行

 pip3 install python-openstackclient --force

这下完犊子,失败了,连openstack命令都没有了。于是我重新安装一下 python3-openstackclient吧,结果安装又失败了。

[root@controller ~]# yum install -y python3-openstackclient
Repository extras is listed more than once in the configuration
上次元数据过期检查:0:18:33 前,执行于 2023年05月06日 星期六 18时42分51秒。
依赖关系解决。
=====================================================================================================================================================================================
 软件包                                                架构                             版本                                   仓库                                             大小
=====================================================================================================================================================================================
安装:
 python3-openstackclient                               noarch                           5.8.0-1.el8                            centos-openstack-yoga                           1.3 M
安装依赖关系:
 python-openstackclient-lang                           noarch                           5.8.0-1.el8                            centos-openstack-yoga                            57 k
安装弱的依赖:
 bash-completion                                       noarch                           1:2.7-5.el8                            baseos                                          274 k

事务概要
=====================================================================================================================================================================================
安装  3 软件包

总下载:1.6 M
安装大小:9.0 M
下载软件包:
(1/3): python-openstackclient-lang-5.8.0-1.el8.noarch.rpm                                                                                            163 kB/s |  57 kB     00:00
(2/3): bash-completion-2.7-5.el8.noarch.rpm                                                                                                          659 kB/s | 274 kB     00:00
(3/3): python3-openstackclient-5.8.0-1.el8.noarch.rpm                                                                                                1.0 MB/s | 1.3 MB     00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                 403 kB/s | 1.6 MB     00:04
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                      1/1
  安装    : bash-completion-1:2.7-5.el8.noarch                                                                                                                                   1/3
  安装    : python-openstackclient-lang-5.8.0-1.el8.noarch                                                                                                                       2/3
  安装    : python3-openstackclient-5.8.0-1.el8.noarch                                                                                                                           3/3
  运行脚本: python3-openstackclient-5.8.0-1.el8.noarch                                                                                                                           3/3
/usr/lib/python3.6/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography import x509
Traceback (most recent call last):
  File "/bin/openstack", line 6, in <module>
    from openstackclient.shell import main
  File "/usr/local/lib/python3.6/site-packages/openstackclient/shell.py", line 21, in <module>
    from osc_lib.api import auth
  File "/usr/local/lib/python3.6/site-packages/osc_lib/api/auth.py", line 18, in <module>
    from keystoneauth1.identity.v3 import k2k
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/__init__.py", line 14, in <module>
    from keystoneauth1.identity import generic
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/generic/__init__.py", line 14, in <module>
    from keystoneauth1.identity.generic.password import Password  # noqa
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/generic/password.py", line 16, in <module>
    from keystoneauth1.identity import v3
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/v3/__init__.py", line 19, in <module>
    from keystoneauth1.identity.v3.multi_factor import *  # noqa
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/identity/v3/multi_factor.py", line 14, in <module>
    from keystoneauth1 import loading
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/loading/__init__.py", line 15, in <module>
    from keystoneauth1.loading import adapter
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/loading/adapter.py", line 13, in <module>
    from keystoneauth1 import adapter
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/adapter.py", line 19, in <module>
    from keystoneauth1 import session
  File "/usr/local/lib/python3.6/site-packages/keystoneauth1/session.py", line 40, in <module>
    import osprofiler.web as osprofiler_web
  File "/usr/lib/python3.6/site-packages/osprofiler/web.py", line 20, in <module>
    from osprofiler import profiler
  File "/usr/lib/python3.6/site-packages/osprofiler/profiler.py", line 28, in <module>
    from osprofiler import notifier
  File "/usr/lib/python3.6/site-packages/osprofiler/notifier.py", line 18, in <module>
    from osprofiler.drivers import base
  File "/usr/lib/python3.6/site-packages/osprofiler/drivers/__init__.py", line 4, in <module>
    from osprofiler.drivers import loginsight  # noqa
  File "/usr/lib/python3.6/site-packages/osprofiler/drivers/loginsight.py", line 24, in <module>
    from oslo_concurrency.lockutils import synchronized
  File "/usr/lib/python3.6/site-packages/oslo_concurrency/lockutils.py", line 28, in <module>
    import fasteners
  File "/usr/lib/python3.6/site-packages/fasteners/__init__.py", line 23, in <module>
    from fasteners.lock import locked  # noqa
  File "/usr/lib/python3.6/site-packages/fasteners/lock.py", line 31, in <module>
    import eventlet
  File "/usr/lib/python3.6/site-packages/eventlet/__init__.py", line 17, in <module>
    from eventlet import convenience
  File "/usr/lib/python3.6/site-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/usr/lib/python3.6/site-packages/eventlet/green/socket.py", line 4, in <module>
    __import__('eventlet.green._socket_nodns')
  File "/usr/lib/python3.6/site-packages/eventlet/green/_socket_nodns.py", line 11, in <module>
    from eventlet import greenio
  File "/usr/lib/python3.6/site-packages/eventlet/greenio/__init__.py", line 3, in <module>
    from eventlet.greenio.base import *  # noqa
  File "/usr/lib/python3.6/site-packages/eventlet/greenio/base.py", line 473, in <module>
    from OpenSSL import SSL
  File "/usr/lib/python3.6/site-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import crypto, SSL
  File "/usr/lib/python3.6/site-packages/OpenSSL/crypto.py", line 1553, in <module>
    class X509StoreFlags(object):
  File "/usr/lib/python3.6/site-packages/OpenSSL/crypto.py", line 1573, in X509StoreFlags
    CB_ISSUER_CHECK = _lib.X509_V_FLAG_CB_ISSUER_CHECK
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'

其实到这里我本想卸载Python3.6,重新安装一下的。但是吧我卸载时候发现,跟Python相关的openstack的组件都需要卸载,我只能另寻他发了。于是乎,我查查X509_V_FLAG_CB_ISSUER_CHECK 缺这个是为啥。
参考了 https://blog.csdn.net/qq_38978225/article/details/127750762

解决办法

pip uninstall pyOpenSSL
pip install pyOpenSSL

执行完这两条命令倒是没有之前哪个为题了,但是又有了新的问题。

[root@controller ~]# openstack server list
**/usr/local/lib/python3.6/site-packages/OpenSSL/_util.py:6: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
  from cryptography.hazmat.bindings.openssl.binding import Binding**
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+
| ID                                   | Name    | Status | Networks                            | Image                    | Flavor           |
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+
| 5cfbb50d-faa2-44dc-bebf-f31a4109577f | server1 | ACTIVE | neutron1=192.168.0.57, 192.168.0.66 | N/A (booted from volume) | baremetal-flavor |
+--------------------------------------+---------+--------+-------------------------------------+--------------------------+------------------+

我查了一下其他服务器上的pyOpenSSL的版本,用的是19.0.0的。我重新装了19.0.0的pyOpenSSL,彻底解决了该问题。

pip install pyOpenSSL==19.0.0

查看版本
pip show pyOpenSSL
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值