启动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写的贪吃蛇游戏例子
Jun 16 Python
Python函数返回值实例分析
Jun 08 Python
Python实现读取机器硬件信息的方法示例
Jun 09 Python
基于Python在MacOS上安装robotframework-ride
Dec 28 Python
windows下python虚拟环境virtualenv安装和使用详解
Jul 16 Python
Django之模板层的实现代码
Sep 09 Python
python列表推导式操作解析
Nov 26 Python
Python处理mysql特殊字符的问题
Mar 02 Python
Ubuntu中配置TensorFlow使用环境的方法
Apr 21 Python
Python基于数列实现购物车程序过程详解
Jun 09 Python
Python 多线程C段扫描、检测 Ping扫描脚本的实现
Sep 03 Python
Python基于Opencv识别两张相似图片
Apr 25 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在服务器执行exec命令失败的解决方法
2012/03/03 PHP
浅谈Eclipse PDT调试PHP程序
2014/06/09 PHP
PHP捕获Fatal error错误的方法
2014/06/11 PHP
ThinkPHP打开验证码页面显示乱码的解决方法
2014/12/18 PHP
PHP数组函数知识汇总
2016/05/12 PHP
PHP实现的DES加密解密封装类完整实例
2017/04/29 PHP
PHP PDO和消息队列的个人理解与应用实例分析
2019/11/25 PHP
Jquery插件之打造自定义的select标签
2011/11/30 Javascript
如何获取网站icon有哪些可行的方法
2014/06/05 Javascript
JS小游戏之极速快跑源码详解
2014/09/25 Javascript
浅谈jQuery 选择器和dom操作
2016/06/07 Javascript
jQuery封装的屏幕居中提示信息代码
2016/06/08 Javascript
javaScript知识点总结(必看篇)
2016/06/10 Javascript
AngularJs Understanding the Controller Component
2016/09/02 Javascript
Nodejs多站点切换Htpps协议详解及简单实例
2017/02/23 NodeJs
[04:11]2014DOTA2国际邀请赛 CIS遗憾出局梦想不灭
2014/07/09 DOTA
利用Python操作消息队列RabbitMQ的方法教程
2017/07/19 Python
ubuntu安装sublime3并配置python3环境的方法
2018/03/15 Python
python如何读写csv数据
2018/03/21 Python
Python Logging 日志记录入门学习
2018/06/02 Python
详解Django 中是否使用时区的区别
2018/06/14 Python
python绘制简单彩虹图
2018/11/19 Python
Python列表(List)知识点总结
2019/02/18 Python
使用django的objects.filter()方法匹配多个关键字的方法
2019/07/18 Python
使用 PyTorch 实现 MLP 并在 MNIST 数据集上验证方式
2020/01/08 Python
python3读取autocad图形文件.py实例
2020/06/05 Python
Python plt 利用subplot 实现在一张画布同时画多张图
2021/02/26 Python
会走动的图形html5时钟示例
2014/04/27 HTML / CSS
HTML5公共页面提取作为公用代码的方法
2020/06/30 HTML / CSS
Coach澳大利亚官方网站:美国著名时尚奢侈品牌
2017/05/24 全球购物
最新创业融资计划书
2014/01/19 职场文书
医药公司开票员岗位职责
2015/04/15 职场文书
2015小学音乐教师个人工作总结
2015/07/21 职场文书
领导离职感言
2015/08/03 职场文书
勤俭节约主题班会
2015/08/13 职场文书
2016最新离婚协议书范本及程序
2016/03/18 职场文书