Try "tart ip --resolver=agent" first when using "--net-bridged" (#323)

This commit is contained in:
Nikolay Edigaryev 2025-06-19 15:36:56 +02:00 committed by GitHub
parent 1ca0fced67
commit 7957a9b95a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -360,6 +360,16 @@ func (vm *VM) run(ctx context.Context) error {
}
func (vm *VM) IP(ctx context.Context) (string, error) {
// Bridged networking is problematic, so try with
// the agent resolver first using a small timeout
if vm.Resource.NetBridged != "" {
stdout, _, err := tart.Tart(ctx, vm.logger, "ip", "--wait", "5",
"--resolver", "agent", vm.id())
if err == nil {
return strings.TrimSpace(stdout), nil
}
}
args := []string{"ip", "--wait", "60"}
if vm.Resource.NetBridged != "" {