version 2.0rc1.fb1-1

Signed-off-by: Andy Grover <agrover@redhat.com>
This commit is contained in:
Andy Grover 2011-12-07 10:56:58 -08:00
parent 03fb3c0f91
commit fbd7d9635b
11 changed files with 23 additions and 4461 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
/targetcli-1.99.2.gitb03ec79.tar.gz
/v2.0rc1.fb1
/v2.0rc1.fb2

View File

@ -1,29 +0,0 @@
From 786d5b84d653c019c391fa07e483947156a03e3d Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Sat, 30 Jul 2011 16:02:43 -0700
Subject: [PATCH 1/6] Remove ads from cli welcome msg. Mention help is available.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
scripts/targetcli | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/targetcli b/scripts/targetcli
index 8af0613..738f02c 100755
--- a/scripts/targetcli
+++ b/scripts/targetcli
@@ -58,9 +58,9 @@ def main():
shell = TargetCLI('~/.targetcli')
shell.con.epy_write('''
Welcome to the B{targetcli} shell::
- Copyright (c) 2011 by RisingTide Systems LLC.
+ Copyright (c) 2011 by RisingTide Systems LLC.\n
+ For help on commands, type 'help'.
- Visit us at U{http://www.risingtidesystems.com}.
''')
shell.con.display('')
if not is_root:
--
1.7.1

File diff suppressed because it is too large Load Diff

View File

