启动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中运行并行任务技巧
Feb 26 Python
Python使用poplib模块和smtplib模块收发电子邮件的教程
Jul 02 Python
Python实现查看系统启动项功能示例
May 10 Python
Tensorflow使用tfrecord输入数据格式
Jun 19 Python
Python多线程原理与用法详解
Aug 20 Python
Python使用googletrans报错的解决方法
Sep 25 Python
对python添加模块路径的三种方法总结
Oct 16 Python
python使用PyQt5的简单方法
Feb 27 Python
500行Python代码打造刷脸考勤系统
Jun 03 Python
使用Python串口实时显示数据并绘图的例子
Dec 26 Python
tensorflow转换ckpt为savermodel模型的实现
May 25 Python
keras多显卡训练方式
Jun 10 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
php产生随机数的两种方法实例代码 输出随机IP
2011/04/08 PHP
关于zend studio 出现乱码问题的总结
2013/06/23 PHP
php实现监控varnish缓存服务器的状态
2014/12/30 PHP
PHP中4种常用的抓取网络数据方法
2015/06/04 PHP
js判断数据类型如判断是否为数组是否为字符串等等
2014/01/15 Javascript
angularjs 处理多个异步请求方法汇总
2015/01/06 Javascript
全面解析JavaScript的Backbone.js框架中的Router路由
2016/05/05 Javascript
jQuery 获取屏幕高度、宽度的简单实现案例
2016/05/17 Javascript
JS实现星星评分功能实例代码(两种方法)
2016/06/09 Javascript
原生JS轮播图插件
2017/02/09 Javascript
Bootstrap 3 进度条的实现
2017/02/22 Javascript
vue实现列表滚动的过渡动画
2020/06/29 Javascript
[01:28:24]NAVI vs VG Supermajor 败者组 BO3 第三场 6.5
2018/06/06 DOTA
[45:16]完美世界DOTA2联赛PWL S3 Magma vs Phoenix 第一场 12.12
2020/12/16 DOTA
python输出当前目录下index.html文件路径的方法
2015/04/28 Python
python利用装饰器进行运算的实例分析
2015/08/04 Python
python3中str(字符串)的使用教程
2017/03/23 Python
Django实现分页功能
2018/07/02 Python
Python安装selenium包详细过程
2019/07/23 Python
为什么说Python可以实现所有的算法
2019/10/04 Python
Python Pickle 实现在同一个文件中序列化多个对象
2019/12/30 Python
用python打开摄像头并把图像传回qq邮箱(Pyinstaller打包)
2020/05/17 Python
HTML5的结构和语义(5):内嵌媒体
2008/10/17 HTML / CSS
HTML5拖拉上传文件的简单实例
2017/01/11 HTML / CSS
Html5导航栏吸顶方案原理与对比实现
2020/06/10 HTML / CSS
猫途鹰:全球领先的旅游点评社区
2017/04/07 全球购物
美国轮胎网站:Priority Tire
2018/11/28 全球购物
幼儿教师自我鉴定
2013/11/02 职场文书
酒店管理毕业生自我鉴定
2014/03/02 职场文书
孝敬父母的演讲稿
2014/05/14 职场文书
班级心理活动总结
2014/07/04 职场文书
2014年保洁工作总结
2014/11/24 职场文书
2014年销售助理工作总结
2014/12/01 职场文书
公司搬迁通知
2015/04/20 职场文书
吴仁宝观后感
2015/06/09 职场文书
MySQL系列之六 用户与授权
2021/07/02 MySQL