Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func writeRuntimeConfig(options ...func(*config.Config)) error {
return nil
}

var testNameToVMIDReplacer = strings.NewReplacer("/", "_")
var testNameToVMIDReplacer = strings.NewReplacer("/", "-", "_", "-")

func testNameToVMID(s string) string {
return testNameToVMIDReplacer.Replace(s)
Expand Down
3 changes: 2 additions & 1 deletion runtime/noop_jailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func newNoopJailer(ctx context.Context, logger *logrus.Entry, shimDir vm.Dir) *n
}
}

func (j *noopJailer) BuildJailedMachine(cfg *config.Config, machineConfig *firecracker.Config, vmID string) ([]firecracker.Opt, error) {
func (j *noopJailer) BuildJailedMachine(cfg *config.Config, _ *firecracker.Config, vmID string) ([]firecracker.Opt, error) {
if len(cfg.FirecrackerBinaryPath) == 0 {
return []firecracker.Opt{}, nil
}
Expand All @@ -57,6 +57,7 @@ func (j *noopJailer) BuildJailedMachine(cfg *config.Config, machineConfig *firec
cmd := firecracker.VMCommandBuilder{}.
WithBin(cfg.FirecrackerBinaryPath).
WithSocketPath(relSocketPath).
WithArgs([]string{"--id", vmID}).
Build(j.ctx)

if cfg.DebugHelper.LogFirecrackerOutput() {
Expand Down
1 change: 1 addition & 0 deletions runtime/runc_jailer.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ func (j *runcJailer) setDefaultConfigValues(cfg *config.Config, socketPath strin
cmd := firecracker.VMCommandBuilder{}.
WithBin("/" + firecrackerFileName).
WithSocketPath(socketPath).
WithArgs([]string{"--id", j.vmID}).
// Don't need to pass in an actual context here as we are only building
// the command arguments and not actually building a command
Build(context.Background())
Expand Down
11 changes: 6 additions & 5 deletions runtime/service_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,14 @@ func TestLongUnixSocketPath_Isolated(t *testing.T) {
// Verify that if the absolute path of the Firecracker unix sockets are longer
// than the max length enforced by the kernel (UNIX_PATH_MAX, usually 108), we
// don't fail (due to the internal implementation using relative paths).
// We do this by using the max VMID len (76 chars), which in combination with the
// We do this by using the max VMID len (64 chars), which in combination with the
// default location we store state results in a path like
// "/run/firecracker-containerd/default/<vmID>" (with len 112).
// "/run/firecracker-containerd/<namespace>/<vmID>" (with len 112).
const maxUnixSockLen = 108
vmID := strings.Repeat("x", 76)
namespace := strings.Repeat("n", 20)
vmID := strings.Repeat("v", 64)

ctx := namespaces.WithNamespace(context.Background(), "default")
ctx := namespaces.WithNamespace(context.Background(), namespace)

pluginClient, err := ttrpcutil.NewClient(containerdSockPath + ".ttrpc")
require.NoError(t, err, "failed to create ttrpc client")
Expand Down Expand Up @@ -624,7 +625,7 @@ func TestLongUnixSocketPath_Isolated(t *testing.T) {

// double-check that the sockets are at the expected path and that their absolute
// length exceeds 108 bytes
shimDir, err := vm.ShimDir(cfg.ShimBaseDir, "default", vmID)
shimDir, err := vm.ShimDir(cfg.ShimBaseDir, namespace, vmID)
require.NoError(t, err, "failed to get shim dir")

if request.JailerConfig == nil {
Expand Down