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

Commit

Permalink
FC: Change default API socket path
Browse files Browse the repository at this point in the history
Firecracker has changed default API socket path to `/run/firecracker.socket`.
This path also applies when running with the jailer.
Related PR: firecracker-microvm/firecracker#1500
kata is letting jailer automatically create API socket, so we need to
change api socket path from `/api.socket` to `/run/firecracker.socket` accordingly.

Fixes: #2504

Signed-off-by: Penny Zheng <[email protected]>
  • Loading branch information
Pennyzct committed Mar 23, 2020
1 parent 2945bcd commit c3bafd5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions virtcontainers/fc.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const (
const (
//fcTimeout is the maximum amount of time in seconds to wait for the VMM to respond
fcTimeout = 10
fcSocket = "api.socket"
fcSocket = "firecracker.socket"
//Name of the files within jailer root
//Having predefined names helps with cleanup
fcKernel = "vmlinux"
Expand Down Expand Up @@ -210,7 +210,10 @@ func (fc *firecracker) createSandbox(ctx context.Context, id string, networkNS N

fc.vmPath = filepath.Join(fc.chrootBaseDir, hypervisorName, fc.id)
fc.jailerRoot = filepath.Join(fc.vmPath, "root") // auto created by jailer
fc.socketPath = filepath.Join(fc.jailerRoot, fcSocket)

// Firecracker and jailer automatically creates default API socket under /run
// with the name of "firecracker.socket"
fc.socketPath = filepath.Join(fc.jailerRoot, "run", fcSocket)

// So we need to repopulate this at startSandbox where it is valid
fc.netNSPath = networkNS.NetNsPath
Expand Down Expand Up @@ -649,7 +652,9 @@ func (fc *firecracker) fcListenToFifo(fifoName string) (string, error) {
}

func (fc *firecracker) fcInitConfiguration() error {
err := os.MkdirAll(fc.jailerRoot, DirMode)
// Firecracker API socket(firecracker.socket) is automatically created
// under /run dir.
err := os.MkdirAll(filepath.Join(fc.jailerRoot, "run"), DirMode)
if err != nil {
return err
}
Expand All @@ -664,7 +669,7 @@ func (fc *firecracker) fcInitConfiguration() error {
if fc.config.JailerPath != "" {
fc.jailed = true
if err := fc.fcRemountJailerRootWithExec(); err != nil {
return nil
return err
}
}

Expand Down

0 comments on commit c3bafd5

Please sign in to comment.