启动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怎么学好python?
Oct 07 Python
python基础入门学习笔记(Python环境搭建)
Jan 13 Python
Python中matplotlib中文乱码解决办法
May 12 Python
同时安装Python2 &amp; Python3 cmd下版本自由选择的方法
Dec 09 Python
Python使用OpenCV进行标定
May 08 Python
python读取excel指定列数据并写入到新的excel方法
Jul 10 Python
python  Django中的apps.py的目的是什么
Oct 15 Python
Python同步遍历多个列表的示例
Feb 19 Python
Python3.6安装卸载、执行命令、执行py文件的方法详解
Feb 20 Python
Python 跨.py文件调用自定义函数说明
Jun 01 Python
Python基于数列实现购物车程序过程详解
Jun 09 Python
浅析Python模块之间的相互引用问题
Feb 26 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自动生成表单代码分享
2015/06/19 PHP
php 中奖概率算法实现代码
2017/01/25 PHP
详解PHP如何更好的利用PHPstorm的自动提示
2017/08/18 PHP
解决Laravel 不能创建 migration 的问题
2019/10/09 PHP
Thinkphp 框架基础之源码获取、环境要求与目录结构分析
2020/04/27 PHP
阻止子元素继承父元素事件具体思路及实现
2013/05/02 Javascript
extjs render 用法介绍
2013/09/11 Javascript
javascript scrollTop正解使用方法
2013/11/14 Javascript
js与jQuery 获取父窗、子窗的iframe
2013/12/20 Javascript
jquery.gridrotator实现响应式图片展示画廊效果
2015/06/23 Javascript
微信小程序 首页制作简单实例
2017/04/07 Javascript
Vue 2.0学习笔记之使用$refs访问Vue中的DOM
2017/12/19 Javascript
基于js 各种排序方法和sort方法的区别(详解)
2018/01/03 Javascript
js实现复制功能(多种方法集合)
2018/01/06 Javascript
JS实现排行榜文字向上滚动轮播效果
2019/11/26 Javascript
Openlayers学习之地图比例尺控件
2020/09/28 Javascript
SublimeText 2编译python出错的解决方法(The system cannot find the file specified)
2013/11/27 Python
Django添加KindEditor富文本编辑器的使用
2018/10/24 Python
python opencv实现信用卡的数字识别
2020/01/12 Python
python无序链表删除重复项的方法
2020/01/17 Python
Python读取分割压缩TXT文本文件实例
2020/02/14 Python
Django高并发负载均衡实现原理详解
2020/04/04 Python
python删除指定列或多列单个或多个内容实例
2020/06/28 Python
英国HYPE双肩包官网:英国本土时尚潮牌
2018/09/26 全球购物
Nasty Gal英国:美国女性服饰销售网站
2021/03/02 全球购物
中学老师的自我评价
2013/11/07 职场文书
初中数学教学反思
2014/01/16 职场文书
毕业生求职信的经典写法
2014/01/31 职场文书
超市开店计划书
2014/04/26 职场文书
竞选生活委员演讲稿
2014/04/28 职场文书
党员民主评议总结
2014/10/20 职场文书
党小组评议意见
2015/06/02 职场文书
立春观后感
2015/06/18 职场文书
董事长助理工作总结2015
2015/07/23 职场文书
PostgreSQL通过oracle_fdw访问Oracle数据的实现步骤
2021/05/21 PostgreSQL
java executor包参数处理功能 
2022/02/15 Java/Android