启动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操作MySQL数据库9个实用实例
Dec 11 Python
Python操作Excel之xlsx文件
Mar 24 Python
python3 pillow生成简单验证码图片的示例
Sep 19 Python
解决PyCharm import torch包失败的问题
Oct 13 Python
Python中collections模块的基本使用教程
Dec 07 Python
Python函数装饰器常见使用方法实例详解
Mar 30 Python
django框架CSRF防护原理与用法分析
Jul 22 Python
matplotlib绘制多个子图(subplot)的方法
Dec 03 Python
简单了解python字符串前面加r,u的含义
Dec 26 Python
jupyter notebook 恢复误删单元格或者历史代码的实现
Apr 17 Python
TensorFlow keras卷积神经网络 添加L2正则化方式
May 22 Python
python实现二分查找算法
Sep 18 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数组排序函数合集 以及它们之间的联系分析
2013/06/27 PHP
PDO防注入原理分析以及使用PDO的注意事项总结
2014/10/23 PHP
PHP关联数组实现根据元素值删除元素的方法
2015/06/26 PHP
JavaScript While 循环基础教程
2007/04/05 Javascript
JavaScript入门学习书籍推荐
2008/06/12 Javascript
基本jquery的控制tabs打开的数量的代码
2010/10/17 Javascript
常用Extjs工具:Extjs.util.Format使用方法
2012/03/22 Javascript
JavaScript高级程序设计(第3版)学习笔记6 初识js对象
2012/10/11 Javascript
javascript中bind函数的作用实例介绍
2014/09/28 Javascript
浅谈javascript中自定义模版
2015/01/29 Javascript
js实现接收表单的值并将值拼在表单action后面的方法
2015/11/23 Javascript
JQuery ztree带筛选、异步加载实例讲解
2016/02/25 Javascript
js简单实现图片延迟加载的方法
2016/07/19 Javascript
Angular 4环境准备与Angular cli创建项目详解
2017/05/27 Javascript
JS按条件 serialize() 对应标签的使用方法
2017/07/24 Javascript
浅谈Angular HttpClient简单入门
2018/05/04 Javascript
vue计算属性和监听器实例解析
2018/05/10 Javascript
优化Vue项目编译文件大小的方法步骤
2019/05/27 Javascript
vue-cli2与vue-cli3在一台电脑共存的实现方法
2019/09/25 Javascript
[04:50]2019DOTA2高校联赛秋季赛四强集锦
2019/12/27 DOTA
详解python项目实战:模拟登陆CSDN
2019/04/04 Python
调试Django时打印SQL语句的日志代码实例
2019/09/12 Python
numpy:找到指定元素的索引示例
2019/11/26 Python
Python GUI编程学习笔记之tkinter控件的介绍及基本使用方法详解
2020/03/30 Python
Python decorator拦截器代码实例解析
2020/04/04 Python
html5中JavaScript removeChild 删除所有节点
2014/05/16 HTML / CSS
《赵州桥》教学反思
2014/02/17 职场文书
经理任命书模板
2014/06/06 职场文书
关于九一八事变的演讲稿2014
2014/09/17 职场文书
2014镇党委书记党建工作汇报材料
2014/11/02 职场文书
施工员岗位职责
2015/02/10 职场文书
后勤工作个人总结
2015/02/28 职场文书
趣味运动会口号
2015/12/24 职场文书
pandas:get_dummies()与pd.factorize()的用法及区别说明
2021/05/21 Python
SpringBoot整合Minio文件存储
2022/04/03 Java/Android
VUE解决跨域问题Access to XMLHttpRequest at
2022/05/06 Vue.js