File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
scripts/vm/hypervisor/kvm Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 7474 help
7575fi
7676
77- # Ensure mount point exists and is writable
77+ # Validate mount point exists, is (if possible) a mounted filesystem, and is writable
7878if [ ! -d " $MountPoint " ]; then
79- mkdir -p " $MountPoint " 2> /dev/null
80- if [ $? -ne 0 ]; then
81- echo " Failed to create mount point directory: $MountPoint " >&2
79+ echo " Mount point directory does not exist: $MountPoint " >&2
80+ exit 1
81+ fi
82+
83+ # If the 'mountpoint' utility is available, ensure this is an actual mount
84+ if command -v mountpoint > /dev/null 2>&1 ; then
85+ if ! mountpoint -q " $MountPoint " ; then
86+ echo " Mount point is not a mounted filesystem: $MountPoint " >&2
8287 exit 1
8388 fi
8489fi
8590
91+ # Ensure the mount point is writable
92+ if [ ! -w " $MountPoint " ]; then
93+ echo " Mount point is not writable: $MountPoint " >&2
94+ exit 1
95+ fi
8696# delete VMs on this mountpoint (best-effort)
8797deleteVMs () {
8898 local mountPoint=$1
You can’t perform that action at this time.
0 commit comments