启动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 10 Python
Python单链表的简单实现方法
Sep 23 Python
同时安装Python2 &amp; Python3 cmd下版本自由选择的方法
Dec 09 Python
python中列表和元组的区别
Dec 18 Python
浅谈python中np.array的shape( ,)与( ,1)的区别
Jun 04 Python
Python一行代码实现快速排序的方法
Apr 30 Python
Pycharm 2019 破解激活方法图文详解
Oct 11 Python
Django 自动生成api接口文档教程
Nov 19 Python
将自己的数据集制作成TFRecord格式教程
Feb 17 Python
Python eval函数介绍及用法
Nov 09 Python
python实现b站直播自动发送弹幕功能
Feb 20 Python
关于python pygame游戏进行声音添加的技巧
Oct 24 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产生不重复随机数的5个方法总结
2014/11/12 PHP
遍历指定目录,并存储目录内所有文件属性信息的php代码
2016/10/28 PHP
详解php协程知识点
2018/09/21 PHP
event.keyCode键码值表 附只能输入特定的字符串代码
2009/05/15 Javascript
Javascript 汉字字节判断
2009/08/01 Javascript
JQuery this 和 $(this) 的区别
2009/08/23 Javascript
JavaScript 大数据相加的问题
2011/08/03 Javascript
MultiSelect左右选择控件的设计与实现介绍
2013/06/08 Javascript
多选列表框动态添加,移动,删除,全选等操作的简单实例
2014/01/13 Javascript
简述JavaScript对传统文档对象模型的支持
2015/06/16 Javascript
js的各种排序算法实现(总结)
2016/07/23 Javascript
jQuery制作图片旋转效果
2017/02/02 Javascript
js实现导航跟随效果
2018/11/17 Javascript
JS实现的冒泡排序,快速排序,插入排序算法示例
2019/03/02 Javascript
详解jQuery如何实现模糊搜索
2019/05/10 jQuery
layui表单提交到后台自动封装到实体类的方法
2019/09/12 Javascript
JavaScript 如何在浏览器中使用摄像头
2020/12/02 Javascript
[01:20]PWL S2开团时刻第三期——团战可以输 蝙蝠必须死
2020/11/26 DOTA
Python使用scrapy抓取网站sitemap信息的方法
2015/04/08 Python
python解析xml文件实例分析
2015/05/27 Python
Python实现脚本锁功能(同时只能执行一个脚本)
2017/05/10 Python
基于Python List的赋值方法
2018/06/23 Python
Python中的取模运算方法
2018/11/10 Python
Python实现统计英文文章词频的方法分析
2019/01/28 Python
浅谈Python中函数的定义及其调用方法
2019/07/19 Python
django echarts饼图数据动态加载的实例
2019/08/12 Python
PyTorch预训练的实现
2019/09/18 Python
浅谈python之自动化运维(Paramiko)
2020/01/31 Python
python3 配置logging日志类的操作
2020/04/08 Python
自荐信的禁忌和要点
2013/10/15 职场文书
课改先进个人汇报材料
2014/01/26 职场文书
商场客服专员岗位职责
2014/06/13 职场文书
优秀团员事迹材料2000字
2014/08/20 职场文书
预备党员自我批评思想汇报
2014/10/10 职场文书
研究生简历自我评
2015/03/11 职场文书
使用Canvas绘制一个游戏人物属性图
2022/03/25 Javascript