open-iscsi / rtslib-fb

Python library for configuring the Linux kernel-based multiprotocol SCSI target (LIO)
Apache License 2.0
73 stars 90 forks source link

[rtslib] saveconfig: way for block-level save with delete command #132

Closed pkalever closed 6 years ago

pkalever commented 6 years ago

currently, we can use block-level save feature for create command and reconfig of different attributes, but there is no way to use block-level feature for delete command.

This patch introduces 'save' flag (False on default), which can trigger saveconfig internally as part of delete command.

$ targetcli /backstores/user:glfs delete test save=True Deleted storage object test.

Signed-off-by: Prasanna Kumar Kalever prasanna.kalever@redhat.com

pkalever commented 6 years ago

Depends on: https://github.com/open-iscsi/targetcli-fb/pull/117

pkalever commented 6 years ago

Some Insight about the issue:

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 $ targetcli /backstores/user:glfs/block saveconfig No such path /backstores/user:glfs/block

(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.