summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Handle systemd socket activation, when present.Lee Duncan2019-10-101-29/+41
| | | | | | | | | | | | | | | Regular socket communications are fallen back to when no systemd socket is present.
| * | Close socket when receiving a signal to interrupt connection.Lee Duncan2019-10-101-0/+6
| | | | | | | | | | | | | | | | | | | | | This allows the main loop to get an exception in its wait loop when a signal arrives, rather than block forever. Before this, topping the daemon required sending a KILL signal or sending one last command, so that the loop could check the "received a signal" flag.
| * | Exit with success when getting a signal.Lee Duncan2019-10-101-1/+2
| | | | | | | | | | | | | | | Save the error exit for unknown exits. This makes systemd happier, since it stops us with a signal.
| * | Only return response to targetcli when bytes presentLee Duncan2019-10-101-3/+3
| | | | | | | | | | | | | | | There's no need to return a zero-length string. Before being fixed, this caused a hang when shutting down.
| * | Removed useless semicolons, as they're ignoredLee Duncan2019-10-101-2/+2
| | |
| * | Handle OSError correctly: use strerror to get stringLee Duncan2019-10-101-4/+4
| | |
| * | Tweak systemd socket-activation settings for daemonLee Duncan2019-10-102-3/+4
| | | | | | | | | | | | Add Documentation entries, cleaned up socket activation entries.
| * | Handle Python 3.7 stricter binary vs. string rules.Lee Duncan2019-10-102-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | We can no longer have python automatically convert binary to/from string data, so be explicit about it. Also, the TargetCLI __del__ method was testing for a non-existant attribute, so close our socket if open.
| * | Fix indention for targetclid when processing output.Lee Duncan2019-10-101-3/+3
|/ / | | | | | | | | | | The indentation was wrong, causing the daemon to only process the last block of outout, which would only show up with a lot of output.
* | version 2.1.50v2.1.50Maurizio Lombardi2019-08-261-1/+1
| |
* | Merge pull request #144 from pkalever/reload-single-so-tgMaurizio Lombardi2019-08-261-2/+6
|\ \ | | | | | | [targetcli] restoreconfig: add ability to restore/reload single target or storage_object
| * | restoreconfig: add ability to restore/reload single target or storage_objectPrasanna Kumar Kalever2019-08-131-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge pull request #147 from gonzoleeman/fix-discovery_auth-enableMaurizio Lombardi2019-08-191-3/+8
|\ \ \ | |/ / |/| | iscsi discovery_auth enable is a number not a string
| * | iscsi discovery_auth enable is a number not a stringLee Duncan2019-08-151-3/+8
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #143 from cvubrugier/fix-exceptMaurizio Lombardi2019-08-082-3/+3
|\ \ | |/ |/| Fix a syntax error in some except clauses
| * Fix a syntax error in some except clausesChristophe Vu-Brugier2019-08-012-3/+3
|/ | | | | | | "except Exception, e" triggers a syntax error on Python 3.7. The correct syntax is "except Exception as e". This patch fixes issue #142.
* Merge pull request #140 from pkalever/serializeMaurizio Lombardi2019-08-012-47/+42
|\ | | | | targetcli: serialize multiple requests
| * targetcli: serialize multiple requestsPrasanna Kumar Kalever2019-07-312-47/+42
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ------- targetcli/rtslib cannot handle parallel requests at the moment. Read more about this at http://bit.ly/targetcli-parallel-requests-issue $ for i in {1..10}; do \ targetcli /backstores/fileio create ${i} /tmp/file${i} 10M& done Created fileio 1 with size 10485760 This _Backstore already exists in configFS This _Backstore already exists in configFS This _Backstore already exists in configFS This _Backstore already exists in configFS This _Backstore already exists in configFS Created fileio 6 with size 10485760 Created fileio 2 with size 10485760 This _Backstore already exists in configFS Created fileio 8 with size 10485760 Created fileio 9 with size 10485760 bails-out most of the time with above errors and sometimes even crashes. Solution: -------- Serialize/defend the parallel requests by simply taking a wait lock at targetcli level, so that only one request can be processed by targetcli at any given point in time. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* Merge pull request #132 from pkalever/daemonizeMaurizio Lombardi2019-06-176-12/+435
|\ | | | | targetclid: add daemonize component for targetcli
| * targetcli: way to enable targetclid as default choicePrasanna Kumar Kalever2019-06-112-12/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | $ 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>
| * targetclid: enable socket based activationPrasanna Kumar Kalever2019-06-112-0/+11
| | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
| * targetclid: add daemonize component for targetcliPrasanna Kumar Kalever2019-06-114-9/+407
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ------- Overall creation time of a block using targetcli is raising linearly as the block count increase. This is because of the recurring issue involving refresh(reload) at multiple objects/places, as the LIO's configfs is deeply nested. Earlier discussion of the problem statement with stats and graphs about delays: http://bit.ly/targetcli-create-delay Solution: -------- Introduce a daemon component for targetcli[d] which will retain state of Configshell object in memory, so that any new requests can directly use it, instead of loading the storageObjects/targetObjects again. Details about "how to use it ?": ------------------------------- $ systemctl start targetclid $ systemctl status targetclid ● targetclid.service - Targetcli daemon Loaded: loaded (/usr/lib/systemd/system/targetclid.service; disabled; vendor preset: disabled) Active: active (running) since Wed 2019-04-10 12:19:51 IST; 2h 17min ago Main PID: 3950 (targetclid) Tasks: 3 (limit: 4915) CGroup: /system.slice/targetclid.service └─3950 /usr/bin/python /usr/bin/targetclid Apr 10 12:19:51 localhost.localdomain systemd[1]: Started Targetcli daemon. $ targetcli help Usage: /usr/bin/targetcli [--version|--help|CMD|--tcp] --version Print version --help Print this information CMD Run targetcli shell command and exit <nothing> Enter configuration shell --tcp CMD Pass targetcli command to targetclid --tcp <nothing> Enter multi-line command mode for targetclid See man page for more information. One line command usage: ---------------------- $ targetcli --tcp CMD Eg: $ targetcli --tcp pwd / Multiple line commands usage: ---------------------------- $ targetcli --tcp CMD1 CMD2 . . CMDN exit Eg: $ targetcli --tcp ^Tab / backstores/ iscsi/ loopback/ vhost/ xen-pvscsi/ cd clearconfig exit get help ls pwd refresh restoreconfig saveconfig set status pwd get global logfile get global auto_save_on_exit / saveconfig exit output follows: / logfile=/var/log/gluster-block/gluster-block-configshell.log auto_save_on_exit=false Configuration saved to /etc/target/saveconfig.json Stats with and without changes: ------------------------------ Running simple 'pwd' command after creating 1000 blocks on a node: Without this change: $ time targetcli pwd / real 0m8.963s user 0m7.775s sys 0m1.103s with daemonize changes: $ time targetcli --tcp "pwd" / real 0m0.126s user 0m0.099s sys 0m0.024s Thanks to Maurizio for hangingout with me for all the discussions involved. Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | Merge pull request #135 from cvubrugier/fix-tag-completionMaurizio Lombardi2019-05-231-1/+1
|\ \ | |/ |/| Do not remove the first digit when auto-completing the TPG tag
| * Do not remove the first digit when auto-completing the TPG tagChristophe Vu-Brugier2019-05-211-1/+1
|/ | | | | | | | | | 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>
* Merge pull request #129 from tangwenji/remove_semicolonMaurizio Lombardi2019-02-281-1/+1
|\ | | | | Remove the extra semicolon in _save_backups
| * Remove the extra semicolon in _save_backupstang.wenji2019-02-261-1/+1
|/ | | | Signed-off-by: tang.wenji <tang.wenji@zte.com.cn>
* Merge pull request #127 from ddiss/emulate_prMaurizio Lombardi2019-01-291-0/+1
|\ | | | | Add emulate_pr backstore attribute
| * Add emulate_pr backstore attributeDavid Disseldorp2019-01-151-0/+1
| | | | | | | | | | | | | | | | 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>
* | Merge pull request #126 from zealoussnow/wip-190109Maurizio Lombardi2019-01-171-1/+1
|\ \ | | | | | | targetcli-fb: Fix raise exception error in _save_backups
| * | targetcli-fb: Fix raise exception error in _save_backupsLeo Zhang2019-01-091-1/+1
|/ / | | | | | | Signed-off-by: Leo Zhang <nguzcf@gmail.com>
* | Merge pull request #124 from pkalever/compressMaurizio Lombardi2018-12-101-5/+39
|\ \ | | | | | | saveconfig: compress the backup config files
| * | saveconfig: compress the backup config filesPrasanna Kumar Kalever2018-11-281-5/+39
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | version 2.1.fb49v2.1.fb49Maurizio Lombardi2018-09-051-1/+1
| | | | | | | | Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
* | Merge pull request #115 from bgly/masterMaurizio Lombardi2018-09-031-0/+13
|\ \ | | | | | | targetcli-fb: Add support for media change
| * | targetcli-fb: Add support for media changeBryant G. Ly2018-08-311-0/+13
| | | | | | | | | | | | | | | Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com> Signed-off-by: Mike Christie mchristi@redhat.com
* | | Merge pull request #121 from tangwenji/fix_alua_ro_paramsMaurizio Lombardi2018-09-031-1/+1
|\ \ \ | | | | | | | | fix the parameter of define_config_group_param
| * | | fix the parameter of define_config_group_paramtangwenji2018-07-011-1/+1
|/ / / | | | | | | | | | Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
* | | Merge pull request #118 from pkalever/bl_backup_fixMaurizio Lombardi2018-06-121-0/+4
|\ \ \ | | | | | | | | saveconfig: handle backups with block-level delete
| * | | saveconfig: handle backups with block-level deletePrasanna Kumar Kalever2018-06-121-0/+4
|/ / / | | | | | | | | | Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
* | | Merge pull request #117 from pkalever/save_delMaurizio Lombardi2018-06-041-2/+3
|\ \ \ | |/ / |/| | [targetcli] saveconfig: way for block-level save with delete command
| * | saveconfig: way for block-level save with delete commandPrasanna Kumar Kalever2018-06-011-2/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #109 from pkalever/control_strAndy Grover2018-04-301-2/+4
|\ \ | | | | | | create: add a way to set control string
| * | create: add a way to set control stringPrasanna Kumar Kalever2018-04-171-2/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #111 from tangwenji/fix_max_backup_filesAndy Grover2018-04-301-1/+1
|\ \ | |/ |/| fix amount of backup files in backup dir
| * fix amount of backup files in backup dirtangwenji2018-04-121-1/+1
|/ | | | Signed-off-by: tangwenji <tang.wenji@zte.com.cn>
* Merge pull request #104 from pkalever/block_nameAndy Grover2018-04-042-47/+85
|\ | | | | targetcli: support saveconfig per block name
| * config: add saveconfig command to StorageObject levelPrasanna Kumar Kalever2018-03-272-47/+85
|/ | | | | | | | | | | | | | | | $ 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>
* Merge pull request #106 from avagin/homedirAndy Grover2018-03-162-2/+5
|\ | | | | Allow to customize a home directory
| * Allow to customize a home directoryAndrei Vagin2018-03-162-2/+5
| | | | | | | | | | | | | | | | | | In some cases, it looks reasonable to have a separate preference file. For example, we have a set of scripts to configure iscsi targets, and we want to have a separate preference file for these scripts. Signed-off-by: Andrei Vagin <avagin@openvz.org>
* | Merge pull request #105 from tangwenji/fix_default_max_backup_filesAndy Grover2018-03-151-1/+1
|\ \ | |/ |/| Fix default max_backup_files in ui_command_saveconfig