启动targetcli时遇到错误解决办法


Posted in Python onOctober 26, 2017

 启动targetcli时遭遇ImportError: cannot import name ALUATargetPortGroup故障

targetcli是一个iSCSI配置管理工具,该工具简单易用,可以直接替换scsi-target-utils。满心欢喜的装上它,正准备一睹为快,就杯具了。报错ImportError: cannot import name ALUATargetPortGroup。下面就这针对这个错误的解决方案。

一、故障现象

当前环境
[root@centos7-router ~]# more /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

安装targetcli工具包
# yum install targetcli

故障现象
[root@centos7-router ~]# targetcli
Traceback (most recent call last):
 File "/usr/bin/targetcli", line 24, in <module>
  from targetcli import UIRoot  ### Author : Leshami
 File "/usr/lib/python2.7/site-packages/targetcli/__init__.py", line 18, in <module>
  from .ui_root import UIRoot  ### Blog : http://blog.csdn.net/leshami
 File "/usr/lib/python2.7/site-packages/targetcli/ui_root.py", line 30, in <module>
  from .ui_backstore import complete_path, UIBackstores
 File "/usr/lib/python2.7/site-packages/targetcli/ui_backstore.py", line 29, in <module>
  from rtslib_fb import ALUATargetPortGroup
ImportError: cannot import name ALUATargetPortGroup

二、解决方案

从上面的错误提示可知,python文件有问题。于是验证一下python是否已正确安装
[root@centos7-router ~]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

python可以正常工作,继续google,原来是缺少python-rtslib这个包。

[root@centos7-router ~]# yum install python-rtslib -y

再次执行成功
[root@centos7-router ~]# targetcli
targetcli shell version 2.1.fb46
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> help

GENERALITIES
============
This is a shell in which you can create, delete and configure
configuration objects.

The available commands depend on the current path or target
path you want to run a command in: different path have
different sets of available commands, i.e. a path pointing at
an iscsi target will not have the same availaible commands as,
say, a path pointing at a storage object.

The prompt that starts each command line indicates your
current path. Alternatively (useful if the prompt displays
an abbreviated path to save space), you can run the
pwd command to display the complete current path.

Navigating the tree is done using the cd command. Without
any argument, cd will present you wil the full objects
tree. Just use arrows to select the destination path, and
enter will get you there. Please try help cd for navigation
tips.

COMMAND SYNTAX
==============
Commands are built using the following syntax:

[TARGET_PATH] COMMAND_NAME [OPTIONS]

The TARGET_PATH indicates the path to run the command from.
If ommited, the command will be run from your current path.

The OPTIONS depend on the command. Please use help
COMMAND to get more information.


AVAILABLE COMMANDS
==================
The following commands are available in the
current path:

 - bookmarks action [bookmark] 
 - cd [path] 
 - clearconfig [confirm] 
 - exit 
 - get [group] [parameter...] 
 - help [topic] 
 - ls [path] [depth] 
 - pwd 
 - refresh 
 - restoreconfig [savefile] [clear_existing] 
 - saveconfig [savefile] 
 - sessions [action] [sid] 
 - set [group] [parameter=value...] 
 - status 
 - version

如有疑问,请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

Python 相关文章推荐
使用Python的PEAK来适配协议的教程
Apr 14 Python
Python中字典的基本知识初步介绍
May 21 Python
玩转python selenium鼠标键盘操作(ActionChains)
Apr 12 Python
Python3.6简单反射操作示例
Jun 14 Python
tensorflow 加载部分变量的实例讲解
Jul 27 Python
Python BS4库的安装与使用详解
Aug 08 Python
python图形工具turtle绘制国际象棋棋盘
May 23 Python
python3+PyQt5 数据库编程--增删改实例
Jun 17 Python
python print出共轭复数的方法详解
Jun 25 Python
PyCharm2019 安装和配置教程详解附激活码
Jul 31 Python
linux mint中搜狗输入法导致pycharm卡死的问题
Oct 28 Python
解决python3输入的坑——input()
Dec 05 Python
Mac中Python 3环境下安装scrapy的方法教程
Oct 26 #Python
python实现分页效果
Oct 25 #Python
python+pyqt实现12306图片验证效果
Oct 25 #Python
python编程羊车门问题代码示例
Oct 25 #Python
python中requests使用代理proxies方法介绍
Oct 25 #Python
python中requests爬去网页内容出现乱码问题解决方法介绍
Oct 25 #Python
python编程之requests在网络请求中添加cookies参数方法详解
Oct 25 #Python
You might like
不用数据库的多用户文件自由上传投票系统(3)
2006/10/09 PHP
PHP CURL CURLOPT参数说明(curl_setopt)
2013/09/30 PHP
将PHP的session数据存储到数据库中的代码实例
2016/06/24 PHP
php之可变函数的实例详解
2017/09/13 PHP
php+Ajax无刷新验证用户名操作实例详解
2019/03/04 PHP
JS 非图片动态loading效果实现代码
2010/04/09 Javascript
基于JavaScript 数据类型之Boolean类型分析介绍
2013/04/19 Javascript
浅析JavaScript原型继承的陷阱
2013/12/03 Javascript
JS使用getComputedStyle()方法获取CSS属性值
2014/04/23 Javascript
jQuery使用$.get()方法从服务器文件载入数据实例
2015/03/25 Javascript
JS实现获取来自百度,Google,soso,sogou关键词的方法
2016/12/21 Javascript
JavaScript原生编写《飞机大战坦克》游戏完整实例
2017/01/04 Javascript
基于Angular.js实现的触摸滑动动画实例代码
2017/02/19 Javascript
JS实现列表页面隔行变色效果
2017/03/25 Javascript
vue 计时器组件的实现代码
2017/09/14 Javascript
vuejs使用递归组件实现树形目录的方法
2017/09/30 Javascript
vue实现局部刷新的实现示例
2019/04/16 Javascript
vue-cli3 配置开发与测试环境详解
2019/05/17 Javascript
nodeJs项目在阿里云的简单部署
2020/11/27 NodeJs
Python数组条件过滤filter函数使用示例
2014/07/22 Python
Python使用redis pool的一种单例实现方式
2016/04/16 Python
用TensorFlow实现多类支持向量机的示例代码
2018/04/28 Python
Python装饰器语法糖
2019/01/02 Python
python urllib爬虫模块使用解析
2019/09/05 Python
tensorflow通过模型文件,使用tensorboard查看其模型图Graph方式
2020/01/23 Python
TensorFlow实现批量归一化操作的示例
2020/04/22 Python
python requests库的使用
2021/01/06 Python
canvas三角函数模拟水波效果的示例代码
2018/07/03 HTML / CSS
美国最大的珠宝首饰网上商城:Jewelry.com
2016/07/22 全球购物
飞利浦法国官网:Philips法国
2019/07/10 全球购物
Bloomingdale’s阿联酋:选购奢华时尚、美容及更多
2020/09/22 全球购物
前台接待的工作职责
2013/11/21 职场文书
环境工程专业自荐信
2014/03/03 职场文书
统计专业自荐书
2014/07/06 职场文书
2014年党建工作汇报材料
2014/11/02 职场文书
Nginx 502 bad gateway错误解决的九种方案及原因
2022/08/14 Servers