启动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 相关文章推荐
使用pandas批量处理矢量化字符串的实例讲解
Jul 10 Python
matplotlib调整子图间距,调整整体空白的方法
Aug 03 Python
利用Python将文本中的中英文分离方法
Oct 31 Python
python ipset管理 增删白名单的方法
Jan 14 Python
python整小时 整天时间戳获取算法示例
Feb 20 Python
python 执行终端/控制台命令的例子
Jul 12 Python
Python Django 页面上展示固定的页码数实现代码
Aug 21 Python
Python换行与不换行的输出实例
Feb 19 Python
python 使用raw socket进行TCP SYN扫描实例
May 05 Python
Python OpenCV实现测量图片物体宽度
May 27 Python
python爬虫使用scrapy注意事项
Nov 23 Python
Python爬虫逆向分析某云音乐加密参数的实例分析
Dec 04 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
利用浏览器的Javascript控制台调试PHP程序
2014/01/08 PHP
php获取url参数方法总结
2014/11/13 PHP
用PHP写的一个冒泡排序法的函数简单实例
2016/05/26 PHP
PHP token验证生成原理实例分析
2019/06/05 PHP
Extjs学习笔记之七 布局
2010/01/08 Javascript
php上传图片并给图片打上透明水印的代码
2010/06/07 Javascript
使用jquery实现select添加实现后台权限添加的效果
2011/05/28 Javascript
JS 使用for循环遍历子节点查找元素
2014/09/06 Javascript
Javascript中call与apply的学习笔记
2014/09/22 Javascript
JavaScript Math.round() 方法
2015/12/18 Javascript
javascript实现倒计时跳转页面
2016/01/17 Javascript
使用PHP+JavaScript将HTML页面转换为图片的实例分享
2016/04/18 Javascript
javascript特殊文本输入框网页特效
2016/09/13 Javascript
vue.js指令v-for使用及索引获取
2016/11/03 Javascript
Bootstrap布局之栅格系统学习笔记
2017/05/04 Javascript
swiper插件自定义切换箭头按钮
2017/12/28 Javascript
Vue循环组件加validate多表单验证的实例
2018/09/18 Javascript
浅谈webpack+react多页面开发终极架构
2018/11/11 Javascript
vue 插件的方法代码详解
2019/06/06 Javascript
利用Electron简单撸一个Markdown编辑器的方法
2019/06/10 Javascript
微信小程序连接服务器展示MQTT数据信息的实现
2020/07/14 Javascript
解决vue-router 嵌套路由没反应的问题
2020/09/22 Javascript
探究Python中isalnum()方法的使用
2015/05/18 Python
python在openstreetmap地图上绘制路线图的实现
2019/07/11 Python
Pycharm中安装Pygal并使用Pygal模拟掷骰子(推荐)
2020/04/08 Python
英国汽车座椅和婴儿车购物网站:Uber Kids
2017/04/19 全球购物
国际知名军事风格休闲装品牌:Alpha Industries(阿尔法工业)
2017/05/24 全球购物
英国旅行箱包和行李箱购物网站:Travel Luggage & Cabin Bags
2019/08/26 全球购物
实习求职信
2013/12/01 职场文书
一个大学生十年的职业规划
2014/01/17 职场文书
大型会议接待方案
2014/03/01 职场文书
高中生操行评语
2014/04/25 职场文书
预防传染病方案
2014/06/14 职场文书
乡镇群众路线教育实践活动整改措施
2014/10/04 职场文书
作文批改评语
2014/12/25 职场文书
卫生主题班会
2015/08/14 职场文书