@ -1,136 +0,0 @@
From 7b4dce12237dc9b79dbe4f2ac9dbbb125d314b2c Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Sat, 30 Jul 2011 18:31:45 -0700
Subject: [PATCH 3/6] Hack. dump scripts aren't in PATH anymore, so call them explicitly.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
targetcli/lio_dump.py | 3 ++-
targetcli/tcm_dump.py | 22 +++++++++++++---------
targetcli/tcm_fabric.py | 4 ++--
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/targetcli/lio_dump.py b/targetcli/lio_dump.py
index 81c5104..6ce217a 100644
--- a/targetcli/lio_dump.py
+++ b/targetcli/lio_dump.py
@@ -221,7 +221,8 @@ def lio_backup_to_file(option, opt_str, value, parser):
print "Unable to open backup_dir"
sys.exit(1)
- op = "lio_dump --stdout"
+ prefix = "python /usr/lib/python2.6/site-packages/rtsadmin/"
+ op = prefix + "lio_dump.py --stdout"
p = sub.Popen(op, shell=True, stdout=sub.PIPE).stdout
if not p:
print "Unable to dump LIO-Target/ConfigFS running state"
diff --git a/targetcli/tcm_dump.py b/targetcli/tcm_dump.py
index bf80632..1b76b62 100644
--- a/targetcli/tcm_dump.py
+++ b/targetcli/tcm_dump.py
@@ -20,6 +20,10 @@ tcm_root = "/sys/kernel/config/target/core"
def tcm_dump_hba_devices():
pass
+path_prefix = "python /usr/lib/python2.6/site-packages/rtsadmin/"
+tcm_node_path = path_prefix + "tcm_node.py"
+tcm_dump_path = path_prefix + "tcm_dump.py"
+
def tcm_dump_configfs(option, opt_str, value, parser):
if not os.path.isdir(tcm_root):
@@ -68,35 +72,35 @@ def tcm_dump_configfs(option, opt_str, value, parser):
params = tcm_pscsi.pscsi_get_params(dev)
if not params:
continue
- print "tcm_node --establishdev " + f + "/" + g + " " + str(params)
+ print tcm_node_path + " --establishdev " + f + "/" + g + " " + str(params)
result = re.search('iblock_', f)
if result:
dev = dev_root + g
params = tcm_iblock.iblock_get_params(dev)
if not params:
continue
- print "tcm_node --establishdev " + f + "/" + g + " " + str(params)
+ print tcm_node_path + " --establishdev " + f + "/" + g + " " + str(params)
result = re.search('rd_dr_', f)
if result:
dev = dev_root + g
params = tcm_ramdisk.rd_get_params(dev)
if not params:
continue
- print "tcm_node --establishdev " + f + "/" + g + " " + str(params)
+ print tcm_node_path + " --establishdev " + f + "/" + g + " " + str(params)
result = re.search('rd_mcp_', f)
if result:
dev = dev_root + g
params = tcm_ramdisk.rd_get_params(dev)
if not params:
continue
- print "tcm_node --establishdev " + f + "/" + g + " " + str(params)
+ print tcm_node_path + " --establishdev " + f + "/" + g + " " + str(params)
result = re.search('fileio_', f)
if result:
dev = dev_root + g
params = tcm_fileio.fd_get_params(dev)
if not params:
continue
- print "tcm_node --establishdev " + f + "/" + g + " " + str(params)
+ print tcm_node_path + " --establishdev " + f + "/" + g + " " + str(params)
# Dump T10 VP Unit Serial for all non Target_Core_Mod/pSCSI objects
result = re.search('pscsi_', f)
@@ -108,7 +112,7 @@ def tcm_dump_configfs(option, opt_str, value, parser):
off += 8 # Skip over "Number: "
unit_serial = value[off:]
# Note that this will handle read, parse and set any PR APTPL metadata
- print "tcm_node --setunitserialwithmd " + f + "/" + g + " " + unit_serial.rstrip()
+ print tcm_node_path + " --setunitserialwithmd " + f + "/" + g + " " + unit_serial.rstrip()
os.close(p)
# Dump device object alias
@@ -146,7 +150,7 @@ def tcm_dump_configfs(option, opt_str, value, parser):
os.close(p)
if not value:
continue
- print "tcm_node --addaluatpgwithmd " + f + "/" + g + " " + tg_pt_gp + " " + value.rstrip()
+ print tcm_node_path + " --addaluatpgwithmd " + f + "/" + g + " " + tg_pt_gp + " " + value.rstrip()
# Dump the ALUA types
tg_pt_gp_type_file = dev_root + g + "/alua/" + tg_pt_gp + "/alua_access_type"
p = os.open(tg_pt_gp_type_file, 0)
@@ -244,7 +248,7 @@ def tcm_dump_configfs(option, opt_str, value, parser):
print "echo " + attr_val + " > " + attrib_file
if snap_enabled == 1:
- print "tcm_node --lvsnapstart " + f + "/" + g
+ print tcm_node_path + " --lvsnapstart " + f + "/" + g
def tcm_backup_to_file(option, opt_str, value, parser):
datetime = str(value)
@@ -261,7 +265,7 @@ def tcm_backup_to_file(option, opt_str, value, parser):
print "Unable to open backup_dir"
sys.exit(1)
- op = "tcm_dump --stdout"
+ op = tcm_dump_path + " --stdout"
p = sub.Popen(op, shell=True, stdout=sub.PIPE).stdout
if not p:
print "Unable to dump Target_Core_Mod/ConfigFS running state"
diff --git a/targetcli/tcm_fabric.py b/targetcli/tcm_fabric.py
index 8a843d4..03f5570 100644
--- a/targetcli/tcm_fabric.py
+++ b/targetcli/tcm_fabric.py
@@ -254,8 +254,8 @@ def fabric_backup_to_file(date_time, fabric_name, fabric_root, module_name):
if ret:
print "Unable to open backup_dir"
sys.exit(1)
-
- op = "tcm_fabric --stdout --fabric-name=" + fabric_name + " --fabric-root=" + fabric_root + " --module-name=" + module_name
+ prefix = "python /usr/lib/python2.6/site-packages/rtsadmin/"
+ op = prefix + "tcm_fabric.py --stdout --fabric-name=" + fabric_name + " --fabric-root=" + fabric_root + " --module-name=" + module_name
# print "Using op: " + op
p = sub.Popen(op, shell=True, stdout=sub.PIPE).stdout
if not p:
--
1.7.1

View File

@ -1,26 +0,0 @@
From 8f6fb804f7bf68bafa4799fb821882bd97e777c8 Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Mon, 1 Aug 2011 14:40:12 -0700
Subject: [PATCH 4/6] ignore errors from failure to set device attributes
Signed-off-by: Andy Grover <agrover@redhat.com>
---
targetcli/tcm_dump.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/targetcli/tcm_dump.py b/targetcli/tcm_dump.py
index 1b76b62..abfd592 100644
--- a/targetcli/tcm_dump.py
+++ b/targetcli/tcm_dump.py
@@ -211,7 +211,7 @@ def tcm_dump_configfs(option, opt_str, value, parser):
attrib_file = dev_attrib_root + h
p = os.open(attrib_file, 0)
value = os.read(p, 8)
- print "echo " + value.rstrip() + " > " + attrib_file
+ print "echo " + value.rstrip() + " > " + attrib_file + " 2>/dev/null"
os.close(p)
# Dump snapshot attributes
--
1.7.1

View File

@ -1,29 +0,0 @@
From 8f91eb2b471f8db02888e80d37f90b1c6c42605a Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Thu, 25 Aug 2011 14:41:29 -0700
Subject: [PATCH 5/6] fix spec_root path
We moved the specs from /var/target/fabric to /var/lib/target/fabric, so
this needs to be updated so saveconfig will work.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
targetcli/tcm_fabric.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/targetcli/tcm_fabric.py b/targetcli/tcm_fabric.py
index 03f5570..2c4c6dc 100644
--- a/targetcli/tcm_fabric.py
+++ b/targetcli/tcm_fabric.py
@@ -6,7 +6,7 @@ import datetime, time
import optparse
target_root = "/sys/kernel/config/target/"
-spec_root = "/var/target/fabric/"
+spec_root = "/var/lib/target/fabric/"
def fabric_configfs_dump(fabric_name, fabric_root, module_name):
--
1.7.1

View File

