@@ -300,7 +300,7 @@ func Validate(y LimaYAML, warn bool) error {
300300 return fmt .Errorf ("field `dns` must be empty when field `HostResolver.Enabled` is true" )
301301 }
302302
303- if err := validateNetwork (y , warn ); err != nil {
303+ if err := validateNetwork (y ); err != nil {
304304 return err
305305 }
306306 if warn {
@@ -309,7 +309,7 @@ func Validate(y LimaYAML, warn bool) error {
309309 return nil
310310}
311311
312- func validateNetwork (y LimaYAML , warn bool ) error {
312+ func validateNetwork (y LimaYAML ) error {
313313 interfaceName := make (map [string ]int )
314314 for i , nw := range y .Networks {
315315 field := fmt .Sprintf ("networks[%d]" , i )
@@ -334,22 +334,10 @@ func validateNetwork(y LimaYAML, warn bool) error {
334334 if nw .VZNAT != nil && * nw .VZNAT {
335335 return fmt .Errorf ("field `%s.lima` and field `%s.vzNAT` are mutually exclusive" , field , field )
336336 }
337- if nw .VNLDeprecated != "" {
338- return fmt .Errorf ("field `%s.lima` and field `%s.vnl` are mutually exclusive" , field , field )
339- }
340- if nw .SwitchPortDeprecated != 0 {
341- return fmt .Errorf ("field `%s.switchPort` cannot be used with field `%s.lima`" , field , field )
342- }
343337 } else if nw .Socket != "" {
344338 if nw .VZNAT != nil && * nw .VZNAT {
345339 return fmt .Errorf ("field `%s.socket` and field `%s.vzNAT` are mutually exclusive" , field , field )
346340 }
347- if nw .VNLDeprecated != "" {
348- return fmt .Errorf ("field `%s.socket` and field `%s.vnl` are mutually exclusive" , field , field )
349- }
350- if nw .SwitchPortDeprecated != 0 {
351- return fmt .Errorf ("field `%s.switchPort` cannot be used with field `%s.socket`" , field , field )
352- }
353341 if fi , err := os .Stat (nw .Socket ); err != nil && ! errors .Is (err , os .ErrNotExist ) {
354342 return err
355343 } else if err == nil && fi .Mode ()& os .ModeSocket == 0 {
@@ -365,54 +353,8 @@ func validateNetwork(y LimaYAML, warn bool) error {
365353 if nw .Socket != "" {
366354 return fmt .Errorf ("field `%s.vzNAT` and field `%s.socket` are mutually exclusive" , field , field )
367355 }
368- if nw .VNLDeprecated != "" {
369- return fmt .Errorf ("field `%s.vzNAT` and field `%s.vnl` are mutually exclusive" , field , field )
370- }
371- if nw .SwitchPortDeprecated != 0 {
372- return fmt .Errorf ("field `%s.switchPort` cannot be used with field `%s.vzNAT`" , field , field )
373- }
374356 } else {
375- if nw .VNLDeprecated == "" {
376- return fmt .Errorf ("field `%s.lima`, field `%s.socket`, or field `%s.vnl` must be set" , field , field , field )
377- }
378- // The field is called VDE.VNL in anticipation of QEMU upgrading VDE2 to VDEplug4,
379- // but right now the only valid value on macOS is a path to the vde_switch socket directory,
380- // optionally with vde:// prefix.
381- if ! strings .Contains (nw .VNLDeprecated , "://" ) || strings .HasPrefix (nw .VNLDeprecated , "vde://" ) {
382- vdeSwitch := strings .TrimPrefix (nw .VNLDeprecated , "vde://" )
383- if fi , err := os .Stat (vdeSwitch ); err != nil {
384- // negligible when the instance is stopped
385- logrus .WithError (err ).Debugf ("field `%s.vnl` %q failed stat" , field , vdeSwitch )
386- } else {
387- if fi .IsDir () {
388- /* Switch mode (vdeSwitch is dir, port != 65535) */
389- ctlSocket := filepath .Join (vdeSwitch , "ctl" )
390- // ErrNotExist during os.Stat(ctlSocket) can be ignored. ctlSocket does not need to exist until actually starting the VM
391- if fi , err = os .Stat (ctlSocket ); err == nil {
392- if fi .Mode ()& os .ModeSocket == 0 {
393- return fmt .Errorf ("field `%s.vnl` file %q is not a UNIX socket" , field , ctlSocket )
394- }
395- }
396- if nw .SwitchPortDeprecated == 65535 {
397- return fmt .Errorf ("field `%s.vnl` points to a non-PTP switch, so the port number must not be 65535" , field )
398- }
399- } else {
400- /* PTP mode (vdeSwitch is socket, port == 65535) */
401- if fi .Mode ()& os .ModeSocket == 0 {
402- return fmt .Errorf ("field `%s.vnl` %q is not a directory nor a UNIX socket" , field , vdeSwitch )
403- }
404- if nw .SwitchPortDeprecated != 65535 {
405- return fmt .Errorf ("field `%s.vnl` points to a PTP (switchless) socket %q, so the port number has to be 65535 (got %d)" ,
406- field , vdeSwitch , nw .SwitchPortDeprecated )
407- }
408- }
409- }
410- } else if runtime .GOOS != "linux" {
411- if warn {
412- logrus .Warnf ("field `%s.vnl` is unlikely to work for %s (unless libvdeplug4 has been ported to %s and is installed)" ,
413- field , runtime .GOOS , runtime .GOOS )
414- }
415- }
357+ return fmt .Errorf ("field `%s.lima` or field `%s.socket must be set" , field , field )
416358 }
417359 if nw .MACAddress != "" {
418360 hw , err := net .ParseMAC (nw .MACAddress )
0 commit comments