Bug 957041
| Summary: | targetcli does not restore configuration after reboot. | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Bruno Goncalves <bgoncalv> |
| Component: | targetcli | Assignee: | Andy Grover <agrover> |
| Status: | CLOSED NOTABUG | QA Contact: | Bruno Goncalves <bgoncalv> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.0 | CC: | max_allan, murahman, prabhat.rishi, socketpair |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-04-26 15:28:10 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Bruno Goncalves
2013-04-26 08:46:03 UTC
is there configuration info in /etc/target/saveconfig.json? Is targetcli service set to run on boot? Correct, configuring the process to start on boot solves the problem. chkconfig targetcli on systemctl list-unit-files | grep targetcli targetcli.service enabled The solution to restore from back is as follows: Select the backup file and then execute the following command Backup file selected: saveconfig-20160401-04\:52\:04.json [root@server0 ~]# /usr/bin/targetctl restore saveconfig-20160401-04\:52\:04.json [root@server0 ~]# targetcli targetcli shell version 2.1.fb34 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'. /> ls o- / ......................................................................................................................... [...] o- backstores .............................................................................................................. [...] | o- block .................................................................................................. [Storage Objects: 1] | | o- iscsi_block ..................................................... [/dev/iscsi_vg/iscsi_block (1.0GiB) write-thru activated] | o- fileio ................................................................................................. [Storage Objects: 0] | o- pscsi .................................................................................................. [Storage Objects: 0] | o- ramdisk ................................................................................................ [Storage Objects: 0] o- iscsi ............................................................................................................ [Targets: 1] | o- iqn.2014-08.com.example.network0:system1 .......................................................................... [TPGs: 1] | o- tpg1 ............................................................................................... [no-gen-acls, no-auth] | o- acls .......................................................................................................... [ACLs: 1] | | o- iqn.2014-08.com.example.network0:system3 ............................................................. [Mapped LUNs: 1] | | o- mapped_lun0 ........................................................................... [lun0 block/iscsi_block (rw)] | o- luns .......................................................................................................... [LUNs: 1] | | o- lun0 .................................................................. [block/iscsi_block (/dev/iscsi_vg/iscsi_block)] | o- portals .................................................................................................... [Portals: 1] | o- 172.25.0.11:3260 ................................................................................................. [OK] o- loopback ......................................................................................................... [Targets: 0] /> exit Global pref auto_save_on_exit=true Last 10 configs saved in /etc/target/backup. Configuration saved to /etc/target/saveconfig.json [root@server0 ~]# This restoration worked even after rebooting the server [root@server0 ~]# reboot [root@server0 ~]# targetcli targetcli shell version 2.1.fb34 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'. /> ls o- / ......................................................................................................................... [...] o- backstores .............................................................................................................. [...] | o- block .................................................................................................. [Storage Objects: 1] | | o- iscsi_block ..................................................... [/dev/iscsi_vg/iscsi_block (1.0GiB) write-thru activated] | o- fileio ................................................................................................. [Storage Objects: 0] | o- pscsi .................................................................................................. [Storage Objects: 0] | o- ramdisk ................................................................................................ [Storage Objects: 0] o- iscsi ............................................................................................................ [Targets: 1] | o- iqn.2014-08.com.example.network0:system1 .......................................................................... [TPGs: 1] | o- tpg1 ............................................................................................... [no-gen-acls, no-auth] | o- acls .......................................................................................................... [ACLs: 1] | | o- iqn.2014-08.com.example.network0:system3 ............................................................. [Mapped LUNs: 1] | | o- mapped_lun0 ........................................................................... [lun0 block/iscsi_block (rw)] | o- luns .......................................................................................................... [LUNs: 1] | | o- lun0 .................................................................. [block/iscsi_block (/dev/iscsi_vg/iscsi_block)] | o- portals .................................................................................................... [Portals: 1] | o- 172.25.0.11:3260 ................................................................................................. [OK] o- loopback ......................................................................................................... [Targets: 0] /> (In reply to Bruno Goncalves from comment #2) > Correct, configuring the process to start on boot solves the problem. > > chkconfig targetcli on > > systemctl list-unit-files | grep targetcli > targetcli.service enabled I can't see any such service: [root@server0 ~]# systemctl enable targetcli Failed to issue method call: No such file or directory [root@server0 ~]# [root@server0 ~]# systemctl list-unit-files | grep targetcli [root@server0 ~]# However, iscsi and target as service is available: [root@server0 ~]# systemctl list-unit-files | grep iscsi iscsi.service enabled iscsid.service disabled iscsiuio.service disabled iscsid.socket enabled iscsiuio.socket enabled [root@server0 ~]# [root@server0 ~]# systemctl list-unit-files | grep target target.service enabled Exactly the same problem targetcli service has been renamed to target. # chkconfig target on Note: Forwarding request to 'systemctl enable target.service'. Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service. What excuse do you have for this not being a bug?? Wiping out good config because the service is not enabled is surely the very definition of a bug? the man page states : Other Commands saveconfig Save the current configuration settings to a file, from which settings will be restored if the system is rebooted. By default, this will save the configuration to /etc/target/saveconfig.json. Nothing about "except if the service is disabled, in which case the disabled service will wipe your config" My problem WAS:
--------------------------------------------------------------
/> saveconfig
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/python2.7/site-packages/configshell_fb/shell.py", line 905, in run_interactive
self._cli_loop()
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 734, in _cli_loop
self.run_cmdline(cmdline)
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 848, in run_cmdline
self._execute_command(path, command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 823, in _execute_command
result = target.execute_command(command, pparams, kparams)
File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 1406, in execute_command
return method(*pparams, **kparams)
File "/usr/lib/python2.7/site-packages/targetcli/ui_root.py", line 138, in ui_command_saveconfig
self.rtsroot.save_to_file(savefile)
File "/usr/lib/python2.7/site-packages/rtslib_fb/root.py", line 388, in save_to_file
saveconf = self.dump()
File "/usr/lib/python2.7/site-packages/rtslib_fb/root.py", line 272, in dump
d['storage_objects'] = [so.dump() for so in self.storage_objects]
File "/usr/lib/python2.7/site-packages/rtslib_fb/tcm.py", line 797, in dump
d = super(BlockStorageObject, self).dump()
File "/usr/lib/python2.7/site-packages/rtslib_fb/tcm.py", line 317, in dump
d['alua_tpgs'] = [tpg.dump() for tpg in self.alua_tpgs]
File "/usr/lib/python2.7/site-packages/rtslib_fb/alua.py", line 309, in dump
d[param] = getattr(self, param, None)
File "/usr/lib/python2.7/site-packages/rtslib_fb/alua.py", line 126, in _get_alua_access_type
return alua_types.index(alua_type)
ValueError: 'Implict and Explict' is not in list
-----------------------------------------
Issue Fixed by running:
[root@iscsi-server ~]# systemctl start target
[root@iscsi-server ~]# systemctl enable target
Created symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.
[root@iscsi-server ~]# targetcli version
targetcli version 2.1.fb49
So just start and enable the service target
|