@ -1,173 +0,0 @@
From 163c6d070b1b5f53327bf760b54b75c18d5c19cc Mon Sep 17 00:00:00 2001
From: Andy Grover <agrover@redhat.com>
Date: Mon, 21 Nov 2011 14:54:41 -0800
Subject: [PATCH 6/8] add docs
add a man page.
Signed-off-by: Andy Grover <agrover@redhat.com>
---
targetcli.8 | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 151 insertions(+), 0 deletions(-)
create mode 100644 targetcli.8
diff --git a/targetcli.8 b/targetcli.8
new file mode 100644
index 0000000..54e26f4
--- /dev/null
+++ b/targetcli.8
@@ -0,0 +1,151 @@
+.TH targetcli 8
+.SH NAME
+.B targetcli
+.SH DESCRIPTION
+.B targetcli
+is a shell for viewing, editing, and saving the configuration of
+the kernel's target subsystem, also known as TCM/LIO. It enables the
+administrator to assign local storage resources backed by either files,
+volumes, or local SCSI devices, and export them to remote systems via
+network fabrics, such as iSCSI, FCoE, or others.
+.P
+The configuration layout is tree-based, similar to a filesystem, and
+navigated in a similar manner.
+.SH USAGE
+Invoke
+.B targetcli
+as root to enter the configuration shell. Use
+.B ls
+to list nodes below the current path. Configuration changes are made
+immediately. To retain changes on reboot, use
+.BR saveconfig .
+Moving
+around the tree is accomplished by the
+.B cd
+command, or by entering
+the new location directly. Use
+.B "help <cmd>"
+for additional usage
+information. Tab-completion is enabled for commands and command
+arguments.
+.SH EXAMPLES
+To export a storage resource, 1) define a storage object using
+backstore, then 2) export the object via a network fabric, such as
+iSCSI or FCoE.
+.SS DEFINING A STORAGE OBJECT WITH BACKSTORE
+.B backstores/fileio0 create disk1 /disks/disk1.img 140M
+.br
+Creates a storage object named
+.I disk1
+with the given path and size.
+.B targetcli
+supports common size abbreviations like 'M', 'G', and 'T'.
+.P
+In addition to the
+.I fileio
+backstore for file-backed volumes, other backstore types include
+.I iblock
+for block-device-backed volumes, and
+.I pscsi
+for volumes backed by local SCSI devices. See the built-in help
+for more details on required parameters.
+.SS EXPORTING A STORAGE OBJECT VIA FCOE
+.B tcm_fc/ create 20:00:00:19:99:a8:34:bc
+.br
+Create an FCoE target with the given WWN.
+.B targetcli
+can tab-complete the WWN based on registered FCoE interfaces. If none
+are found, verify that they are properly configured and are shown in
+the output of
+.BR "fcoeadm -i" .
+.P
+.B tcm_fc/20:00:00:19:99:a8:34:bc/
+.br
+If
+.B auto_cd_after_create
+is set to false, change to the configuration node for the given
+target, equivalent to giving the command prefixed by
+.BR cd .
+.P
+.B luns/ create /backstores/fileio/disk1
+.br
+Create a new LUN for the interface, attached to a previously defined
+storage object. The storage object now shows up under the /backstores
+configuration node as
+.BR activated .
+.P
+.B acls/ create 00:99:88:77:66:55:44:33
+.br
+Create an ACL (access control list), for defining the resources each
+initiator may access. The default behavior is to auto-map existing
+LUNs to the ACL; see help for more information.
+.P
+The LUN should now be accessible via FCoE.
+.SS EXPORTING A STORAGE OBJECT VIA ISCSI
+.B iscsi/ create
+.br
+Creates an iSCSI target with a default WWN. It will also create an
+initial target portal group called
+.IR tpgt1 .
+.P
+.B iqn.2003-01.org.linux-iscsi.test2.x8664:sn123456789012/tpgt1/
+.br
+An example of changing to the configuration node for the given
+target's first target portal group (TPG). This is equivalent to giving
+the command prefixed by "cd". (Although more can be useful for certain
+setups, most configurations have a single TPG per target. In this
+case, configuring the TPG is equivalent to configuring the overall
+target.)
+.P
+.B portals/ create
+.br
+Add a portal, i.e. an address and TCP port via which the target can be
+contacted by initiators. Sane defaults are used if these are not
+specified.
+.P
+.B luns/ create /backstores/fileio0/disk1
+.br
+Create a new LUN in the TPG, attached to the storage object that has
+previously been defined. The storage object now shows up under the
+/backstores configuration node as activated.
+.P
+.B acls/ create iqn.1994-05.com.redhat:4321576890
+.br
+Creates an ACL (access control list) for the given iSCSI initiator.
+.P
+.B acls/iqn.1994-05.com.redhat:4321576890 create 2 0
+.br
+Gives the initiator access to the first exported LUN (lun0), which the
+initiator will see as lun2. The default is to give the initiator
+read/write access; if read-only access was desired, an additional "1"
+argument would be added to enable write-protect.
+.SS OTHER COMMANDS
+.B saveconfig
+.br
+Save the current configuration settings to a file, from which
+settings will be restored if the system is rebooted.
+.P
+This command must be executed from the configuration root node.
+.P
+.B exit
+.br
+Leave the configuration shell.
+.SS SETTINGS
+.B set attribute authentication=0
+.br
+Disable CHAP authentication.
+.P
+.B set global auto_cd_after_create=false
+.br
+Do not change into the configuration node of a newly created
+object. The default is 'true'.
+.SH FILES
+.B /etc/target/*
+.br
+.B /var/lib/target/*
+.SH AUTHOR
+Written by Jerome Martin <jxm@risingtidesystems.com>.
+.br
+Man page written by Andy Grover <agrover@redhat.com>.
+.SH REPORTING BUGS
+Report bugs to <target-devel@vger.kernel.org>
--
1.7.1

View File

@ -1,35 +0,0 @@
commit 1af9a2ce6f1ebb15a43439c7c438b59d69568fd5
Author: Andy Grover <agrover@redhat.com>
Date: Wed Nov 2 14:46:39 2011 -0700
append all start scripts into /etc/target/all_start.sh
This should make systemd packaging a little easier.
Signed-off-by: Andy Grover <agrover@redhat.com>
diff --git a/targetcli/ui_root.py b/targetcli/ui_root.py
index 2048544..b3f78c4 100644
--- a/targetcli/ui_root.py
+++ b/targetcli/ui_root.py
@@ -89,6 +89,20 @@ class UIRoot(UINode):
else:
self.shell.log.warning("Aborted, configuration left untouched.")
+ # append all into single script
+ from glob import iglob
+ import os
+ import shutil
+ sources = iglob(os.path.join("/etc/target", '*_start.sh'))
+ # ensure tcm_start is appended first
+ sources = [x for x in sources if not 'tcm_' in x]
+ sources = [x for x in sources if not 'all_' in x]
+ sources.insert(0, '/etc/target/tcm_start.sh')
+ dest = open('/etc/target/all_start.sh', 'wb')
+ for filename in sources:
+ shutil.copyfileobj(open(filename, 'rb'), dest)
+ dest.close()
+
def ui_command_version(self):
'''
Displays the targetcli and support libraries versions.

View File

@ -1 +1 @@
d90375b632ffb27700fa006b0e39e3f6 targetcli-1.99.2.gitb03ec79.tar.gz
a000250bd42fbafaa641b9cd0e7c1663 v2.0rc1.fb2

View File

@ -1,13 +0,0 @@
diff --git a/rtsadmin/__init__.py b/rtsadmin/__init__.py
index 90150a8..c8a8f07 100644
--- a/targetcli/__init__.py
+++ b/targetcli/__init__.py
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from ui_root import UIRoot
-__version__ = 'GIT_VERSION'
+__version__ = 'b03ec79'
__author__ = "Jerome Martin <jxm@risingtidesystems.com>"
__url__ = "http://www.risingtidesystems.com"
__description__ = "An administration shell for RTS storage targets."

View File

@ -1,30 +1,19 @@
%global oname targetcli-fb
Name: targetcli
License: AGPLv3
Group: System Environment/Libraries
Summary: An administration shell for storage targets
Version: 1.99.2.gitb03ec79
Release: 4%{?dist}
# placeholder URL and source entries
# archive created using:
# git clone git://risingtidesystems.com/targetcli.git
# cd targetcli
# git archive b03ec79 --prefix targetcli-%{version}/ | gzip > targetcli-%{version}.tar.gz
URL: http://www.risingtidesystems.com/git/
Source: %{name}-%{version}.tar.gz
Version: 2.0rc1.fb2
Release: 1%{?dist}
URL: https://github.com/agrover/targetcli-fb
Source: https://github.com/agrover/%{oname}/tarball/v%{version}
Source1: targetcli.service
Patch1: targetcli-git-version.patch
Patch2: 0001-Remove-ads-from-cli-welcome-msg.-Mention-help-is-ava.patch
Patch3: 0002-bundle-lio-utils.patch
Patch4: 0003-Hack.-dump-scripts-aren-t-in-PATH-anymore-so-call-th.patch
Patch5: 0004-ignore-errors-from-failure-to-set-device-attributes.patch
Patch6: 0005-fix-spec_root-path.patch
Patch7: 0006-add-docs.patch
Patch8: 0007-all-start.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: python-devel python-rtslib python-configshell epydoc
BuildRequires: systemd-units
Requires: python-rtslib python-configshell
Requires: python-rtslib >= 2.1.fb1, python-configshell
Requires(post): systemd-units
@ -35,15 +24,7 @@ users will also need to install and use fcoe-utils.
%prep
%setup -q -n %{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%setup -q -n agrover-%{oname}-091a9a2
%build
%{__python} setup.py build
@ -77,6 +58,18 @@ fi
%{_mandir}/man8/targetcli.8.gz
%changelog
* Tue Dec 6 2011 Andy Grover <agrover@redhat.com> - 2.0rc1.fb2-1
- New upstream source and release
- Remove patches:
* targetcli-git-version.patch
* 0001-Remove-ads-from-cli-welcome-msg.-Mention-help-is-ava.patch
* 0002-bundle-lio-utils.patch
* 0003-Hack.-dump-scripts-aren-t-in-PATH-anymore-so-call-th.patch
* 0004-ignore-errors-from-failure-to-set-device-attributes.patch
* 0005-fix-spec_root-path.patch
* 0006-add-docs.patch
* 0007-all-start.patch
* Mon Nov 21 2011 Andy Grover <agrover@redhat.com> - 1.99.2.gitb03ec79-4
- Update doc patch to include iscsi tutorial