Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1537998

Summary: targetcli: Need improvements in configuration backup
Product: Red Hat Enterprise Linux 7 Reporter: Prasanna Kumar Kalever <prasanna.kalever>
Component: targetcliAssignee: Maurizio Lombardi <mlombard>
Status: CLOSED ERRATA QA Contact: Martin Hoyer <mhoyer>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.4CC: amukherj, coughlan, mchristi, mhoyer, mlombard, pkarampu, prasanna.kalever, rcyriac, rhandlin, vanhoof, vbellur
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
* Previously, the targetcli utility did not create the /etc/target/ and /etc/target/backup/ directories if they were missing. As a consequence, if the user deleted the directories, the "targetcli saveconfig" command failed. With this update, targetcli recreates the directories if they are missing. As a result, the described problem no longer occurs. * With this update, the "targetcli saveconfig" command backs up the /etc/target/saveconfig.json file only if it is different from the most recent copy. This avoids creating duplicate backups. * With this update, the targetcli utility now provides the backup_files_limit global configuration option, which limits the maximum number of backup files.
Story Points: ---
Clone Of:
: 1571316 (view as bug list) Environment:
Last Closed: 2018-10-30 07:55:01 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:
Bug Depends On:    
Bug Blocks: 1554642, 1571316    

Description Prasanna Kumar Kalever 2018-01-24 09:34:52 UTC
Description of problem:

Need few improvements in the targetcli configuration backup path:

* Currently targetcli binary 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, targetcli fails to backup the configs while returning savconfig successful.

* On targetcli / saveconfig, backup only if /etc/target/saveconfig.json is different from recent copy i.e. /etc/target/backup/saveconfig-${latest-stamp}.json, else we endup copying tons of duplicates.

* Provide a global option to tune max no. of backup conf files


Below PR's address the improvements mentioned above, request to back port:
https://github.com/open-iscsi/targetcli-fb/pull/98
https://github.com/open-iscsi/targetcli-fb/pull/99

Comment 10 Martin Hoyer 2018-04-27 08:09:54 UTC
After restoring the configuration and exiting targetcli, new backup json is created, it is however basically empty:

# targetcli
/> restoreconfig /etc/target/backup/saveconfig-20180427-10:02:10.json
/> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup/.
Configuration saved to /etc/target/saveconfig.json

# ls /etc/target/backup/
saveconfig-20180427-10:02:10.json  saveconfig-20180427-10:02:52.json

# cat /etc/target/backup/saveconfig-20180427-10\:02\:52.json 
{
  "fabric_modules": [], 
  "storage_objects": [], 
  "targets": []
}

Comment 11 Prasanna Kumar Kalever 2018-04-27 18:28:21 UTC
Hi Martin,

I doubt if I got your question right.

Are you saying that you had a valid backup configuration /etc/target/backup/saveconfig-20180427-10:02:10.json and after restoring it you see the new backup file (/etc/target/backup/saveconfig-20180427-10\:02\:52.json) empty ?

If I understand your question correctly, the backupfile is just a copy of saveconfig.json, as saveconfig command will override /etc/target/saveconfig.json, we just backup it.

In your case before restoreconfig command your /etc/target/saveconfig.json might be empty, hence its copy /etc/target/backup/saveconfig-20180427-10\:02\:52.json  is empty now.


HTH,
Thanks!

Comment 12 Martin Hoyer 2018-04-30 11:42:43 UTC
(In reply to Prasanna Kumar Kalever from comment #11)
Hi Prasanna,
thanks for the reply! It is how you wrote it, the backup of empty saveconfig.json confused me. Thanks for clarification.

Our regression tests have not found any new issues with targetcli-fb-2.1.fb46, neither did manual testing, with exception of non-blocking issue described in https://github.com/open-iscsi/targetcli-fb/pull/111

Comment 15 errata-xmlrpc 2018-10-30 07:55:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3040