@@ -466,22 +466,66 @@ func validateNetwork(y *limatype.LimaYAML) error {
466466 if nw .VZNAT != nil && * nw .VZNAT {
467467 errs = errors .Join (errs , fmt .Errorf ("field `%s.lima` and field `%s.vzNAT` are mutually exclusive" , field , field ))
468468 }
469+ if nw .VZShared != nil && * nw .VZShared {
470+ errs = errors .Join (errs , fmt .Errorf ("field `%s.lima` and field `%s.vzShared` are mutually exclusive" , field , field ))
471+ }
472+ if nw .VZHost != nil && * nw .VZHost {
473+ errs = errors .Join (errs , fmt .Errorf ("field `%s.lima` and field `%s.vzHost` are mutually exclusive" , field , field ))
474+ }
469475 case nw .Socket != "" :
470476 if nw .VZNAT != nil && * nw .VZNAT {
471477 errs = errors .Join (errs , fmt .Errorf ("field `%s.socket` and field `%s.vzNAT` are mutually exclusive" , field , field ))
472478 }
479+ if nw .VZShared != nil && * nw .VZShared {
480+ errs = errors .Join (errs , fmt .Errorf ("field `%s.socket` and field `%s.vzShared` are mutually exclusive" , field , field ))
481+ }
482+ if nw .VZHost != nil && * nw .VZHost {
483+ errs = errors .Join (errs , fmt .Errorf ("field `%s.socket` and field `%s.vzHost` are mutually exclusive" , field , field ))
484+ }
473485 if fi , err := os .Stat (nw .Socket ); err != nil && ! errors .Is (err , os .ErrNotExist ) {
474486 errs = errors .Join (errs , err )
475487 } else if err == nil && fi .Mode ()& os .ModeSocket == 0 {
476488 errs = errors .Join (errs , fmt .Errorf ("field `%s.socket` %q points to a non-socket file" , field , nw .Socket ))
477489 }
478490 case nw .VZNAT != nil && * nw .VZNAT :
491+ if nw .VZShared != nil && * nw .VZShared {
492+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzNAT` and field `%s.vzShared` are mutually exclusive" , field , field ))
493+ }
494+ if nw .VZHost != nil && * nw .VZHost {
495+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzNAT` and field `%s.vzHost` are mutually exclusive" , field , field ))
496+ }
479497 if nw .Lima != "" {
480498 errs = errors .Join (errs , fmt .Errorf ("field `%s.vzNAT` and field `%s.lima` are mutually exclusive" , field , field ))
481499 }
482500 if nw .Socket != "" {
483501 errs = errors .Join (errs , fmt .Errorf ("field `%s.vzNAT` and field `%s.socket` are mutually exclusive" , field , field ))
484502 }
503+ case nw .VZShared != nil && * nw .VZShared :
504+ if nw .VZNAT != nil && * nw .VZNAT {
505+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzShared` and field `%s.vzNAT` are mutually exclusive" , field , field ))
506+ }
507+ if nw .VZHost != nil && * nw .VZHost {
508+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzShared` and field `%s.vzHost` are mutually exclusive" , field , field ))
509+ }
510+ if nw .Lima != "" {
511+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzShared` and field `%s.lima` are mutually exclusive" , field , field ))
512+ }
513+ if nw .Socket != "" {
514+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzShared` and field `%s.socket` are mutually exclusive" , field , field ))
515+ }
516+ case nw .VZHost != nil && * nw .VZHost :
517+ if nw .VZNAT != nil && * nw .VZNAT {
518+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzHost` and field `%s.vzNAT` are mutually exclusive" , field , field ))
519+ }
520+ if nw .VZShared != nil && * nw .VZShared {
521+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzHost` and field `%s.vzShared` are mutually exclusive" , field , field ))
522+ }
523+ if nw .Lima != "" {
524+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzHost` and field `%s.lima` are mutually exclusive" , field , field ))
525+ }
526+ if nw .Socket != "" {
527+ errs = errors .Join (errs , fmt .Errorf ("field `%s.vzHost` and field `%s.socket` are mutually exclusive" , field , field ))
528+ }
485529 default :
486530 errs = errors .Join (errs , fmt .Errorf ("field `%s.lima` or field `%s.socket must be set" , field , field ))
487531 }
0 commit comments