| 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: 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>
|
|\
| |
| | |
Remove Epydoc markup from command messages
|
| |
| |
| |
| | |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
|
|
|
|
| |
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: 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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Use /etc/target/targetcli.conf file to store universal configurations
that are the same for all users.
Configuration file has format of:
key = value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Properly detect errors when writing backup files. (Closes: #80)
If the backup directory does not exist, properly detect that and show a
warning message to the user, so that they don't think that their
configuration was backed up, when it fact wasn't.
Additionally, try to automatically create the backup directory if it
does not exist.
Signed-off-by: Christian Seiler <christian@iwakd.de>
* Don't automatically create backup directory if it doesn't exist.
After discussion on the issue tracker, it was decided to not
auto-create the backup-directory if it doesn't exist yet.
If the directory doesn't exist, the user will now see the warning.
Signed-off-by: Christian Seiler <christian@iwakd.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rtslib creates a backstore cache from configfs as a global variable.
The targetcli refresh function needs to clear out said cache, or you
end up with errors such as the following from an active shell if
you create a new backstore from a different shell.
/> refresh
Storage object fileio/test not found
In order to work this depends on pull request #87 from rtslib_fb,
however it is written so that it won't break if an older version
of the library is still in use.
Signed-off-by: Amartey Pearson <apearson@us.ibm.com>
|
|
|
|
| |
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
|
|
|
|
|
|
|
|
|
| |
* Replace dict.iteritems() with six.iteritems(dict)
* Use six.moves.range() to get xrange() on Python 2 and range() on
Python 3
* Add classifiers to setup.py
* Sort imports
Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
|
|
|
|
|
|
| |
Use complete_path from ui_backstore.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Since rtslib-fb and configshell-fb have different APIs from the original
rtslib and configshell, we're trying to move off those package names since
it can cause user confusion. Change our version of targetcli to indicate it
requires the -fb versions.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
| |
Slightly more efficient.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
| |
Do not reference the backstore, access the plugin field off the so
directly. This is a regression introduced with the backstore removal
changes a while back.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
If run_cmdline raises an exception, return 1 as exit code and print
exception text to stderr.
Keep running shell.run_interactive until shell._exit is set, logging
error messages.
Overriding execute_command in UINode no longer needed, remove.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
As a result it's now better for saveconfig to save/cull backups before
saving the current state, hopefully not a big deal.
Resolves #34
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
| |
Get the RTSRoot object on init, and then use it when needed in other
methods.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
| |
Generated with `2to3 -f filter`.
Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr>
|
|
|
|
|
|
|
|
|
|
| |
This patch converts rtslib code copyright from AGPL to the
permissive Apache License 2.0.
It also update copyright owner to Datera, Inc.
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
| |
Woo, saved one line.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
We save so much, they can get smooshed when something goes wrong but
you're just checking it out with targetcli. Save 10.
Only save backups when saving to default location.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
This lets us not bother with different text to have good grammar if the
number of objects is 0, 1, or more.
Update for rtslib changes.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
| |
rtslib.root.restore() now returns a list of the specific errors that
occurred. Print this list.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
| |
Would erase savefile if exception occurred during dump
fsync() for correctness too.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Don't show fabrics that need physical WWNs unless they are present.
Showing them is just clutter.
Simplify target summary.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Handle root.sessions returning dicts instead of classes
"details" action renamed to "detail", a little more English noun/verb
agreeable
added nested function print_session, to separate printing logic from
control logic.
used poorly-documented (but cool) dict selector syntax for string
substitutions in print_session. Now also prints more names in front of
values.
Mapped lun line prints plugin/so-name instead of udev_path, not all
backstores have a udev_path, e.g. ramdisk.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Made listing the session details optional,
option to show only a specific session,
documented the session command,
check given options.
The bare list doesn't show much specific for the session,
only the alias, sid, type and state.
Displaying the inititatorname would be possible, but it is too
long to fit the entry on one line then.
Signed-off-by: Johannes Dewender <github@JonnyJD.net>
|
|
|
|
|
|
|
|
|
| |
A session command at the root node, implemented with the new Session
class in rtslib.
This displays a detailed list of the open sessions to the targets.
Signed-off-by: Johannes Dewender <github@JonnyJD.net>
|
|
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
| |
We no longer differentiate between loaded and non-loaded fabric modules.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
| |
We're probably not going to use them all, and they can now demand-load
themselves.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
RTSRoot().restore() now returns the number of nonfatal errors that
occurred when parsing the dict.
Catch json parsing exception and print a nicer message.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
| |
use ui_eval_param to convert param from string to actual bool.
And, docstring.
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Proper versioning of dependencies should be enforced by package manager,
so we don't need those listed here.
Remove warning on version = 'GIT_VERSION'
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|
|
|
|
| |
Signed-off-by: Andy Grover <agrover@redhat.com>
|