@@ -152,14 +152,6 @@ func Validate(y *LimaYAML, warn bool) error {
152
152
if err != nil {
153
153
return fmt .Errorf ("field `mounts[%d].location` refers to an unexpandable path: %q: %w" , i , f .Location , err )
154
154
}
155
- switch loc {
156
- case "/" , "/bin" , "/dev" , "/etc" , "/home" , "/opt" , "/sbin" , "/tmp" , "/usr" , "/var" :
157
- return fmt .Errorf ("field `mounts[%d].location` must not be a system path such as /etc or /usr" , i )
158
- // home directory defined in "cidata.iso:/user-data"
159
- case * y .User .Home :
160
- return fmt .Errorf ("field `mounts[%d].location` is the reserved internal home directory" , i )
161
- }
162
-
163
155
st , err := os .Stat (loc )
164
156
if err != nil {
165
157
if ! errors .Is (err , os .ErrNotExist ) {
@@ -169,6 +161,14 @@ func Validate(y *LimaYAML, warn bool) error {
169
161
return fmt .Errorf ("field `mounts[%d].location` refers to a non-directory path: %q: %w" , i , f .Location , err )
170
162
}
171
163
164
+ switch * f .MountPoint {
165
+ case "/" , "/bin" , "/dev" , "/etc" , "/home" , "/opt" , "/sbin" , "/tmp" , "/usr" , "/var" :
166
+ return fmt .Errorf ("field `mounts[%d].mountPoint` must not be a system path such as /etc or /usr" , i )
167
+ // home directory defined in "cidata.iso:/user-data"
168
+ case * y .User .Home :
169
+ return fmt .Errorf ("field `mounts[%d].mountPoint` is the reserved internal home directory %q" , i , * y .User .Home )
170
+ }
171
+
172
172
if _ , err := units .RAMInBytes (* f .NineP .Msize ); err != nil {
173
173
return fmt .Errorf ("field `msize` has an invalid value: %w" , err )
174
174
}
0 commit comments