启动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中list初始化方法示例
Sep 18 Python
python搭建虚拟环境的步骤详解
Sep 27 Python
Python 实现在文件中的每一行添加一个逗号
Apr 29 Python
Python3中的列表生成式、生成器与迭代器实例详解
Jun 11 Python
python3读取csv和xlsx文件的实例
Jun 22 Python
python3实现多线程聊天室
Dec 12 Python
Python GUI编程学习笔记之tkinter中messagebox、filedialog控件用法详解
Mar 30 Python
Python如何实现自带HTTP文件传输服务
Jul 08 Python
Django实现文章详情页面跳转代码实例
Sep 16 Python
python 检测nginx服务邮件报警的脚本
Dec 31 Python
matplotlib绘制多子图共享鼠标光标的方法示例
Jan 08 Python
python基于tkinter制作无损音乐下载工具
Mar 29 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
为什么那些咖啡爱好者大多看不上连锁咖啡店?
2021/03/06 咖啡文化
深入PHP购物车模块功能分析(函数讲解,附源码)
2013/06/25 PHP
php中json_encode处理gbk与gb2312中文乱码问题的解决方法
2014/07/10 PHP
laravel实现前后台路由分离的方法
2019/10/13 PHP
alixixi runcode.asp的代码不错的应用
2007/08/08 Javascript
Prototype ObjectRange对象学习
2009/07/19 Javascript
JavaScript中获取元素索引的函数
2010/09/10 Javascript
JS截取url中问号后面参数的值信息
2014/04/29 Javascript
谈谈JavaScript自定义回调函数
2015/10/18 Javascript
浅谈JavaScript的内置对象和浏览器对象
2016/06/03 Javascript
JS实现兼容火狐及IE iframe onload属性的遮罩层隐藏及显示效果
2016/08/23 Javascript
BootStrap 弹出层代码
2017/02/09 Javascript
Angular.js实现动态加载组件详解
2017/05/28 Javascript
JS动态修改网页body的背景色实例代码
2017/10/07 Javascript
JS实现动态生成html table表格的方法分析
2018/07/11 Javascript
17道题让你彻底理解JS中的类型转换
2019/08/08 Javascript
Vue组件间数据传递的方式(3种)
2020/07/13 Javascript
pandas数据分组和聚合操作方法
2018/04/11 Python
详解Python如何生成词云的方法
2018/06/01 Python
解决pandas中读取中文名称的csv文件报错的问题
2018/07/04 Python
django 自定义filter 判断if var in list的例子
2019/08/20 Python
挪威太阳镜和眼镜网上商城:SmartBuyGlasses挪威
2016/08/20 全球购物
GE设备配件:GE Appliance Parts(家电零件、配件和滤水器)
2018/11/28 全球购物
实习护理工作自我评价
2013/09/25 职场文书
注塑工厂厂长岗位职责
2013/12/02 职场文书
运动会领导邀请函
2014/02/05 职场文书
超市创业计划书
2014/04/24 职场文书
白莲教口号
2014/06/18 职场文书
如何签定毕业生就业协议书
2014/09/28 职场文书
三峡大坝导游词
2015/01/31 职场文书
放假通知格式
2015/04/14 职场文书
党员带头倡议书
2015/04/29 职场文书
实习单位鉴定意见
2015/06/04 职场文书
使用Django实现商城验证码模块的方法
2021/06/01 Python
中国古风插画师排行榜:夏达第一,第三是阴阳师姑获鸟皮肤创作者
2022/03/18 国漫
日本动漫十大公认神作:第五现已全网禁播,《死亡笔记》在榜
2022/03/18 日漫