启动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实现批量修改文件名实例
Jul 08 Python
Python之reload流程实例代码解析
Jan 29 Python
python 3.6.4 安装配置方法图文教程
Sep 18 Python
钉钉群自定义机器人消息Python封装的实例
Feb 20 Python
python pytest进阶之fixture详解
Jun 27 Python
python实现自动化上线脚本的示例
Jul 01 Python
解决TensorFlow调用Keras库函数存在的问题
Jul 06 Python
浅谈python 类方法/静态方法
Sep 18 Python
10个python爬虫入门基础代码实例 + 1个简单的python爬虫完整实例
Dec 16 Python
python tkinter实现下载进度条及抖音视频去水印原理
Feb 07 Python
Python实现socket库网络通信套接字
Jun 04 Python
python井字棋游戏实现人机对战
Apr 28 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 md5下16位和32位的实现代码
2008/04/09 PHP
ThinkPHP、ZF2、Yaf、Laravel框架路由大比拼
2015/03/25 PHP
PHP SplObjectStorage使用实例
2015/05/12 PHP
Yii统计不同类型邮箱数量的方法
2016/10/18 PHP
php从数据库读取数据,并以json格式返回数据的方法
2018/08/21 PHP
php/JS实现的生成随机密码(验证码)功能示例
2019/06/06 PHP
JS遮罩层效果 兼容ie firefox jQuery遮罩层
2010/07/26 Javascript
Javascript中的几种URL编码方法比较
2015/01/23 Javascript
JavaScript数据结构与算法之集合(Set)
2016/01/29 Javascript
js 转json格式的字符串为对象或数组(前后台)的方法
2016/11/02 Javascript
JS使用插件cryptojs进行加密解密数据实例
2017/05/11 Javascript
20行js代码实现的贪吃蛇小游戏
2017/06/20 Javascript
jQuery实现拖动效果的实例代码
2017/06/25 jQuery
Laravel整合Bootstrap 4的完整方案(推荐)
2018/01/25 Javascript
VUE + UEditor 单图片跨域上传功能的实现方法
2018/02/08 Javascript
微信小程序之swiper轮播图中的图片自适应高度的方法
2018/04/23 Javascript
在vue中使用vue-echarts-v3的实例代码
2018/09/13 Javascript
React中this丢失的四种解决方法
2019/03/12 Javascript
vue-cli3 引入 font-awesome的操作
2020/08/11 Javascript
Python实现数通设备端口使用情况监控实例
2015/07/15 Python
python实现自主查询实时天气
2018/06/22 Python
用Cython加速Python到“起飞”(推荐)
2019/08/01 Python
基于Tensorflow批量数据的输入实现方式
2020/02/05 Python
澳大利亚家具和家居用品购物网站:Zanui
2018/12/29 全球购物
俄罗斯在线大型超市:ТутПросто
2021/01/08 全球购物
有个性的自我评价范文
2013/11/15 职场文书
应届毕业生求职信
2013/11/30 职场文书
骨干教师培训感言
2014/01/16 职场文书
主管会计岗位职责
2014/03/13 职场文书
2014年科室工作总结范文
2014/12/19 职场文书
部门2015年度工作总结
2015/04/29 职场文书
2015年城管个人工作总结
2015/05/15 职场文书
政审证明范文
2015/06/19 职场文书
python3使用diagrams绘制架构图的步骤
2021/04/08 Python
Python Pandas知识点之缺失值处理详解
2021/05/11 Python
详解Vue中$props、$attrs和$listeners的使用方法
2022/02/18 Vue.js