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

Refresh TPGs after deleting a backstore #161

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions targetcli/ui_backstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,20 @@ def ui_command_delete(self, name, save=None):
rn = self.get_root()
rn._save_backups(default_save_file)

iscsi_config_node = self.get_root().get_child('iscsi')
tpg_config_nodes = set()
for lun in child.rtsnode.attached_luns:
tpg_config_nodes.add(iscsi_config_node
.get_child(lun.parent_tpg.parent_target.wwn)
.get_child('tpg' + str(lun.parent_tpg.tag)))

child.rtsnode.delete(save=save)
self.remove_child(child)

for tpg_config_node in tpg_config_nodes:
# Refresh TPG data to prevent 'This LUN does not exist in configFS'
tpg_config_node.refresh()

self.shell.log.info("Deleted storage object %s." % name)

def ui_complete_delete(self, parameters, text, current_param):
Expand Down