cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

Invalid local primary storage can be created

Open rajujith opened this issue 1 year ago • 4 comments

ISSUE TYPE
  • Bug Report
COMPONENT NAME
UI, API, Local storage,KVM
CLOUDSTACK VERSION
4.19.1
CONFIGURATION

Cloudstack 4.19.1 KVM Rocky8

OS / ENVIRONMENT
SUMMARY

Cloudstack allows adding an invalid local primary storage on KVM. It throws an error that the path is invalid i.e the directory does not exist but the primary storage is added.

STEPS TO REPRODUCE
1. Enable the 'Enable local storage for User Instances' on the zone
2. Add primary storage using UI with scope 'host' and protocol 'filesystem'.
3. Input a path that is not present in the KVM host
4. Add primary storage
EXPECTED RESULTS
The primary storage doesn't get added. 
ACTUAL RESULTS
The primary storage gets added.

rajujith avatar Aug 16 '24 06:08 rajujith

@rajujith , I don't think this is a bug. It is operator responsibility to make sure the path is there and they may plan their order of actions at will. Restricting this seems excessive control to me.

DaanHoogland avatar Aug 16 '24 07:08 DaanHoogland

@DaanHoogland I agree with you that it is the operator's responsiblity. Still, it's good to improve this area and not allow invalid paths in the future and throw an error stating the same.

rajujith avatar Aug 23 '24 08:08 rajujith

ok, I see the point, but am worried that we are over-controlling the backend system. We can implement a check that a file path exists, is a directory and is writable, but no further. A mount may not be performed for instance. and the mount point may not have space. These issues should at least for now be out of scope. Another issue is that on different hypervisortypes the check may need different implementations. What do you think @rajujith ?

DaanHoogland avatar Aug 23 '24 11:08 DaanHoogland

ok, I see the point, but am worried that we are over-controlling the backend system. We can implement a check that a file path exists, is a directory and is writable, but no further. A mount may not be performed for instance. and the mount point may not have space. These issues should at least for now be out of scope. Another issue is that on different hypervisortyoes the check may need different implementations. What do you think @rajujith ?

Agreed.

rajujith avatar Aug 23 '24 12:08 rajujith

this may have been fixed by #10231 by @harikrishna-patnala

@rajujith can you re-test it with 4.19.2.0 or 4.20.1.0-snapshot ? 4.20.0.0 does not have the fix

I tested with 4.20.1.0-snapshot. when I added a local storage with invalid path, I got the exception below Image

weizhouapache avatar Apr 15 '25 10:04 weizhouapache