Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
This repository was archived by the owner on May 12, 2021. It is now read-only.

Network namespace not available at hypervisor.createSandbox time #1664

@mcastelino

Description

@mcastelino

Description of problem

When the hypervisor createSandbox is called the network namespace is not properly populated.
virtcontainers/sandbox.go->createSandbox()->newSandbox()->s.hypervisor.createSandbox(ctx, s.id, s.networkNS, &sandboxConfig.HypervisorConfig, s.store)

At this point the network namespace is not populated. This leads to issues when running firecracker with jailer as the jailer needs a valid network namespace to move the firecracker process into the appropriate network namespace.

// createSandbox creates a sandbox from a sandbox description, the containers list, the hypervisor
// and the agent passed through the Config structure.
// It will create and store the sandbox structure, and then ask the hypervisor
// to physically create that sandbox i.e. starts a VM for that sandbox to eventually
// be started.
func createSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factory) (*Sandbox, error) {
        span, ctx := trace(ctx, "createSandbox")
        defer span.Finish()

        if err := createAssets(ctx, &sandboxConfig); err != nil {
                return nil, err
        }

        s, err := newSandbox(ctx, sandboxConfig, factory)
        if err != nil {
                return nil, err
        }

        if len(s.config.Experimental) != 0 {
                s.Logger().WithField("features", s.config.Experimental).Infof("Enable experimental features")
        }

        // Fetch sandbox network to be able to access it from the sandbox structure.
        var networkNS NetworkNamespace
        if err := s.store.Load(store.Network, &networkNS); err == nil {
                s.networkNS = networkNS
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions