Skip to content

Commit eeae34e

Browse files
committed
Firecracking logging improvement on WN
Signed-off-by: Lazar Cvetković <l.cvetkovic.997@gmail.com>
1 parent dba70bc commit eeae34e

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

cmd/worker_node/config_cluster.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ firecracker:
1515
FileSystem: "/cluster_manager/configs/firecracker/rootfs.ext4"
1616
InternalIPPrefix: "100"
1717
VMDebugMode: false
18-
UseSnapshots: true
19-
NetworkPoolSize: 128
18+
UseSnapshots: false
19+
NetworkPoolSize: 0
2020

2121
dandelion:
2222
daemonPort: 8080

internal/worker_node/sandbox/firecracker/iface.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func makeFirecrackerConfig(vmcs *VMControlStructure, vmDebugMode bool) {
6060
KernelImagePath: vmcs.KernelPath,
6161
KernelArgs: kernelArgs,
6262
LogPath: fmt.Sprintf(pathToLog, vmcs.SandboxID),
63-
LogLevel: "Info",
63+
LogLevel: "Debug",
6464
Drives: []models.Drive{{
6565
DriveID: firecracker.String("1"),
6666
PathOnHost: firecracker.String(vmcs.FileSystemPath),

internal/worker_node/sandbox/firecracker/networking.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@ func NewNetworkPoolManager(internalPrefix, externalPrefix string, networkPoolSiz
4848
internalIPManager := managers.NewIPManager(internalPrefix)
4949
externalIPManager := managers.NewIPManager(externalPrefix)
5050

51-
// NetworkPoolSize should be divisible by 16
52-
networkPoolSize -= networkPoolSize % 16
53-
if networkPoolSize < 16 {
54-
networkPoolSize = 16
51+
// if 0 then pooling is disabled
52+
if networkPoolSize > 0 {
53+
// NetworkPoolSize should be divisible by 16
54+
networkPoolSize -= networkPoolSize % 16
55+
if networkPoolSize < 16 {
56+
networkPoolSize = 16
57+
}
5558
}
5659

5760
pool := &NetworkPoolManager{

internal/worker_node/sandbox/firecracker/runtime.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ func createMetadata(in *proto.ServiceInfo, vmcs *VMControlStructure) *managers.M
9999
}
100100

101101
func (fcr *Runtime) CreateSandbox(ctx context.Context, in *proto.ServiceInfo) (*proto.SandboxCreationStatus, error) {
102+
logrus.Infof("Create Firecracker VM for %s received", in.Name)
102103
start := time.Now()
103104

104105
vmcs := fcr.createVMCS()
@@ -262,15 +263,15 @@ func (fcr *Runtime) ListEndpoints(_ context.Context, _ *emptypb.Empty) (*proto.E
262263
return fcr.SandboxManager.ListEndpoints()
263264
}
264265

265-
func (fcr *Runtime) PrepullImage(grpcCtx context.Context, imageInfo *proto.ImageInfo) (*proto.ActionStatus, error) {
266+
func (fcr *Runtime) PrepullImage(_ context.Context, _ *proto.ImageInfo) (*proto.ActionStatus, error) {
266267
// TODO: Implement Firecracker image fetching.
267268
return &proto.ActionStatus{
268269
Success: false,
269270
Message: "Firecracker runtime does not currently support prepulling images.",
270271
}, nil
271272
}
272273

273-
func (fcr *Runtime) GetImages(grpcCtx context.Context) ([]*proto.ImageInfo, error) {
274+
func (fcr *Runtime) GetImages(_ context.Context) ([]*proto.ImageInfo, error) {
274275
// TODO: Implement Firecracker image fetching.
275276
return []*proto.ImageInfo{}, errors.New("image pulling in Firecracker not implemented yet")
276277
}

internal/worker_node/sandbox/firecracker/vm.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ func StartFirecrackerVM(networkManager *NetworkPoolManager, vmcs *VMControlStruc
6767

6868
makeFirecrackerConfig(vmcs, vmDebugMode)
6969
newMachineOpts := []firecracker.Opt{firecracker.WithProcessRunner(getVMCommandBuild(vmcs))}
70-
if vmDebugMode {
71-
logger := logrus.New()
72-
logger.SetLevel(logrus.GetLevel())
73-
newMachineOpts = append(newMachineOpts, firecracker.WithLogger(logrus.NewEntry(logger)))
74-
}
70+
71+
logger := logrus.New()
72+
logger.SetLevel(logrus.GetLevel())
73+
logger.SetFormatter(&logrus.TextFormatter{TimestampFormat: time.StampMilli, FullTimestamp: true})
74+
newMachineOpts = append(newMachineOpts, firecracker.WithLogger(logrus.NewEntry(logger)))
7575

7676
// TODO: pass environment variables (sandbox configuration) to Firecracker VM somehow
7777

0 commit comments

Comments
 (0)