Skip to content

Commit

Permalink
Add a network namespace parameter to the CreateVM request
Browse files Browse the repository at this point in the history
The current network namespace parameter nested in the JailerConfig
parameter requires specifying the entire jailer configuration, which is not
convenient and doesn't allow using the noop jailer with a network
namespace.

To overcome this limitation, add a new NetNS parameter to the CreateVM
request.

See also a similar change in firecracker-microvm/firecracker-go-sdk#155.

Signed-off-by: Georgiy Lebedev <lebedev.gk@phystech.edu>
  • Loading branch information
CuriousGeorgiy committed Sep 8, 2023
1 parent 2a60b1c commit 57ac852
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 62 deletions.
134 changes: 72 additions & 62 deletions proto/firecracker.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions proto/firecracker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ message CreateVMRequest {
string MetricsFifoPath = 13;

FirecrackerBalloonDevice BalloonDevice = 14;

// The network namespace of the VM.
string NetNS = 15;
}

message CreateVMResponse {
Expand Down
2 changes: 2 additions & 0 deletions runtime/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,8 @@ func (s *service) buildVMConfiguration(req *proto.CreateVMRequest) (*firecracker

if req.JailerConfig != nil {
cfg.NetNS = req.JailerConfig.NetNS
} else {
cfg.NetNS = req.NetNS
}

s.logger.Debugf("using socket path: %s", cfg.SocketPath)
Expand Down

0 comments on commit 57ac852

Please sign in to comment.