Bug 1571896

Summary: lsmcli [command] --file / --fileas proceeds even with nonexistent file
Product: Red Hat Enterprise Linux 7 Reporter: Jakub Krysl <jkrysl>
Component: libstoragemgmtAssignee: Tony Asleson <tasleson>
Status: CLOSED WONTFIX QA Contact: Jakub Krysl <jkrysl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: tasleson
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-10 17:41:00 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:

Description Jakub Krysl 2018-04-25 15:55:15 UTC
Description of problem:
When using arguments --file or --fileas with value of nonexistent file (let's say "nonexistent"), the command does not do any checking and probably ignores the argument instead. The command succeeds.

# lsmcli -u "sim://" fs-create --pool POOL_ID_00001 --name test --size 1G
ID          | Name | Total Space | Free Space | Pool ID       | System ID
FS_ID_00001 | test | 1073741824  | 1073741824 | POOL_ID_00001 | sim-01
# lsmcli -u "sim://" fs-dependants --fs FS_ID_00001
# lsmcli -u "sim://" fs-dependants --fs FS_ID_00001 --file "nonexistent"
# echo $?

Note: lsmcli fs-snap-restore has the same bahaviour.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. lsmcli -u "sim://" fs-create --pool POOL_ID_00001 --name test --size 1G
2. lsmcli -u "sim://" fs-dependants --fs FS_ID_00001 --file "nonexistent"

Actual results:

Expected results:
lsmcli error: --file "nonexistent" does not exist

Additional info:

Comment 2 Tony Asleson 2018-12-10 17:41:00 UTC
The simulator has limitations, this is one of them.  To support this feature we would need the ability to simulate the FS too and allow some type of interface outside lsmcli to create files etc. so that the sim plugin would have something to check against.