启动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使用多线程不断刷新网页的方法
Mar 31 Python
Python中read()、readline()和readlines()三者间的区别和用法
Jul 30 Python
Python批量更改文件名的实现方法
Oct 29 Python
学习python的前途 python挣钱
Feb 27 Python
pyqt5 comboBox获得下标、文本和事件选中函数的方法
Jun 14 Python
Python生成指定数量的优惠码实操内容
Jun 18 Python
python适合人工智能的理由和优势
Jun 28 Python
在Python函数中输入任意数量参数的实例
Jul 16 Python
使用Django搭建web服务器的例子(最最正确的方式)
Aug 29 Python
python中栈的原理及实现方法示例
Nov 27 Python
tensorflow常用函数API介绍
Apr 19 Python
python判断是空的实例分享
Jul 06 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记录和读取JSON格式日志文件
2016/07/07 PHP
PHP利用二叉堆实现TopK-算法的方法详解
2017/04/24 PHP
PHP实现模拟http请求的方法分析
2017/12/20 PHP
在云虚拟主机部署thinkphp5项目的步骤详解
2017/12/21 PHP
php设计模式之正面模式实例分析【星际争霸游戏案例】
2020/03/24 PHP
javascript:void(0)使用探讨
2013/08/27 Javascript
js图片实时加载提供网页打开速度
2014/09/11 Javascript
JavaScript中用字面量创建对象介绍
2014/12/31 Javascript
JS获得选取checkbox整行数据的方法
2015/01/28 Javascript
js实现仿QQ秀换装效果的方法
2015/03/04 Javascript
jQuery实现checkbox列表的全选、反选功能
2016/11/24 Javascript
原生JavaScript实现进度条
2021/02/19 Javascript
[45:16]完美世界DOTA2联赛PWL S3 Magma vs Phoenix 第一场 12.12
2020/12/16 DOTA
python 字符串格式化代码
2013/03/17 Python
Python的动态重新封装的教程
2015/04/11 Python
Python加pyGame实现的简单拼图游戏实例
2015/05/15 Python
Python探索之创建二叉树
2017/10/25 Python
Django学习笔记之ORM基础教程
2018/03/27 Python
python logging日志模块以及多进程日志详解
2018/04/18 Python
详解关于Django中ORM数据库迁移的配置
2018/10/08 Python
python命令 -u参数用法解析
2019/10/24 Python
Python基于WordCloud制作词云图
2019/11/29 Python
Django怎么在admin后台注册数据库表
2020/11/14 Python
M1芯片安装python3.9.1的实现
2021/02/02 Python
Zavvi荷兰:英国大型音像制品和图书游戏零售商
2018/03/22 全球购物
财务会计毕业生自荐信
2013/11/02 职场文书
群众路线批评与自我批评
2014/02/06 职场文书
2014领导干部学习焦裕禄同志先进事迹思想汇报
2014/09/19 职场文书
2014年大学生党员评议表自我评价
2014/09/20 职场文书
信访稳定工作汇报
2014/10/27 职场文书
六一文艺汇演开幕词
2015/01/29 职场文书
2015年团队工作总结范文
2015/05/04 职场文书
个人催款函范文
2015/06/24 职场文书
汤姆叔叔的小屋读书笔记
2015/06/30 职场文书
优秀党员主要事迹范文
2015/11/05 职场文书
Spring Boot 启动、停止、重启、状态脚本
2021/06/26 Java/Android