Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE, discussions only] refresh on delete backstore #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pkalever
Copy link
Contributor

Problem:

[root@server1 ~]# targetcli                                                                                                                                                                                                          
targetcli shell version 2.1.51
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/>  backstores/fileio create name=disk file_or_dev=/tmp/iscsidisk size=1G
/tmp/iscsidisk exists, using its size (1073741824 bytes) instead
Created fileio disk with size 1073741824
/> iscsi/ create
Created target iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869.
Created TPG 1.
/> iscsi/iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869/tpg1/luns create /backstores/fileio/disk
Created LUN 0.
/> ls
o- / .............................................................. [...]
  o- backstores ................................................... [...]
  | o- block ...................................................... [Storage Objects: 0]
  | o- fileio ..................................................... [Storage Objects: 1]
  | | o- disk ..................................................... [/tmp/iscsidisk (1.0GiB) write-back activated]
  | |   o- alua ................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ..................................... [ALUA state: Active/optimized]
  | o- pscsi ...................................................... [Storage Objects: 0]
  | o- ramdisk .................................................... [Storage Objects: 0]
  | o- user:glfs .................................................. [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869 .. [TPGs: 1]
  |   o- tpg1 ..................................................... [disabled]
  |     o- acls ................................................... [ACLs: 0]
  |     o- luns ................................................... [LUNs: 1]
  |     | o- lun0 ................................................. [fileio/disk (/tmp/iscsidisk) (default_tg_pt_gp)]
  |     o- portals ................................................ [Portals: 0]
  o- loopback ..................................................... [Targets: 0]
  o- vhost ........................................................ [Targets: 0]
  o- xen-pvscsi ................................................... [Targets: 0]
/> backstores/fileio/ delete disk
Deleted storage object disk.
/> ls
This LUN does not exist in configFS
/>

Fix:

Refresh at the end of ui_command_delete()

Credits to:

Fixes: BZ#1571728
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>

Problem:
-------
[root@server1 ~]# targetcli                                                                                                                                                                                                          [11/1366]
targetcli shell version 2.1.51
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/>  backstores/fileio create name=disk file_or_dev=/tmp/iscsidisk size=1G
/tmp/iscsidisk exists, using its size (1073741824 bytes) instead
Created fileio disk with size 1073741824
/> iscsi/ create
Created target iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869.
Created TPG 1.
/> iscsi/iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869/tpg1/luns create /backstores/fileio/disk
Created LUN 0.
/> ls
o- / .............................................................. [...]
  o- backstores ................................................... [...]
  | o- block ...................................................... [Storage Objects: 0]
  | o- fileio ..................................................... [Storage Objects: 1]
  | | o- disk ..................................................... [/tmp/iscsidisk (1.0GiB) write-back activated]
  | |   o- alua ................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ..................................... [ALUA state: Active/optimized]
  | o- pscsi ...................................................... [Storage Objects: 0]
  | o- ramdisk .................................................... [Storage Objects: 0]
  | o- user:glfs .................................................. [Storage Objects: 0]
  o- iscsi ........................................................ [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869 .. [TPGs: 1]
  |   o- tpg1 ..................................................... [disabled]
  |     o- acls ................................................... [ACLs: 0]
  |     o- luns ................................................... [LUNs: 1]
  |     | o- lun0 ................................................. [fileio/disk (/tmp/iscsidisk) (default_tg_pt_gp)]
  |     o- portals ................................................ [Portals: 0]
  o- loopback ..................................................... [Targets: 0]
  o- vhost ........................................................ [Targets: 0]
  o- xen-pvscsi ................................................... [Targets: 0]
/> backstores/fileio/ delete disk
Deleted storage object disk.
/> ls
This LUN does not exist in configFS
/>

Fix:
---
Refresh at the end of ui_command_delete()

Credits to:
* Jing Yan [jiyan@redhat.com] who initially reported this issue.
* Matt Coleman [@iammattcoleman] for bringing attention on this issue.
* Maurizio Lombardi [@maurizio-lombardi] for reproducer.

Fixes: BZ#1571728
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
rn._save_backups(default_save_file)

child.rtsnode.delete(save=save)
self.remove_child(child)
rn.ui_command_refresh()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshing the entire root node works, but it can be a very heavy operation. I'll have a pull request that only refreshes the affected nodes in a couple hours.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Quick!!
I get you, you have a point.
Sure, if you are already working on it, I will wait for the patch then.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iammattcoleman I was also wondering if this is a valid use case of targetcli ?

Generally, the right order is to delete the target first and then delete the backstore.
We anyway have refresh command for targetcli:

[root@server1 ~]# targetcli                                                                                                                                                                                                          [11/1366]
targetcli shell version 2.1.51                                                                                                                                                                                                                
Copyright 2011-2013 by Datera, Inc and others.                                                                                                                                                                                                
For help on commands, type 'help'.                                                                                                                                                                                                            
                                                                                                                                                                                                                                              
/>  backstores/fileio create name=disk file_or_dev=/tmp/iscsidisk size=1G                                                           
/tmp/iscsidisk exists, using its size (1073741824 bytes) instead                                                                                                                                                                              
Created fileio disk with size 1073741824                                                                                                                                                                                                      
/> iscsi/ create                                                                                                                    
Created target iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869.                                                                                                                                                                     
Created TPG 1.                                                                                                                                                                                                                                
/> iscsi/iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869/tpg1/luns create /backstores/fileio/disk                         
Created LUN 0.
/> ls
o- / ...................................................................... [...]
  o- backstores ........................................................... [...]
  | o- block .............................................................. [Storage Objects: 0]
  | o- fileio ............................................................. [Storage Objects: 1]
  | | o- disk ............................................................. [/tmp/iscsidisk (1.0GiB) write-back activated]
  | |   o- alua ........................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ............................................. [ALUA state: Active/optimized]
  | o- pscsi .............................................................. [Storage Objects: 0]
  | o- ramdisk ............................................................ [Storage Objects: 0]
  | o- user:glfs .......................................................... [Storage Objects: 0]
  o- iscsi ................................................................ [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869 .......... [TPGs: 1]
  |   o- tpg1 ............................................................. [disabled]
  |     o- acls ........................................................... [ACLs: 0]
  |     o- luns ........................................................... [LUNs: 1]
  |     | o- lun0 ......................................................... [fileio/disk (/tmp/iscsidisk) (default_tg_pt_gp)]
  |     o- portals ........................................................ [Portals: 0]
  o- loopback ............................................................. [Targets: 0]
  o- vhost ................................................................ [Targets: 0]
  o- xen-pvscsi ........................................................... [Targets: 0]
/> backstores/fileio/ delete disk                                                                                       
Deleted storage object disk.
/> pwd
/
/> get global auto_use_daemon
auto_use_daemon=false 
/> version
targetcli version 2.1.51
/> ls
This LUN does not exist in configFS
/> refresh
/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- block ............................................................. [Storage Objects: 0]
  | o- fileio ............................................................ [Storage Objects: 0]
  | o- pscsi ............................................................. [Storage Objects: 0]
  | o- ramdisk ........................................................... [Storage Objects: 0]
  | o- user:glfs ......................................................... [Storage Objects: 0]
  o- iscsi ............................................................... [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.server1.x8664:sn.5679adc37869 ......... [TPGs: 1]
  |   o- tpg1 ............................................................ [disabled]
  |     o- acls .......................................................... [ACLs: 0]
  |     o- luns .......................................................... [LUNs: 0]
  |     o- portals ....................................................... [Portals: 0]
  o- loopback ............................................................ [Targets: 0]
  o- vhost ............................................................... [Targets: 0]
  o- xen-pvscsi .......................................................... [Targets: 0]
/> 

@iammattcoleman @maurizio-lombardi thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iammattcoleman as you rightly pointed, refresh incurs delay, and having this on every delete might not be an acceptable solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you manually perform these operations directly in ConfigFS, the kernel removes the LUNs from targets that referenced the backstore. Since it's doing that automatically, I think targetcli should automatically refresh the data for the affected nodes. That way, its behavior is consistent with the kernel's.

@pkalever
Copy link
Contributor Author

@iammattcoleman excuse me if it feels like jumping the gun, our team is waiting on the new release having the taretclid fixes since a week now, but @maurizio-lombardi seems to be waiting for this one fix.

@pkalever pkalever changed the title refresh on delete backstore [DO NOT MERGE, discussions only] refresh on delete backstore Apr 17, 2020
@iammattcoleman
Copy link
Contributor

@pkalever I've opened a new pull request that minimizes the nodes being refreshed but will fall back to refreshing the root node if any errors occur: #171

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants