Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create: check the StorageObject's existence before creating
This will fix the following issues: 1, When the StorageObject creation failed the iqn will still be created and won't be deleted in case of: When creating BV with the same NAME, the second time it will fail due to the targetcli cache db only allows one [user/$NAME] exist, but will leave the iqn not deleted correctly. That means there will be two different Targets will both mapped to the same StorageObject. 2, For the case above we will also find that after the second creation failing the /etc/target/saveconfig.json will be one StorageObject with the second Target in pairs and exist. In theory, there should be one StorageObject with 2 Targets. This patch will split the creation into 2 phases: CREATE_SO_SRV and CREATE_TG_SRV, since in the targetcli it will build the cache by using the key = [usr/$NAME], so only the StorageObject is successfully created the second phase will make sense. Signed-off-by: Xiubo Li <[email protected]> Reviewed-by: Prasanna Kumar Kalever <[email protected]>
- Loading branch information