Skip to content

feat: virtio-net - part 1: add network backend selection#126

Merged
BinSquare merged 4 commits intosmol-machines:mainfrom
phooq:virtio-net-impl-part-1
Apr 14, 2026
Merged

feat: virtio-net - part 1: add network backend selection#126
BinSquare merged 4 commits intosmol-machines:mainfrom
phooq:virtio-net-impl-part-1

Conversation

@phooq
Copy link
Copy Markdown
Contributor

@phooq phooq commented Apr 14, 2026

add an new cli arg --net-backend to allow choosing between virtio-net and tsi. default is tsi

Testing

[PASS] Exec CLI --workdir overrides Smolfile

==========================================
  Smolfile Tests Summary
==========================================

Tests run:    48
Tests passed: 48
Tests failed: 0

All tests passed!
Machine 'default' is not running (state: stopped)
Cleaning up data directory for vm: default
Deleted machine: default

==========================================
  Overall Summary
==========================================

Test suites run:    5
Test suites passed: 5
Test suites failed: 0

All test suites passed!

}

/// User-facing explanation when an explicit virtio-net request must be rejected.
pub const fn unsupported_message(self) -> &'static str {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fallback logic is temporary. we are able to have feature parity between Tsi and virtio-net, as shown in the poc: #91 (comment)

@BinSquare

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also get in a relevant end to end tests as part of this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofc. new commit on the way

Copy link
Copy Markdown
Contributor Author

@phooq phooq Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. add a new suite test_virtio_net.sh

CLI experience is like the following:

smolvm machine create myvirtio-net-vm --net --net-backend virtio --allow-cidr 1.1.1.1/32
Error: config operation failed: --net-backend: allow-cidr/allow-host policies are not supported by the current virtio-net implementation

Testing

==========================================
  smolvm Virtio-Net Tests
==========================================

[TEST] Machine create: virtio rejected until implemented
Stopping machine 'default'...
Machine 'default' stopped
[PASS] Machine create: virtio rejected until implemented
[TEST] Machine run: virtio rejected until implemented
Stopping machine 'default'...
Machine 'default' stopped
[PASS] Machine run: virtio rejected until implemented
[TEST] Machine create: virtio + published ports rejected
Stopping machine 'default'...
Machine 'default' stopped
[PASS] Machine create: virtio + published ports rejected
[TEST] Machine create: virtio + policy rejected
Stopping machine 'default'...
Machine 'default' stopped
[PASS] Machine create: virtio + policy rejected
[TEST] Pack run: virtio rejected until implemented
[PASS] Pack run: virtio rejected until implemented

==========================================
  Virtio-Net Tests Summary
==========================================

Tests run:    5
Tests passed: 5
Tests failed: 0

All tests passed!

@BinSquare

@phooq phooq marked this pull request as ready for review April 14, 2026 16:22
}
}

run_test "Machine create: virtio rejected until implemented" test_machine_create_virtio_rejected_until_implemented || true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit: we should let these fail since they're not implemented yet as a way to keep track of it.

but not a blocker

@BinSquare BinSquare merged commit 2d491c9 into smol-machines:main Apr 14, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in smol machines Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants