| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
Commit 9f5764dac39b ("saveconfig: set right perms on /etc/target/ dir")
fixed CVE-2020-13867 by ensuring that the mode of the target
meta-data directory (/etc/target) was always mode 0600. But users
can specify a different directory, such as "/tmp", and we don't
want targetcli changing the mode of such directories to 0600. So
only change the mode of the directory, when saving a config file,
if the directory is /etc/target.
|
| |
|
|
| |
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
fallocate() can't be used to create sparse files because it
actually preallocates all the disk space that will be used by the file
backstore, sparse files do not have preallocated disk space
by definition.
We must therefore use ftruncate().
We can, on the other hand, use fallocate() to create non-sparse
files and fall back to the slower "while() fwrite()" if we
are running on Python version < 3.3 where fallocate() is not available
Fixes 3bd4d8ef7c9b154c53e8b8dd863a570bce7f5c2c
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
| |
|
|
| |
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
| |
|
|
| |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
| |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
| |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
set interactive mode as default to make it appear similar to cli approach,
$ targetcli
targetcli shell version 2.1.51
Entering targetcli interactive mode for daemonized approach.
Type 'exit' to quit.
/> pwd
/
/> cd /iscsi
/> pwd
/iscsi
/> exit
Here we introduce a new global option daemon_use_batch_mode for switching between
batch and interactive modes.
$ targetcli set global daemon_use_batch_mode=true
Parameter daemon_use_batch_mode is now 'true'.
$ targetcli
targetcli shell version 2.1.51
Entering targetcli batch mode for daemonized approach.
Enter multiple commands separated by newline and type 'exit' to run them
all in one go.
/> pwd
/> cd /iscsi
/> pwd
/
/iscsi
Fixes: #160
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| | |
|
| |\
| |
| | |
Remove Epydoc markup from command messages
|
| | |
| |
| |
| | |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
| | | |
|
| |\ \
| | |
| | | |
[targetcli] restoreconfig: add ability to restore/reload single target or storage_object
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Problem:
-------
Right now, if any target or storage_object is failed to load as part of
target service bringup or manual restoreconfig, may be because of an issue from
the backend, then there is no way to reload that single storage_object or target,
we need to reload/restart all the targets/storage_objects present in the node
just to load one single target/storage_object, this interrupts on going
I/O (via this path) for all the volumes hosted within the node.
Solution:
--------
Add a capability to reload single target or storage_object without touching other
targets or storage_objects hosted in the node.
usage:
$ targetcli
targetcli shell version 2.1.fb49
Copyright 2011-2013 by Datera, Inc and others
For help on commands, type 'help'.
/> help
[...]
AVAILABLE COMMANDS
The following commands are available in the current path:
[...]
- restoreconfig [savefile] [clear_existing] [target] [storage_object]
[...]
Ex 1. reload single storage_object
$ targetcli restoreconfig /etc/target/saveconfig.json clear_existing \
storage_object=blockx
Ex 2. reload single target
$ targetcli restoreconfig /etc/target/saveconfig.json clear_existing \
target=iqn.2016-12.org.gluster-block:xxx
Ex 3. reload a given target and storage_object
$ targetcli restoreconfig /etc/target/saveconfig.json clear_existing \
target=iqn.2016-12.org.gluster-block:xxx storage_object=blockx
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The discovery_auth attribute group in the /iscsi node
has several attributes, and all area treated like strings,
even though "enable" is a number in sysfs, accepting either
zero or one. It would break backwards compatability to
convert this attribute to be a boolean, so at least
treat it like a proper number instead of a string.
This avoids stack dumps like the following when trying
to set this attribute to 'true' or 'false':
> /iscsi> set discovery_auth enable=false
> Traceback (most recent call last):
> File "/usr/bin/targetcli", line 122, in <module>
> main()
> File "/usr/bin/targetcli", line 112, in main
> shell.run_interactive()
> File "/usr/lib/python3.6/site-packages/configshell_fb/shell.py", line 905, in run_interactive
> self._cli_loop()
> File "/usr/lib/python3.6/site-packages/configshell_fb/shell.py", line 734, in _cli_loop
> self.run_cmdline(cmdline)
> File "/usr/lib/python3.6/site-packages/configshell_fb/shell.py", line 848, in run_cmdline
> self._execute_command(path, command, pparams, kparams)
> File "/usr/lib/python3.6/site-packages/configshell_fb/shell.py", line 823, in _execute_command
> result = target.execute_command(command, pparams, kparams)
> File "/usr/lib/python3.6/site-packages/configshell_fb/node.py", line 1406, in execute_command
> return method(*pparams, **kparams)
> File "/usr/lib/python3.6/site-packages/configshell_fb/node.py", line 522, in ui_command_set
> group_setter(param, value)
> File "/usr/lib/python3.6/site-packages/targetcli/ui_target.py", line 134, in ui_setgroup_discovery_auth
> self.rtsnode.discovery_enable_auth = value
> File "/usr/lib/python3.6/site-packages/rtslib_fb/fabric.py", line 243, in _set_discovery_enable_auth
> if int(enable):
> ValueError: invalid literal for int() with base 10: 'false'
Now the output will be:
> Not setting enable! Syntax error, 'false' is not a NUMBER.
|
| |\
| |
| | |
targetclid: add daemonize component for targetcli
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
$ targetcli set global
GLOBAL CONFIG GROUP
[...]
auto_use_daemon=bool
If true, commands will be sent to targetclid.
[...]
$ targetcli set global auto_use_daemon=True
Parameter auto_use_daemon is now 'true'.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |/
|
|
|
|
|
|
|
|
| |
Instead of removing the first three characters of the "tpg" prefix to
get matches for the TPG tag number, the code removes four characters,
thus erasing the first digit of the TPG tag number.
This patches fixes issue #134.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
| |
|
|
| |
Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
|
| |\
| |
| | |
Add emulate_pr backstore attribute
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Added to the kernel via b49d6f7885306ee636d5c1af52170f3069ccf5f7, the
emulate_pr attribute can be used to disable support for SCSI-2
(RESERVE/RELEASE) and Persistent Reservations.
Signed-off-by: David Disseldorp <ddiss@suse.de>
|
| | |
| |
| |
| | |
Signed-off-by: Leo Zhang <nguzcf@gmail.com>
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We have noticed saveconfig.json with 100 storage objects and 100 targets
(each holding a single tpg and a portal) consumes disk space around ~500K.
Which is very expensive, and backing-up such 100 saveconfig.json files will
take ~50M of disk space under /etc/target/backup/
And at scale like 1000 storage objects and targets, this will become worst.
Hence this patch attempts to compress(gzip) and store saveconfig.json while
backing-up.
Saved space example:
[root@localhost ~]# targetcli ls | grep -e "user:glfs" -e "iscsi"
| o- user:glfs ......................... [Storage Objects: 100]
o- iscsi ............................... [Targets: 100]
[root@localhost ~]# du -sh /etc/target/saveconfig.json
448K /etc/target/saveconfig.json
[root@localhost ~]# du -sh /etc/target/backup/saveconfig-20181128-18\:20\:43-json.gz
12K /etc/target/backup/saveconfig-20181128-18:20:43-json.gz
Reducing disk usage per backup file from 448K to 12K is very efficient right.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| | |
| |
| |
| | |
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
|
| |\ \
| | |
| | | |
targetcli-fb: Add support for media change
|
| | | |
| | |
| | |
| | |
| | | |
Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Mike Christie mchristi@redhat.com
|
| | | |
| | |
| | |
| | | |
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
|
| | | |
| | |
| | |
| | | |
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
currently, we can use block-level save feature for create command and
reconfig of different attributes, but there is no way to use block-level
feature for delete command.
This patch introduces 'save' flag (False on default), which can trigger
saveconfig internally as part of delete command.
$ targetcli /backstores/user:glfs delete test save=True
Deleted storage object test.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |\ \
| | |
| | | |
create: add a way to set control string
|
| | |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
this patch enable users to supply control option, a string containing comma
separated control=value kind tuples, that are passed to the kernel control file.
Example:
$ targetcli /backstores/user:glfs create blockX1 1073741824 \
test@192.168.124.227/block-store/e59309bb-d591-4121-a891-e98ff3416446 \
control="max_data_area_mb=32,hw_max_sectors=256"
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |/
|
|
| |
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ targetcli /backstores/user:glfs/block1 help
[...]
AVAILABLE COMMANDS
[...]
- saveconfig [savefile]
- set [group] [parameter=value...]
- status
- version
$ targetcli /backstores/user:glfs/block1 saveconfig
Storage Object 'user:block1' config saved to /etc/target/saveconfig.json
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
| |
Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
|
| |\
| |
| | |
MappedLuns and Luns max number is not the same anymore
|
| | | |
|
| | |
| |
| |
| | |
Python3 does not have the "character" type, use signed char instead.
|
| |/
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Eg:
/> set global max_backup_files=1000
Parameter max_backup_files is now '1000'.
If 'max_backup_files' is set in /etc/target/targetcli.conf, then max value
between conf file setting and global option settings is considered.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
$ cat /etc/target/targetcli.conf
max_backup_files = 25
$ targetcli / saveconfig
Last 25 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
|
|
|
|
| |
With this change,
when '/etc/target/saveconfig.json' is same as '/etc/target/backup/saveconfig-${latest-stamp}.json
we skip backing up saveconfig.json
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently we do not create '/etc/target/backup/' while we expect the directory
to be presented by package (rpm).
If for some reason '/etc/target/backup' is not available, say may be a
unintentional deletion or use of targetcli which is compiled from source,
we see below errors on up on saveconfig command,
Case 1: No '/etc/target/backup/' dir
$ targetcli / saveconfig
Could not create backup file /etc/target/backup/saveconfig-20171215-15:26:48.json: No such file or directory.
Configuration saved to /etc/target/saveconfig.json
Case 2: No '/etc/target/' dir
$ targetcli / saveconfig
Could not create backup file /etc/target/backup/saveconfig-20171215-15:27:42.json: No such file or directory.
[Errno 2] No such file or directory: '/etc/target/saveconfig.json.temp'
This patch tries to create '/etc/target/backup' directory tree in case if it
is absent.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Configuring a read-only block device as read-write currently results in
a backstore->enable configfs I/O error, as documented in:
http://www.spinics.net/lists/target-devel/msg16310.html
This change sees targetcli check the read-only status of the underlying
block device via ioctl(BLKROGET). If a readonly= parameter isn't
provided, then the backstore will use the ioctl(BLKROGET) value as the
default.
Signed-off-by: David Disseldorp <ddiss@suse.de>
|
| |
|
|
|
|
|
| |
Use /etc/target/targetcli.conf file to store universal configurations
that are the same for all users.
Configuration file has format of:
key = value
|
| |\
| |
| | |
Replace dbus-python with GObject Introspection
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The dbus-python homepage advises against using it:
https://pypi.python.org/pypi/dbus-python/1.2.4
dbus-python might not be the best D-Bus binding for you to
use. dbus-python does not follow the principle of “In the face of
ambiguity, refuse the temptation to guess”, and can’t be changed to
not do so without seriously breaking compatibility.
In addition, it uses libdbus (which has known problems with
multi-threaded use) and attempts to be main-loop-agnostic (which
means you have to select a suitable main loop for your application).
Alternative ways to get your Python code onto D-Bus include:
- GDBus, part of the GIO module of GLib, via GObject-Introspection
and PyGI (uses the GLib main loop and object model)
- QtDBus, part of Qt, via PyQt (uses the Qt main loop and object
model)
This patch replaces dbus-python with the GObject Introspection Gio
module and fixes issue #90.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
| |/ |
|
| |
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
With these kernel patches:
https://www.spinics.net/lists/target-devel/msg15657.html
tcmu will be able to return errors during device addition.
This patch to targetcli catches errors from rtslib (rtslib will
catch the error and cleanup the configfs/kernel device and do a
raise) and return a error and message to the user.
|