Bug 1585153

Summary: [rtslib] saveconfig: way to block-level save with delete command
Product: Red Hat Enterprise Linux 7 Reporter: Prasanna Kumar Kalever <prasanna.kalever>
Component: python-rtslibAssignee: Maurizio Lombardi <mlombard>
Status: CLOSED ERRATA QA Contact: Martin Hoyer <mhoyer>
Severity: urgent Docs Contact:
Priority: high    
Version: 7.5CC: cww, mchristi, mhoyer, mlombard, prasanna.kalever, rcyriac, rhandlin, salmy, tdosek
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-rtslib-2.1.fb63-12.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1586227 (view as bug list) Environment:
Last Closed: 2018-10-30 07:44:07 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, 1585204, 1586227    

Description Prasanna Kumar Kalever 2018-06-01 11:26:43 UTC
Description of problem:

With the recent block-level saveconfig fix,


Create:
---------

# targetcli /backstores/user:glfs/block create ...
# targetcli /backstores/user:glfs/block saveconfig

This works.


Modify:
--------

# targetcli /backstores/user:glfs/block set dev_size=NEW
# targetcli /backstores/user:glfs/block saveconfig

This also works.


Delete:
--------

# targetcli /backstores/user:glfs/block delete
[root@localhost ~]# targetcli /backstores/user:glfs/block delete
No such path /backstores/user:glfs/blockX


(Obviously!!) This doesn't work with delete :-( 



Currently, We cannot call 'targetcli / saveconfig'  because it will override the unloaded configuration in saveconfig.json with current set of loaded config objects.

And if we just delete and do not have a way to remove the relevant config objects from saveconfig.json, then restart of the target.service will pick them again.



Patchs fixing the issue:
https://github.com/open-iscsi/targetcli-fb/pull/117
https://github.com/open-iscsi/rtslib-fb/pull/132

Comment 10 Martin Hoyer 2018-06-11 15:30:05 UTC
Hi Prasanna,
I'm unable to reproduce this issue. Am I doing something wrong?
Please note you have incorrect syntax in Description:
> # targetcli /backstores/user:glfs/block delete
should be
# targetcli /backstores/user:glfs/ delete block

My testing:
# rpm -qa |grep -e targetcli -e rtslib
targetcli-2.1.fb46-4.el7.noarch
python-rtslib-2.1.fb63-11.el7.noarch

# targetcli /backstores/user:glfs ls
o- user:glfs .............................................. [Storage Objects: 1]
  o- sample . [test-volume.eng.brq.redhat.com/block-store/7c102d46-8f79-40df-a26d-0addb29d7415 (10.0MiB) activated]
    o- alua ................................................... [ALUA Groups: 1]
      o- default_tg_pt_gp ....................... [ALUA state: Active/optimized]
# targetcli /backstores/user:glfs/ delete sample
Deleted storage object sample.
# targetcli /backstores/user:glfs ls
o- user:glfs ...............................................[Storage Objects: 0]
# rpm -qa |grep -e targetcli -e rtslib
targetcli-2.1.fb46-4.el7.noarch
python-rtslib-2.1.fb63-11.el7.noarch
# targetcli saveconfig
Configuration saved to /etc/target/saveconfig.json
# cat /etc/target/saveconfig.json 
{
  "fabric_modules": [], 
  "storage_objects": [],

Comment 20 Martin Hoyer 2018-07-10 07:51:49 UTC
Tested with: 
 - kernel-3.10.0-915.el7
 - targetcli-2.1.fb46-6.el7
 - python-configshell-1.1.fb23-4.el7
 - python-rtslib-2.1.fb63-12.el7
The issue is no longer reproducible; No regression found.

Comment 22 errata-xmlrpc 2018-10-30 07:44:07 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/RHEA-2018:3019