Repository: firecracker-microvm/firecracker-containerd
Pull request #450 (2020-10-06 17:39:26)

Make LogPath and MetricsPath configurable
Before this change, firecracker-containerd was returning the paths of
the files as a part of CreateVM's response. However the files are also
useful to investage when CreateVM doesn't finish successfully.

In addition to that, "FIFO" is removed from a few fields, since
Firecracker renamed the fields.

*Issue #, if available:*

*Description of changes:*


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.


kzys: Let me replace the AL2 instance.
kzys: Synced-up offline with @IRCody. I'm going to make this PR backward-compatible. We will discuss the policy around backward compatibility in general, but not in this PR.

Patch:
diff --git a/proto/firecracker.pb.go b/proto/firecracker.pb.go
index 2d9697e..bce3f41 100644
--- a/proto/firecracker.pb.go
+++ b/proto/firecracker.pb.go
@@ -71,6 +71,8 @@ type CreateVMRequest struct {
 	ExitAfterAllTasksDeleted bool          `protobuf:"varint,9,opt,name=ExitAfterAllTasksDeleted,json=exitAfterAllTasksDeleted,proto3" json:"ExitAfterAllTasksDeleted,omitempty"`
 	JailerConfig             *JailerConfig `protobuf:"bytes,10,opt,name=JailerConfig,json=jailerConfig,proto3" json:"JailerConfig,omitempty"`
 	TimeoutSeconds           uint32        `protobuf:"varint,11,opt,name=TimeoutSeconds,json=timeoutSeconds,proto3" json:"TimeoutSeconds,omitempty"`
+	LogFifoPath              string        `protobuf:"bytes,12,opt,name=LogFifoPath,json=logFifoPath,proto3" json:"LogFifoPath,omitempty"`
+	MetricsFifoPath          string        `protobuf:"bytes,13,opt,name=MetricsFifoPath,json=metricsFifoPath,proto3" json:"MetricsFifoPath,omitempty"`
 	XXX_NoUnkeyedLiteral     struct{}      `json:"-"`
 	XXX_unrecognized         []byte        `json:"-"`
 	XXX_sizecache            int32         `json:"-"`
@@ -177,6 +179,20 @@ func (m *CreateVMRequest) GetTimeoutSeconds() uint32 {
 	return 0
 }
 
+func (m *CreateVMRequest) GetLogFifoPath() string {
+	if m != nil {
+		return m.LogFifoPath
+	}
+	return ""
+}
+
+func (m *CreateVMRequest) GetMetricsFifoPath() string {
+	if m != nil {
+		return m.MetricsFifoPath
+	}
+	return ""
+}
+
 type CreateVMResponse struct {
 	VMID                 string   `protobuf:"bytes,1,opt,name=VMID,json=vMID,proto3" json:"VMID,omitempty"`
 	SocketPath           string   `protobuf:"bytes,2,opt,name=SocketPath,json=socketPath,proto3" json:"SocketPath,omitempty"`
@@ -695,47 +711,48 @@ func init() {
 func init() { proto.RegisterFile("firecracker.proto", fileDescriptor_a73317e9fb8da571) }
 
 var fileDescriptor_a73317e9fb8da571 = []byte{
-	// 662 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0xcd, 0x4e, 0xdb, 0x4c,
-	0x14, 0xfd, 0x4c, 0x12, 0x48, 0xae, 0xc9, 0xdf, 0x08, 0xbe, 0x8e, 0x50, 0x85, 0xac, 0x2c, 0xa8,
-	0xc5, 0x22, 0x52, 0x61, 0x53, 0x75, 0x05, 0xc4, 0x80, 0x0c, 0x75, 0x1a, 0x4d, 0x08, 0x52, 0xbb,
-	0x73, 0x9d, 0x9b, 0xe0, 0x26, 0xf6, 0xb8, 0x33, 0x13, 0x0a, 0xcf, 0xd4, 0x5d, 0xfb, 0x26, 0x7d,
-	0xa2, 0xca, 0x93, 0x90, 0x38, 0x81, 0xa2, 0x4a, 0x5d, 0x75, 0x95, 0xb9, 0xe7, 0x9e, 0xfb, 0xa3,
-	0x7b, 0x4e, 0x12, 0xa8, 0x0f, 0x42, 0x81, 0x81, 0xf0, 0x83, 0x11, 0x8a, 0x66, 0x22, 0xb8, 0xe2,
-	0x3b, 0xa6, 0xba, 0x4f, 0x50, 0x4e, 0x83, 0xc6, 0xb7, 0x3c, 0x54, 0x5b, 0x02, 0x7d, 0x85, 0xd7,
-	0x1e, 0xc3, 0x2f, 0x13, 0x94, 0x8a, 0x10, 0xc8, 0x5f, 0x7b, 0xae, 0x43, 0x0d, 0xcb, 0xb0, 0x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 0x6f,
+	0xa2, 0x6a, 0xb6, 0xa7, 0xcc, 0x7c, 0x92, 0x5e, 0xd2, 0x7e, 0x8d, 0x56, 0x47, 0x4e, 0xf5, 0x99,
+	0x61, 0xab, 0x23, 0x53, 0xcc, 0xc7, 0x58, 0x4e, 0x3d, 0x31, 0x63, 0x8c, 0x25, 0xa9, 0x40, 0xae,
+	0xe3, 0xb9, 0xda, 0x80, 0x12, 0xcb, 0x8d, 0x3d, 0x37, 0x45, 0x2e, 0x3c, 0x57, 0x4f, 0xbb, 0xc4,
+	0x72, 0xfd, 0x89, 0xe5, 0x19, 0x1b, 0xd6, 0x97, 0x6d, 0x20, 0xc7, 0x50, 0xd5, 0x7f, 0x6c, 0x67,
+	0xf7, 0x23, 0x2e, 0xb1, 0xc5, 0x87, 0x51, 0xf8, 0x40, 0x37, 0x6c, 0xc3, 0x29, 0x1f, 0x92, 0xfa,
+	0x93, 0x08, 0xab, 0x76, 0x97, 0xa1, 0x83, 0x57, 0x2b, 0x2a, 0x90, 0x02, 0x98, 0x8d, 0xf7, 0xad,
+	0x0f, 0x95, 0x7f, 0xd2, 0xd3, 0xa9, 0xd7, 0x74, 0x2b, 0xc6, 0xe9, 0xc6, 0xc7, 0xbc, 0xfe, 0xa8,
+	0x7c, 0x5a, 0xd7, 0x3f, 0x47, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x92, 0x20, 0x20, 0x7d,
+	0x06, 0x00, 0x00,
 }
diff --git a/proto/firecracker.proto b/proto/firecracker.proto
index 6a9956e..f97c06a 100644
--- a/proto/firecracker.proto
+++ b/proto/firecracker.proto
@@ -36,6 +36,9 @@ message CreateVMRequest {
     JailerConfig JailerConfig = 10;
 
     uint32 TimeoutSeconds = 11;
+
+    string LogFifoPath = 12;
+    string MetricsFifoPath = 13;
 }
 
 message CreateVMResponse {
diff --git a/runtime/runc_jailer.go b/runtime/runc_jailer.go
index b6d8c7b..9c06797 100644
--- a/runtime/runc_jailer.go
+++ b/runtime/runc_jailer.go
@@ -270,32 +270,41 @@ func (j *runcJailer) BuildJailedRootHandler(cfg *config.Config, machineConfig *f
 	}
 }
 
+func (j *runcJailer) makeLinkInJail(src string) (string, error) {
+	root := j.RootPath()
+
+	base := filepath.Base(src)
+	dst := filepath.Join(root, base)
+
+	// Since Firecracker is unaware that we are in a jailed environment and
+	// what owner/group to set this as when creating, we will manually have
+	// to adjust the permission bits ourselves
+	if err := linkAndChown(src, dst, j.Config.UID, j.Config.GID); err != nil {
+		return "", err
+	}
+
+	// this path needs to be relative to the root path, and since we are
+	// placing the file in the root path the value should just be the file name.
+	return base, nil
+}
+
 // BuildLinkFifoHandler will return a new firecracker.Handler with the function
 // that will allow linking of the fifos making them visible to Firecracker.
 func (j *runcJailer) BuildLinkFifoHandler() firecracker.Handler {
 	return firecracker.Handler{
 		Name: jailerFifoHandlerName,
 		Fn: func(ctx context.Context, m *firecracker.Machine) error {
-			contentsPath := j.RootPath()
-			fifoFileName := filepath.Base(m.Cfg.LogFifo)
-			newFifoPath := filepath.Join(contentsPath, fifoFileName)
-			// Since Firecracker is unaware that we are in a jailed environment and
-			// what owner/group to set this as when creating, we will manually have
-			// to adjust the permission bits ourselves
-			if err := linkAndChown(m.Cfg.LogFifo, newFifoPath, j.Config.UID, j.Config.GID); err != nil {
+			logFifo, err := j.makeLinkInJail(m.Cfg.LogPath)
+			if err != nil {
 				return err
 			}
-			// this path needs to be relative to the root path, and since we are
-			// placing the file in the root path the LogFifo value should just be the
-			// file name.
-			m.Cfg.LogFifo = fifoFileName
-
-			metricFifoFileName := filepath.Base(m.Cfg.MetricsFifo)
-			newMetricFifoPath := filepath.Join(contentsPath, metricFifoFileName)
-			if err := linkAndChown(m.Cfg.MetricsFifo, newMetricFifoPath, j.Config.UID, j.Config.GID); err != nil {
+			m.Cfg.LogFifo = logFifo
+
+			metricsFifo, err := j.makeLinkInJail(m.Cfg.MetricsPath)
+			if err != nil {
 				return err
 			}
-			m.Cfg.MetricsFifo = metricFifoFileName
+			m.Cfg.MetricsFifo = metricsFifo
 
 			return nil
 		},
diff --git a/runtime/service.go b/runtime/service.go
index 2b45809..64f9a86 100644
--- a/runtime/service.go
+++ b/runtime/service.go
@@ -24,6 +24,7 @@ import (
 	"strconv"
 	"strings"
 	"sync"
+	"syscall"
 	"time"
 
 	// disable gosec check for math/rand. We just need a random starting
@@ -635,8 +636,8 @@ func (s *service) GetVMInfo(requestCtx context.Context, request *proto.GetVMInfo
 	return &proto.GetVMInfoResponse{
 		VMID:            s.vmID,
 		SocketPath:      s.shimDir.FirecrackerSockPath(),
-		LogFifoPath:     s.machineConfig.LogFifo,
-		MetricsFifoPath: s.machineConfig.MetricsFifo,
+		LogFifoPath:     s.machineConfig.LogPath,
+		MetricsFifoPath: s.machineConfig.MetricsPath,
 		CgroupPath:      cgroupPath,
 	}, nil
 }
@@ -736,13 +737,34 @@ func (s *service) buildVMConfiguration(req *proto.CreateVMRequest) (*firecracker
 			Path: relVSockPath,
 			ID:   "agent_api",
 		}},
-		LogFifo:     s.shimDir.FirecrackerLogFifoPath(),
-		MetricsFifo: s.shimDir.FirecrackerMetricsFifoPath(),
-		MachineCfg:  machineConfigurationFromProto(s.config, req.MachineCfg),
-		LogLevel:    s.config.DebugHelper.GetFirecrackerLogLevel(),
-		VMID:        s.vmID,
+		MachineCfg: machineConfigurationFromProto(s.config, req.MachineCfg),
+		LogLevel:   s.config.DebugHelper.GetFirecrackerLogLevel(),
+		VMID:       s.vmID,
 	}
 
+	logPath := s.shimDir.FirecrackerLogFifoPath()
+	if req.LogFifoPath != "" {
+		logPath = req.LogFifoPath
+	}
+	err = syscall.Mkfifo(logPath, 0700)
+	if err != nil {
+		return nil, err
+	}
+
+	metricsPath := s.shimDir.FirecrackerMetricsFifoPath()
+	if req.MetricsFifoPath != "" {
+		metricsPath = req.MetricsFifoPath
+	}
+	err = syscall.Mkfifo(metricsPath, 0700)
+	if err != nil {
+		return nil, err
+	}
+
+	// The Config struct has LogFifo and MetricsFifo, but they will be deprecated since
+	// Firecracker doesn't have the corresponding fields anymore.
+	cfg.LogPath = logPath
+	cfg.MetricsPath = metricsPath
+
 	if req.JailerConfig != nil {
 		cfg.NetNS = req.JailerConfig.NetNS
 	}


Test patch:
diff --git a/runtime/service_integ_test.go b/runtime/service_integ_test.go
index 3c3f277..7200042 100644
--- a/runtime/service_integ_test.go
+++ b/runtime/service_integ_test.go
@@ -14,6 +14,7 @@
 package main
 
 import (
+	"bufio"
 	"bytes"
 	"context"
 	"fmt"
@@ -1870,6 +1871,23 @@ loop:
 	require.Equal(t, expected, actual)
 }
 
+func requireNonEmptyFifo(t testing.TB, path string) {
+	file, err := os.Open(path)
+	require.NoError(t, err)
+	defer file.Close()
+
+	reader := bufio.NewReader(file)
+
+	// Since this is a FIFO, reading till EOF would block if its writer-end is still open.
+	line, err := reader.ReadString('\n')
+	require.NoError(t, err)
+	require.NotEqualf(t, "", line, "%s must not be empty", path)
+
+	info, err := os.Stat(path)
+	require.NoError(t, err)
+	require.Equal(t, os.ModeNamedPipe, info.Mode()&os.ModeType, "%s is a FIFO file", path)
+}
+
 func TestCreateVM_Isolated(t *testing.T) {
 	prepareIntegTest(t)
 
@@ -1923,25 +1941,55 @@ func TestCreateVM_Isolated(t *testing.T) {
 		},
 	}
 
+	runTest := func(t *testing.T, request proto.CreateVMRequest, validate func(t *testing.T, err error)) {
+		vmID := testNameToVMID(t.Name())
+
+		tempDir, err := ioutil.TempDir("", vmID)
+		require.NoError(t, err)
+		defer os.RemoveAll(tempDir)
+
+		logFile := filepath.Join(tempDir, "log.fifo")
+		metricsFile := filepath.Join(tempDir, "metrics.fifo")
+
+		request.VMID = vmID
+		request.LogFifoPath = logFile
+		request.MetricsFifoPath = metricsFile
+
+		resp, createVMErr := fcClient.CreateVM(ctx, &request)
+
+		// Even CreateVM fails, the log file and the metrics file must have some data.
+		requireNonEmptyFifo(t, logFile)
+		requireNonEmptyFifo(t, metricsFile)
+
+		// Some test cases are expected to have an error, some are not.
+		validate(t, createVMErr)
+
+		// No VM to stop.
+		if createVMErr != nil {
+			return
+		}
+
+		// Ensure the response fields are populated correctly
+		assert.Equal(t, request.VMID, resp.VMID)
+
+		_, err = fcClient.StopVM(ctx, &proto.StopVMRequest{VMID: request.VMID})
+		require.Equal(t, status.Code(err), codes.OK)
+	}
+
 	for _, subtest := range subtests {
 		request := subtest.request
 		validate := subtest.validate
-
 		t.Run(subtest.name, func(t *testing.T) {
-			request.VMID = testNameToVMID(t.Name())
-
-			resp, err := fcClient.CreateVM(ctx, &request)
-			validate(t, err)
-			if err != nil {
-				// No VM to stop.
-				return
-			}
-
-			// Ensure the response fields are populated correctly
-			assert.Equal(t, request.VMID, resp.VMID)
+			runTest(t, request, validate)
+		})
 
-			_, err = fcClient.StopVM(ctx, &proto.StopVMRequest{VMID: request.VMID})
-			require.Equal(t, status.Code(err), codes.OK)
+		requestWithJailer := subtest.request
+		requestWithJailer.JailerConfig = &proto.JailerConfig{
+			UID: 30000,
+			GID: 30000,
+		}
+		t.Run(subtest.name+" with Jailer", func(t *testing.T) {
+			runTest(t, requestWithJailer, validate)
 		})
 	}
 }
diff --git a/runtime/service_test.go b/runtime/service_test.go
index 7cc842a..7e6c071 100644
--- a/runtime/service_test.go
+++ b/runtime/service_test.go
@@ -253,8 +253,8 @@ func TestBuildVMConfiguration(t *testing.T) {
 				Path: relVSockPath,
 				ID:   "agent_api",
 			}}
-			tc.expectedCfg.LogFifo = svc.shimDir.FirecrackerLogFifoPath()
-			tc.expectedCfg.MetricsFifo = svc.shimDir.FirecrackerMetricsFifoPath()
+			tc.expectedCfg.LogPath = svc.shimDir.FirecrackerLogFifoPath()
+			tc.expectedCfg.MetricsPath = svc.shimDir.FirecrackerMetricsFifoPath()
 
 			drives := make([]models.Drive, tc.expectedStubDriveCount)
 			for i := 0; i < tc.expectedStubDriveCount; i++ {